[FFmpeg-devel] Maintainership question

Nicolas George nicolas.george
Mon Feb 14 19:04:50 CET 2011

Le quartidi 24 pluvi?se, an CCXIX, Ronald S. Bultje a ?crit?:
> Packet PTS and DTS are _input_, reordered PTS is _output_, these are
> very different things.

I tried to use the point of view of an application developer who wants to
decode a file: he does not know what is what.

> What I expect from the avcodec_decode_videoX() API is that I input a
> frame with pts (maybe, possibly dts is also set, but I'd like to
> pretend that it doesn't exist at this layer). Then the video decoder
> does %$MAGIC^& and the output has, tadaaaaaa, a ... (you would never
> guess this) ... reordered_pts. So for the sake of simplicity, let's
> rename these into "input PTS" and "output PTS". What you then have is
> avcodec_decode_videoX() takes an input PTS and provides an output PTS.
> That sounds incredibly simple and useful. I could imagine writing a
> video player around that that cannot possibly suck! Wouldn't that be
> amazing?

That is _exactly_ what my patch implements!

> "Let me re-state the question as follows: I have a file that contains a
> single video streams. The file is stored in location /path/to/file
> (format "Y") and contains irregular timestamps. The video contains
> B-frames. How does FFmpeg calculate the PTS (I don't care about DTS at
> this point) of decoded images coming out of avcodec_decode_videoX()?
> Quasi-code is acceptable to answer this exercise."

Assuming that your video is perfect (it has a PTS stored for each frame, and
that PTS is correct):

- lavf reads the bits coding the PTS and stores them in packet->pts.

- lavc stores pkt->pts with the decoded frame and keeps it there while

- the application reads frame->pkt_pts.

But this is making a big assumption: that the format has PTS on all packets.
For a format that has no PTS and only DTS, this does not work at all.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110214/7e32e68e/attachment.pgp>

More information about the ffmpeg-devel mailing list