[FFmpeg-user] FFprobe does not set duration

Wesley Wen delbin.wen at gmail.com
Fri Jun 12 08:29:03 CEST 2015


Hi,
I tried to use FFprobe to get duration of the file, but failed. Here is my
command (with debug information) and console output.

$ffprobe -i 464223_m.mpg -show_format -loglevel debug
ffprobe version git-2015-06-12-4af9eb4 Copyright (c) 2007-2015 the FFmpeg
developers
  built with Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM
3.6.0svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared
--enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables
--enable-avresample --cc=clang --host-cflags= --host-ldflags=
--enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid
--enable-ffplay --enable-libfdk-aac --enable-libx265 --enable-nonfree
--enable-vda
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
[mpeg @ 0x7fbf9b802a00] Format mpeg probed with size=2048 and score=26
[mpeg @ 0x7fbf9b802a00] Before avformat_find_stream_info() pos: 0 bytes
read:32768 seeks:0
[mpeg @ 0x7fbf9b802a00] probing stream 0 pp:2500
[mpeg @ 0x7fbf9b802a00] Probe with size=1994, packets=1 detected mpegvideo
with score=25
[mpeg @ 0x7fbf9b802a00] probed stream 0
[mpeg @ 0x7fbf9b802a00] Probe buffer size limit of 5000000 bytes reached
[mpeg @ 0x7fbf9b802a00] stream 0 : no PTS found at end of file, duration
not set
[mpeg @ 0x7fbf9b802a00] stream 1 : no PTS found at end of file, duration
not set
[mpeg @ 0x7fbf9b802a00] After avformat_find_stream_info() pos: 0 bytes
read:12927344 seeks:6 frames:337
Input #0, mpeg, from '464223_m.mpg':
  Duration: N/A, start: 0.262000, bitrate: N/A
    Stream #0:0[0x1e0], 145, 1/90000: Video: mpeg2video (Main), 1 reference
frame, yuv420p(tv, left), 720x480 [SAR 32:27 DAR 16:9], 1001/60000, 8000
kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x1c0], 192, 1/90000: Audio: mp2, 48000 Hz, stereo, s16p,
384 kb/s
detected 4 logical cores
[FORMAT]
filename=464223_m.mpg
nb_streams=2
nb_programs=0
format_name=mpeg
format_long_name=MPEG-PS (MPEG-2 Program Stream)
start_time=0.262000
duration=N/A
size=1565743108
bit_rate=N/A
probe_score=26
[/FORMAT]
[AVIOContext @ 0x7fbf9af00140] Statistics: 12927344 bytes read, 6 seeks

