[FFmpeg-devel] Maintainership question

Ronald S. Bultje rsbultje
Sun Feb 13 02:49:08 CET 2011


Hi,

On Sat, Feb 12, 2011 at 7:42 PM, Nicolas George
<nicolas.george at normalesup.org> wrote:
> After a client application calls avcodec_decode_videoX, it has no less than
> four potential timestamps for this frame:
> - the packet PTS,
> - the packet DTS,
> - the reordered PTS,
> - the codec timestamp.

Packet PTS and DTS are _input_, reordered PTS is _output_, these are
very different things.

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?

I know stuff like parsers can interpolate PTS for formats where 1
packet != 1 frame, then there's this stupid thing called DTS because
idiots used AVI with B-frames, there's bad timestamps which Mans
already referred to, you can detect the impossible ones and throw them
out, for the bad ones, well, they're bad, screw it.

But a lot of the stuff that the various pieces of timestamp correction
codes and "guess [dp]ts from [pd]ts" in ffmpeg/lav[cf] do doesn't
really fit in anywhere in this scheme. It's unclear what it fixes, it
introduces new bugs (Mans and I both mentioned ones already), and in
the end nobody really knows which piece does which because some code
lives in lavc, some in lavf, some in ffmpeg.c/ffplay.c/cmdutils.c,
some of it is enabled on a per-codec basis while it should be
per-format, and so on.

So I'll ask the same question again:

"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."

Ronald



More information about the ffmpeg-devel mailing list