[Ffmpeg-devel] timestamp of a decoded frame?

Michel Bardiaux mbardiaux
Mon Jun 12 15:08:15 CEST 2006

Eric Fernandez wrote:
> Hi,
> I use avcodec_decode_video() in my program to decode each frame of an
>  MPEG file. How can I determine the timestamp of the decoded frame? I
>  tried to find a way in the documentation and examples, but was 
> unsuccessful.
> Many thanks, Eric

Look in the archives for a thread with subject "[Ffmpeg-devel]
Timestamps on Decoding". It gives the easy rule "When you input a frame 
with DTS "t", a frame with PTS "t" will come out of the decoder". Plus 
lots of hints and code samples.

What the field 'pts' in AVFrame is for is indeed puzzling. As well as 
why the API does NOT give pts and dts to avcodec_decode_video, leaving 
to it all the necessary logic...

Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles

More information about the ffmpeg-devel mailing list