[FFmpeg-devel] [PATCH 2/3] ffmpeg: use new decode API

Timo Rothenpieler timo at rothenpieler.org
Fri Sep 30 11:56:53 EEST 2016

Am 30.09.2016 um 10:43 schrieb wm4:
> On Fri, 30 Sep 2016 10:38:41 +0200
> Timo Rothenpieler <timo at rothenpieler.org> wrote:
>>> Will push this patch in 24 hours unless other problems are pointed out.  
>> +1 for pushing the entire series.
>> Changes like this are almost impossible to do without breaking some
>> corner cases.
>> Delaying it until all of those are fixed won't get the project anywhere.
> Keep in mind that I'll fix anything that is pointed out and
> reproducible.
>> So far I haven't found anything that breaks for me.
>> Using it with cuvid, which is so far the only decoder that natively
>> implements the new decode API, also works fine, as long as no
>> deinterlacing/multi-frame-output is involved.
>> Fixing the corner cases can be done as they are discovered and brought
>> up as bugs.
> Why exactly does multi-frame output not work? Though that would of
> course be new functionality, rather than making sure existing code
> works.

Because the decoder changes the frame rate in case of deinterlacing, as
it outputs two frames for every input frame.
FFmpeg is not aware of the possibility of that happening at all, and
does not check/re-evaluate the frame rate.

The primary issue causes by that is that it uses the original framerate
as timebase for the encoder, and with a 1/25 timebase it's impossible to
represent 50 frames per second.

On top of that, cuvid does not set the framerate on open, but when the
first frame is decoded.
Also I just realized I never tried just doubling the framerate on open
if deinterlacing is enabled, which might just be enough to make it work.

More information about the ffmpeg-devel mailing list