--- The i965 driver has been updated so that this works consistently. libavcodec/vaapi_encode.c | 14 ++++++++++++++ libavcodec/vaapi_encode.h | 4 ++++ 2 files changed, 18 insertions(+)
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 246b76abc..953a6bae0 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -1090,6 +1090,7 @@ static av_cold int vaapi_encode_init_rate_control(AVCodecContext *avctx) VAAPIEncodeContext *ctx = avctx->priv_data; int hrd_buffer_size; int hrd_initial_buffer_fullness; + int num, den; if (avctx->rc_buffer_size) hrd_buffer_size = avctx->rc_buffer_size; @@ -1124,6 +1125,19 @@ static av_cold int vaapi_encode_init_rate_control(AVCodecContext *avctx) ctx->global_params_size[ctx->nb_global_params++] = sizeof(ctx->hrd_params); + if (avctx->framerate.num > 0 && avctx->framerate.den > 0) + av_reduce(&num, &den, avctx->framerate.num, avctx->framerate.den, 65535); + else + av_reduce(&num, &den, avctx->time_base.den, avctx->time_base.num, 65535); + + ctx->fr_params.misc.type = VAEncMiscParameterTypeFrameRate; + ctx->fr_params.fr.framerate = (unsigned int)den << 16 | num; + + ctx->global_params[ctx->nb_global_params] = + &ctx->fr_params.misc; + ctx->global_params_size[ctx->nb_global_params++] = + sizeof(ctx->fr_params); + return 0; } diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h index 2a72510b8..e7f36eaf5 100644 --- a/libavcodec/vaapi_encode.h +++ b/libavcodec/vaapi_encode.h @@ -154,6 +154,10 @@ typedef struct VAAPIEncodeContext { VAEncMiscParameterBuffer misc; VAEncMiscParameterHRD hrd; } hrd_params; + struct { + VAEncMiscParameterBuffer misc; + VAEncMiscParameterFrameRate fr; + } fr_params; // Per-sequence parameter structure (VAEncSequenceParameterBuffer*). void *codec_sequence_params; -- 2.11.0 _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel