Opened 5 years ago

Closed 5 years ago

#344 closed defect (fixed)

FFProbe does not provide PTS, DTS info present in MPEG file.

Reported by: darrenhudson Owned by: michael
Priority: normal Component: ffprobe
Version: git-master Keywords: FFProbe Time Timestamp PTS DTS
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no



I'm trying to use FFProbe to extract PTS time data for each frame in a number of MPEG4 files. Mostly it works great but I have come across one that consitently fails. The video that fails was streamed to file (using VLC) from a UDP 4100 Dome Camera and I have an example file I can provide if necessary.

Other tools I have used such as Elecard Stream Analyzer show (as far as I can tell) that the video file contains correctly formatted PTS, DTS data but FFProbe just returns N/A for these times when I specify the -show_packets option.

Any help at all would be very much appreciated.

I'm running FFProbe on Windows and have tried a number of builds, all displaying the same problem.



Attachments (3)

344 - FFProbe PTS Issue.mpg (2.3 MB) - added by darrenhudson 5 years ago.
Problem MPEG File
344 - FFProbe Output.txt (42.2 KB) - added by darrenhudson 5 years ago.
344 - FFProbe Elecard SA Output.txt (306.2 KB) - added by darrenhudson 5 years ago.

Change History (10)

Changed 5 years ago by darrenhudson

Problem MPEG File

Changed 5 years ago by darrenhudson

Changed 5 years ago by darrenhudson

comment:1 Changed 5 years ago by darrenhudson

I am calling:

ffprobe -show_packets filename.mpg

Output for the attached example is as follows:

ffprobe version N-31329-g58257ea, Copyright (c) 2007-2011 the FFmpeg developers

built on Jul 8 2011 22:27:48 with gcc 4.6.1
configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --en

able-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --
enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --
enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib

libavutil 51. 11. 0 / 51. 11. 0
libavcodec 53. 7. 0 / 53. 7. 0
libavformat 53. 5. 0 / 53. 5. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 24. 3 / 2. 24. 3
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0

[NULL @ 002FBE20] start time is not set in av_estimate_timings_from_pts
Input #0, mpeg, from '5.mpg':

Duration: N/A, bitrate: N/A

Stream #0.0[0x1e0]: Video: mpeg4, yuv420p, 720x576 [PAR 1:1 DAR 5:4], 60k tbr, 90k tbn, 60k tbc

comment:2 Changed 5 years ago by cehoyos

  • Component changed from FFmpeg to FFprobe
  • Reproduced by developer unset
  • Status changed from new to open
  • Version changed from unspecified to git-master

comment:3 Changed 5 years ago by darrenhudson

Out of interest, DVBSnoop can process these files successfully. I have used the following options:

dvbsnoop.exe -ph 0 -pd 3 -td -s pes -if video.mpg

comment:4 Changed 5 years ago by reimar

Well, FFmpeg can find the pts values, too, as you see when you change this:
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1001,7 +1001,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,

some mpeg2 in mpeg-ps lack dts (issue171 / input_file.mpg)
we take the conservative approach and discard both
Note, if this is misbehaving for a H.264 file then possibly presentation_delayed is not set correctly.

  • if(delay==1 && pkt->dts == pkt->pts && pkt->dts != AV_NOPTS_VALUE && presentation_delayed){

+ if(0 && delay==1 && pkt->dts == pkt->pts && pkt->dts != AV_NOPTS_VALUE && presentation_delayed){

av_log(s, AV_LOG_DEBUG, "invalid dts/pts combination\n");
pkt->dts= pkt->pts= AV_NOPTS_VALUE;


However, FFmpeg removes them because they are clearly and obviously wrong. The video contains B-frames, however the pts and dts value are identical!
Are you sure the stream analyzer correct checks this?

comment:5 Changed 5 years ago by darrenhudson


Many thanks for taking a look at this. I can see that ffprobe -show_streams reports has_b_frames=1 however when I look at the frames within the file I don't see any reported as b-frames (for example in the elecard output attached). Is it possible that the stream actually doesn't include any b-frames? Perhaps either something is wrong in the stream or in FFPROBE that means it incorrectly thinks there are b-frames?


comment:6 Changed 5 years ago by reimar

I thought it did actually contain B-frames, but it looks like I didn't look right.
However FFmpeg expects the low delay flag in the vol header (in vol control which is absent here) to be set in that case.
No idea how it should behave/what should be done about that.

comment:7 Changed 5 years ago by michael

  • Reproduced by developer set
  • Resolution set to fixed
  • Status changed from open to closed

Fixed by not droping both timestamps if they are invalid, this may need to be finetuned or reverted if it causes problems

Note: See TracTickets for help on using tickets.