The debug log told me that no PTS found at end of file, and therefore
duration was not set. So I tried to dump every frame with -show_frames
option, and I can see there are PTS values for last audio and video samples.
$ffprobe -i 464223_m.mpg -show_frames -loglevel debug
(... keep the last few audio & video samples ...)
[FRAME]
media_type=video
stream_index=0
key_frame=0
pkt_pts=37939458
pkt_pts_time=421.549533
pkt_dts=37939458
pkt_dts_time=421.549533
best_effort_timestamp=37939458
best_effort_timestamp_time=421.549533
pkt_duration=3003
pkt_duration_time=0.033367
pkt_pos=452780064
pkt_size=15296
width=720
height=480
pix_fmt=yuv420p
sample_aspect_ratio=32:27
pict_type=B
coded_picture_number=12627
display_picture_number=0
interlaced_frame=1
top_field_first=1
repeat_pict=0
[/FRAME]
[FRAME]
media_type=audio
stream_index=1
key_frame=1
pkt_pts=37931580
pkt_pts_time=421.462000
pkt_dts=37931580
pkt_dts_time=421.462000
best_effort_timestamp=37931580
best_effort_timestamp_time=421.462000
pkt_duration=2160
pkt_duration_time=0.024000
pkt_pos=N/A
pkt_size=1152
sample_fmt=s16p
nb_samples=1152
channels=2
channel_layout=stereo
[/FRAME]
[FRAME]
media_type=audio
stream_index=1
key_frame=1
pkt_pts=37933740
pkt_pts_time=421.486000
pkt_dts=37933740
pkt_dts_time=421.486000
best_effort_timestamp=37933740
best_effort_timestamp_time=421.486000
pkt_duration=2160
pkt_duration_time=0.024000
pkt_pos=452835360
pkt_size=1152
sample_fmt=s16p
nb_samples=1152
channels=2
channel_layout=stereo
[/FRAME]
[FRAME]
media_type=video
stream_index=0
key_frame=0
pkt_pts=37942461
pkt_pts_time=421.582900
pkt_dts=37942461
pkt_dts_time=421.582900
best_effort_timestamp=37942461
best_effort_timestamp_time=421.582900
pkt_duration=3003
pkt_duration_time=0.033367
pkt_pos=452712480
pkt_size=50168
width=720
height=480
pix_fmt=yuv420p
sample_aspect_ratio=32:27
pict_type=P
coded_picture_number=12625
display_picture_number=0
interlaced_frame=1
top_field_first=1
repeat_pict=0
[/FRAME]
[FRAME]
media_type=video
stream_index=0
key_frame=0
pkt_pts=37945464
pkt_pts_time=421.616267
pkt_dts=37945464
pkt_dts_time=421.616267
best_effort_timestamp=37945464
best_effort_timestamp_time=421.616267
pkt_duration=3003
pkt_duration_time=0.033367
pkt_pos=452851744
pkt_size=15989
width=720
height=480
pix_fmt=yuv420p
sample_aspect_ratio=32:27
pict_type=B
coded_picture_number=12629
display_picture_number=0
interlaced_frame=1
top_field_first=1
repeat_pict=0
[/FRAME]
[FRAME]
media_type=audio
stream_index=1
key_frame=1
pkt_pts=37935900
pkt_pts_time=421.510000
pkt_dts=37935900
pkt_dts_time=421.510000
best_effort_timestamp=37935900
best_effort_timestamp_time=421.510000
pkt_duration=2160
pkt_duration_time=0.024000
pkt_pos=N/A
pkt_size=1152
sample_fmt=s16p
nb_samples=1152
channels=2
channel_layout=stereo
[/FRAME]
[FRAME]
media_type=audio
stream_index=1
key_frame=1
pkt_pts=37938060
pkt_pts_time=421.534000
pkt_dts=37938060
pkt_dts_time=421.534000
best_effort_timestamp=37938060
best_effort_timestamp_time=421.534000
pkt_duration=2160
pkt_duration_time=0.024000
pkt_pos=452886560
pkt_size=1152
sample_fmt=s16p
nb_samples=1152
channels=2
channel_layout=stereo
[/FRAME]
[FRAME]
media_type=audio
stream_index=1
key_frame=1
pkt_pts=37940220
pkt_pts_time=421.558000
pkt_dts=37940220
pkt_dts_time=421.558000
best_effort_timestamp=37940220
best_effort_timestamp_time=421.558000
pkt_duration=2160
pkt_duration_time=0.024000
pkt_pos=452937760
pkt_size=1152
sample_fmt=s16p
nb_samples=1152
channels=2
channel_layout=stereo
[/FRAME]
[FRAME]
media_type=audio
stream_index=1
key_frame=1
pkt_pts=37942380
pkt_pts_time=421.582000
pkt_dts=37942380
pkt_dts_time=421.582000
best_effort_timestamp=37942380
best_effort_timestamp_time=421.582000
pkt_duration=2160
pkt_duration_time=0.024000
pkt_pos=N/A
pkt_size=1152
sample_fmt=s16p
nb_samples=1152
channels=2
channel_layout=stereo
[/FRAME]
[FRAME]
media_type=audio
stream_index=1
key_frame=1
pkt_pts=37944540
pkt_pts_time=421.606000
pkt_dts=37944540
pkt_dts_time=421.606000
best_effort_timestamp=37944540
best_effort_timestamp_time=421.606000
pkt_duration=2160
pkt_duration_time=0.024000
pkt_pos=452964384
pkt_size=1152
sample_fmt=s16p
nb_samples=1152
channels=2
channel_layout=stereo
[/FRAME]
[FRAME]
media_type=video
stream_index=0
key_frame=0
pkt_pts=37948467
pkt_pts_time=421.649633
pkt_dts=N/A
pkt_dts_time=N/A
best_effort_timestamp=37948467
best_effort_timestamp_time=421.649633
pkt_duration=3003
pkt_duration_time=0.033367
pkt_pos=452798496
pkt_size=49492
width=720
height=480
pix_fmt=yuv420p
sample_aspect_ratio=32:27
pict_type=P
coded_picture_number=12628
display_picture_number=0
interlaced_frame=1
top_field_first=1
repeat_pict=0
[/FRAME]
[AVIOContext @ 0x7feafb521500] Statistics: 466043248 bytes read, 6 seeks

I'm not sure if this is FFprobe issue or content issue. If content issue,
how could I do further investigation and relay the information to content
provider?.

Thanks,
Wesley


More information about the ffmpeg-user mailing list