summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-03-26 12:30:04 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-03-26 12:30:04 +0000
commitb73afeac3063c08691987e26bac338df530d359e (patch)
tree7d8db3e104bcc4bec8fa24d72b195430fc1acdc0
parentca20f118d179509f5783150ac8cc3eb9e6dd44ac (diff)
huge vbv buffer size + CBR fix
Originally committed as revision 2929 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/mpegvideo.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index a786f8ab75..07d16e8e69 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -885,8 +885,15 @@ int MPV_encode_init(AVCodecContext *avctx)
if(avctx->rc_min_rate && avctx->rc_max_rate != avctx->rc_min_rate){
av_log(avctx, AV_LOG_INFO, "Warning min_rate > 0 but min_rate != max_rate isnt recommanded!\n");
- }
+ }
+
+ if( s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate
+ && (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO)
+ && 90000LL * (avctx->rc_buffer_size-1) > s->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((s->flags & CODEC_FLAG_4MV) && s->codec_id != CODEC_ID_MPEG4
&& s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P && s->codec_id != CODEC_ID_FLV1){
av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n");
@@ -2115,7 +2122,8 @@ int MPV_encode_picture(AVCodecContext *avctx,
}
/* update mpeg1/2 vbv_delay for CBR */
- if(s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate && s->out_format == FMT_MPEG1){
+ if(s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate && s->out_format == FMT_MPEG1
+ && 90000LL * (avctx->rc_buffer_size-1) <= s->avctx->rc_max_rate*0xFFFFLL){
int vbv_delay;
assert(s->repeat_first_field==0);