[FFmpeg-devel] [PATCH] avcodec/nvenc: multiple reference frames support

Timo Rothenpieler timo at rothenpieler.org
Fri Sep 27 12:55:43 EEST 2019


On 27/09/2019 11:04, Roman Arzumanyan wrote:
> Hello,
> 
> This patch adds multiple reference frames support (part of Video Codec SDK 9.1).
> It adds "nb_ref_frames" CLI option to set number of reference frames. Possible values:
> 
>    *   auto - let encoder decide (default value).
>    *   [0;7] - set value by hand. 0 is equal to auto.
> 
> Usage example:
> ffmpeg -i big_buck_bunny_1080p_h264.mov -c:v hevc_nvenc -frames:v 128 -nb_ref_frames auto -bf 2 -y big_buck_bunny_1080p_nb_auto.h265
> ffmpeg -i big_buck_bunny_1080p_h264.mov -c:v h264_nvenc -frames:v 128 -nb_ref_frames 1          -y big_buck_bunny_1080p_nb_1.h264
> 
> Actual number of reference frames will be determined by encoder, but it will not exceed value of "nb_ref_frames" option.

Thanks!

Two things:

First, this needs SDK Version Guards, since we want to keep supporting 
building against older SDKs and thus Driver-Versions.
There are a few examples in nvenc.h already, like 
NVENC_HAVE_HEVC_BFRAME_REF_MODE.
It should be done in the same fashion for this feature.

Second, in what way is this different from the existing global 
option(avctx->refs), which nvenc.c already uses to set 
h264->maxNumRefFrames and hevc->maxNumRefFramesInDPB?
The refs option is documented as "number of reference frames", which 
seems fitting for this. Can that option just be re-used to also set this 
new parameter, if it's available, or are they doing different things?



More information about the ffmpeg-devel mailing list