diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 070ff5f244..7e9c00f51d 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -1433,7 +1433,7 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx) ctx->output_order = - ctx->output_delay - 1; // Currently we never generate I frames, only IDR. - ctx->p_per_i = ((avctx->gop_size + avctx->max_b_frames) / + ctx->p_per_i = ((avctx->gop_size - 1 + avctx->max_b_frames) / (avctx->max_b_frames + 1)); ctx->b_per_p = avctx->max_b_frames;