[Ffmpeg-devel] problem with timestamps in a video file

Vincent Torri vtorri
Mon Apr 24 18:21:53 CEST 2006



On Fri, 21 Apr 2006, M?ns Rullg?rd wrote:

> Vincent Torri <vtorri at univ-evry.fr> writes:
>
>> Hello,
>>
>> I'm using gstreamer to read a file (xvid stream, no audio, in a AVI) :
>>
>> http://www.iecn.u-nancy.fr/~torri/files/gstreamer_test_seek/blood.avi
>>
>> Gstreamer uses in that case ffmpeg. My aim is to do exact seeking (i
>> work on avisynth 3.0). But it seems that the gstreamer plugin has
>> problems with that file.
>>
>> More precisely, when I seek to frame 0 (for example), the timestamp
>> returned by gstreamer is 1.0/fps s., instead of 0 s.
>>
>> One of the gstreamer dev analysed the file :
>>
>> "[the file] has a decodable frame at time 0 but is delayed and
>> outputted when the second frame is sent to the decoder. So the first
>> frame to exit the decoder gets the timestamp of the second frame"
>>
>> it seems that ffmpeg does not manage the timestamps for us, and it
>> might buffer/delay/drop an unknown number of frames (it's only
>> suppositions), and so, the guess of timestamps is quite complicated.
>
> Many codecs have a delay of a few frames from input to output.  This
> is necessary if the coded order is not necessarily equal to the
> display order (such as when B frames are used).  Even if no B frames
> are used, it is necessary to delay the output when there is no
> indication that there really are no B frames (low_delay in MPEG speak).
>
>> so, here is the question :
>>
>> Is there a way to feed data+timestamp to the decoder and get a
>> frame+corresponding timestamp back ?
>
> You can use the codec_picture_number and display_picture_number fields
> in AVFrame to track the decoding.
>
> Keep in mind also that the AVI format has no notion of timestamps.

Thank you. this can help us a lot

Vincent Torri



More information about the ffmpeg-devel mailing list