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

Måns Rullgård mans
Sun Jan 30 21:22:33 CET 2011

Luca Barbato <lu_zero at gentoo.org> writes:

> On 01/30/2011 08:39 PM, M?ns Rullg?rd wrote:
>> Nicolas George <nicolas.george at normalesup.org> writes:
>>> This patch moves the guess_correct_pts function from cmdutils to libavcodec.
>>> The feature is available through a new field in AVFrame, guessed_pts.
>>> make test and ffplay still work, but I would like to have some more time to
>>> read it carefully, but I have things to do in the next few days, and this
>>> feature was discussed in another thread, so here the current version. It
>>> will conflict with some patches that will certainly soon be applied, so I
>>> will update and submit it again anyway.
>> What is all this guessing supposed to achieve anyway?  It makes me
>> feel uneasy.
> I think the aim is to have uniform behaviour across the movie filter and
> ffplay.

That's not answering the question.  There should _never_ be any need
to guess a PTS.  For a given video frame, there are two possibilities:

1. The container provided a PTS.  Track this across the decoder via
   pkt_pts.  Done.

2. The container did not provide a PTS.  Add 1/fps to previous PTS.  Done.

If the video is not constant frame rate and the container is missing
timestamps, you have a problem no matter what you do.

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list