5

I have been learning ffmepg for a couple of days. I'm struggling to understand how pts or dts works.

This is the command I entered

ffprobe -show_entries packet -read_intervals 10%+#3 Input

   Stream #0:0: Video: h264 (High 10), yuv420p10le(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Metadata:
  DURATION        : 00:02:00.203000000
Stream #0:1: Audio: flac, 48000 Hz, stereo, s16 (default)
Metadata:
  DURATION        : 00:02:00.062000000
[PACKET]
codec_type=video
stream_index=0
pts=6506
pts_time=6.506000
dts=N/A
dts_time=N/A
duration=41
duration_time=0.041000
convergence_duration=N/A
convergence_duration_time=N/A
size=205369
pos=9510964
flags=K_
[/PACKET]

I guess duration_time 0.041000 means the frame last(show) for 0.041 second.

I don't know how to interpret this 'pts_time' as normal time like minutes and seconds( e.g 1 min 3 second )

I set the intervals 10%+=3, which means 3 packets after 10 seconds. I can't find the relation between 10 second and pts_time=6.506000

1 Answer 1

3

pts_time=6.506000 means an absolute presentation timestamp of 6.506 seconds. It's relative presentation time depends on the start_time of the file, for which use -show_entries format=start_time.

ffprobe seeks to keyframes, so it will seek to the nearest KF at or before the specified time and then print info for the stated number of packets.

4
  • IIRC, flags=k means key frame, right? I ran the command again with -read_intervals 10%+#6. There are key frames with pts_time=6.548, 6.571...Which is closer to 10 sec. or am I mistaken, flags=k doesn't mean key frame? I can upload the result of the command if you need.
    – helming
    Jan 11, 2020 at 10:49
  • Don't consider audio packets.
    – Gyan
    Jan 11, 2020 at 10:51
  • You're right, those are audio packets. so is it safe to guess that pts_time represents seconds, regardless of tbn value?
    – helming
    Jan 11, 2020 at 10:59
  • Yes. pts_time is always in seconds; pts always in multiples of time base.
    – Gyan
    Jan 11, 2020 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.