From db4b09aad1b7094290d3c043549f7cb9144f0d18 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Fri, 28 Feb 2025 00:46:23 +0100 Subject: [PATCH 29/40] avcodec/mpegvideo_enc: Move vbv_delay warning to mpeg12enc.c It is MPEG-1/2 only. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12enc.c | 9 +++++++++ libavcodec/mpegvideo_enc.c | 11 ----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 90baf1ed95..3f23045afc 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -255,6 +255,15 @@ static av_cold int encode_init(AVCodecContext *avctx) } } + if (avctx->rc_max_rate && + avctx->rc_min_rate == avctx->rc_max_rate && + 90000LL * (avctx->rc_buffer_size - 1) > + avctx->rc_max_rate * 0xFFFFLL) { + av_log(avctx, AV_LOG_INFO, + "Warning vbv_delay will be set to 0xFFFF (=VBR) as the " + "specified vbv buffer is too large for the given bitrate!\n"); + } + if (mpeg12->drop_frame_timecode) mpeg12->tc.flags |= AV_TIMECODE_FLAG_DROPFRAME; if (mpeg12->drop_frame_timecode && mpeg12->frame_rate_index != 4) { diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index da9247ec25..cbfea534d9 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -588,17 +588,6 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) avctx->bit_rate_tolerance = INT_MAX; } - if (avctx->rc_max_rate && - avctx->rc_min_rate == avctx->rc_max_rate && - (s->codec_id == AV_CODEC_ID_MPEG1VIDEO || - s->codec_id == AV_CODEC_ID_MPEG2VIDEO) && - 90000LL * (avctx->rc_buffer_size - 1) > - avctx->rc_max_rate * 0xFFFFLL) { - av_log(avctx, AV_LOG_INFO, - "Warning vbv_delay will be set to 0xFFFF (=VBR) as the " - "specified vbv buffer is too large for the given bitrate!\n"); - } - if ((avctx->flags & AV_CODEC_FLAG_4MV) && s->codec_id != AV_CODEC_ID_MPEG4 && s->codec_id != AV_CODEC_ID_H263 && s->codec_id != AV_CODEC_ID_H263P && s->codec_id != AV_CODEC_ID_FLV1) { -- 2.45.2