diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 15af25d7b7..9b23671952 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1675,6 +1675,7 @@ static int rate_estimate_qscale(MpegEncContext *s) diff= s->total_bits - wanted_bits; br_compensation= (s->bit_rate_tolerance - diff)/s->bit_rate_tolerance; + if(br_compensation<=0.0) br_compensation=0.001; q/=br_compensation; qscale= (int)(q + 0.5);