X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fvaapi_encode_h265.c;h=971458db8759f5a3ebc0a26ee3083e1d2e978cb3;hb=2d025e742843ca3532bd49ebbfebeacd51337347;hp=cf6b9388d13c2fd21e841dc1f8a1859c8494d582;hpb=5b8a708492f84ab49bcf9f694c50ac87cbdcc21b;p=ffmpeg diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c index cf6b9388d13..971458db875 100644 --- a/libavcodec/vaapi_encode_h265.c +++ b/libavcodec/vaapi_encode_h265.c @@ -1185,13 +1185,15 @@ static av_cold int vaapi_encode_h265_configure(AVCodecContext *avctx) "%d / %d / %d for IDR- / P- / B-frames.\n", priv->fixed_qp_idr, priv->fixed_qp_p, priv->fixed_qp_b); - } else if (ctx->va_rc_mode == VA_RC_CBR) { + } else if (ctx->va_rc_mode == VA_RC_CBR || + ctx->va_rc_mode == VA_RC_VBR) { // These still need to be set for pic_init_qp/slice_qp_delta. priv->fixed_qp_idr = 30; priv->fixed_qp_p = 30; priv->fixed_qp_b = 30; - av_log(avctx, AV_LOG_DEBUG, "Using constant-bitrate = %"PRId64" bps.\n", + av_log(avctx, AV_LOG_DEBUG, "Using %s-bitrate = %"PRId64" bps.\n", + ctx->va_rc_mode == VA_RC_CBR ? "constant" : "variable", avctx->bit_rate); } else { @@ -1251,9 +1253,12 @@ static av_cold int vaapi_encode_h265_init(AVCodecContext *avctx) } ctx->va_entrypoint = VAEntrypointEncSlice; - if (avctx->bit_rate > 0) - ctx->va_rc_mode = VA_RC_CBR; - else + if (avctx->bit_rate > 0) { + if (avctx->rc_max_rate == avctx->bit_rate) + ctx->va_rc_mode = VA_RC_CBR; + else + ctx->va_rc_mode = VA_RC_VBR; + } else ctx->va_rc_mode = VA_RC_CQP; ctx->va_packed_headers =