Commit 1856162c authored by Michael Niedermayer's avatar Michael Niedermayer

mpegvideo enc: choose VBV buffer size for mpeg1/2 when none is specified instead of failing

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 33c4535d
......@@ -403,6 +403,18 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
s->loop_filter = !!(s->flags & CODEC_FLAG_LOOP_FILTER);
if (avctx->rc_max_rate && !avctx->rc_buffer_size) {
switch(avctx->codec_id) {
case AV_CODEC_ID_MPEG1VIDEO:
case AV_CODEC_ID_MPEG2VIDEO:
avctx->rc_buffer_size = FFMAX(avctx->rc_max_rate, 15000000) * 112L / 15000000 * 16384;
break;
}
if (avctx->rc_buffer_size) {
av_log(avctx, AV_LOG_INFO, "Automatically choosing VBV buffer size of %d kbyte\n", avctx->rc_buffer_size/8192);
}
}
if ((!avctx->rc_max_rate) != (!avctx->rc_buffer_size)) {
av_log(avctx, AV_LOG_ERROR, "Either both buffer size and max rate or neither must be specified\n");
if (avctx->rc_max_rate && !avctx->rc_buffer_size)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment