[FFmpeg-devel] [PATCH] Implement guessed_pts in avcodec_decode_video2.

Måns Rullgård mans
Tue Feb 1 20:34:23 CET 2011

Nicolas George <nicolas.george at normalesup.org> writes:

> Le tridi 13 pluvi?se, an CCXIX, Michael Niedermayer a ?crit?:
>> Anyway, iam out of this discussion, do what you want.
> Before you go, could you please tell us if you remember why you committed
> this code in the first place last year? Knowing what actual problem it was
> meant to fix would be a great help to settle the discussion.
> I think M?ns has a valid point about the H.264 in AVI case: if the demuxer
> synthesizes PTS that are not actually in the file, and these PTS turn out to
> be wring, this is a problem in its own right, I think you will concede that
> easily.
> On the other hand, if there are files out there in the world where some of
> the timestamps are actually wrong, then lavc needs to be able to deal with
> them, I hope M?ns will agree with that.

The decoder has nothing to do with detecting or correcting bad
timestamps.  The only thing it should do is allow a value to be
tracked through the reordering.  If these values are good or bad is
for something else to determine and, if desired, attempt to correct.

The problem with the current approach is that perfectly good
timestamps (e.g. from mkv files) are misdetected as wrong and "fixed",
resulting in the notorious non-monotone timestamps error, among other

Any automatic tampering with timestamps should be conservative, only
kicking in when things are obviously wrong, such as two frames with
the same PTS stored in the container.  We have to assume files are
correct by default, and enable aggressive fixups only after being
explicitly requested.

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list