[FFmpeg-devel] [PATCH 2/2] lavf/vaapi_encode: fix to set the default max bitrate for AVC VBR
Mark Thompson
sw at jkqxz.net
Mon Mar 12 14:54:02 EET 2018
On 12/03/18 05:38, Pengfei Qu wrote:
> And for VBR mode, generally the max bit rate is bigger than the taraget
> bitrate. For CBR mode, the max bitrate is same as the target bitrate.
> when there is no specfic setting for the max bit rate parameter,
> here the default value 95% is used to caculate the default max bitrate accordingly.
>
> Signed-off-by: Pengfei Qu <Pengfei.Qu at intel.com>
> ---
> libavcodec/vaapi_encode.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> index 78347d4..47110cf 100644
> --- a/libavcodec/vaapi_encode.c
> +++ b/libavcodec/vaapi_encode.c
> @@ -1164,8 +1164,8 @@ static av_cold int vaapi_encode_init_rate_control(AVCodecContext *avctx)
> } else {
> if (avctx->rc_max_rate < avctx->bit_rate) {
> // Max rate is unset or invalid, just use the normal bitrate.
> - rc_bits_per_second = avctx->bit_rate;
> - rc_target_percentage = 100;
> + rc_target_percentage = 95;
> + rc_bits_per_second = (unsigned long)(avctx->bit_rate * 100.0 / rc_target_percentage);
> } else {
> rc_bits_per_second = avctx->rc_max_rate;
> rc_target_percentage = (unsigned long)(avctx->bit_rate * 100) / rc_bits_per_second;
>
Can you give more detail about the motivation for this change?
In particular:
* You say you are fixing something - what is the issue?
* Where has the 95% number come from?
* Do you want this to apply to all codecs? (The commit message says AVC.)
- Mark
More information about the ffmpeg-devel
mailing list