[FFmpeg-devel] avcodec_decode_video(): is there a way to pass in PTS and retrieve it again after picture reordering?

Reinhard Nissl rnissl
Sat Jan 3 19:23:02 CET 2009


xine-lib calls avcodec_decode_video() to use for example ffmpeg's
H.264 decoder. For synchronizing audio and video, xine-lib uses
PTS values which are available for the coded video data.

At the moment, xine-lib passes the video data to
avcodec_decode_video(). When it gets back a frame, it takes the
current input buffer's PTS value and assigns it to the returned
frame. This is nonsense as the PTS values arrive in decoding
order while the frames are returned in displaying order.

As as result, video PTS values jitter a lot and A/V sync is never

To fix this issue, xine-lib would have to pass the PTS value
together with video data into avcodec_decode_video() and would
have to retrieve the PTS value later from the returned frame as
only the H.264 decoder knows about picture reordering and is
therefore the only place to shuffle PTS values accordingly.

So, is there such a possibility available with
avcodec_decode_video() or is there another function which
provides this ability?

Dipl.-Inform. (FH) Reinhard Nissl
mailto:rnissl at gmx.de

More information about the ffmpeg-devel mailing list