[FFmpeg-devel] [PATCH v3 1/3] avcodec/v4l2_m2m_enc: Enable frame level rate control by default

Mark Thompson sw at jkqxz.net
Sun Feb 16 22:27:16 EET 2020


On 16/02/2020 19:31, Andriy Gelman wrote:
> From: Andriy Gelman <andriy.gelman at gmail.com>
> 
> Without this setting, bitrate and qmin/qmax options have no
> affect on the s5p-mfc hardware encoder.
> 
> Signed-off-by: Andriy Gelman <andriy.gelman at gmail.com>
> ---
>  libavcodec/v4l2_m2m_enc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
> index 98b9dfc2c0b..94373b3b6e7 100644
> --- a/libavcodec/v4l2_m2m_enc.c
> +++ b/libavcodec/v4l2_m2m_enc.c
> @@ -177,6 +177,7 @@ static int v4l2_prepare_encoder(V4L2m2mContext *s)
>      /* set ext ctrls */
>      v4l2_set_ext_ctrl(s, MPEG_CID(HEADER_MODE), MPEG_VIDEO(HEADER_MODE_SEPARATE), "header mode");
>      v4l2_set_ext_ctrl(s, MPEG_CID(BITRATE) , avctx->bit_rate, "bit rate");
> +    v4l2_set_ext_ctrl(s, MPEG_CID(FRAME_RC_ENABLE), 1, "frame level rate control");
>      v4l2_set_ext_ctrl(s, MPEG_CID(GOP_SIZE), avctx->gop_size,"gop size");
>  
>      av_log(avctx, AV_LOG_DEBUG,
> 

Can you check the behaviour with other drivers here?

If they do use the bitrate option even when this was not set (presumably at least one does, because that must have been tested somewhere) then they probably aren't supported, and it looks like the user will get an unhelpful error from trying to send this option to a driver which doesn't support it.  (A trivial grep suggests that only s5p-mfc and mtk-vcodec support it, but I might be missing something.)

Thanks,

- Mark


More information about the ffmpeg-devel mailing list