[Ffmpeg-devel-old] Re: [Ffmpeg-devel] Some tweaks to better respect max bitrate
Sat Dec 24 09:56:01 CET 2005
Michael Niedermayer wrote:
> ok, i tried this patch, it lowers PSNR by 0.06 increases filesize and doesnt
> get rid of a single buffer underflow (12 before 12 after this patch)
> command line used
> ffmpeg -i ~/videos/xXx_DivX.avi -cmp 2 -subcmp 2 -mbd 2 -an -pass 2 -b 300 -maxrate 400 -bufsize 60 -psnr test2.avi
on typical SVCD type video it helped a bit, but without the "look in
the future" part it is not enough
to get rid of the underflows, because in case a large intra comes in, it
is too late to compensate.
The "look ahead" part is used in a slightly modified xvid ratecontrol
engine which glued to libavcodec
mpeg2 encoder works mostly (not 100 % perfect but much much better).
The algorythm is to do predictors for I/P/B frames, compute a "shrink
factor" compared to pass1
and project to the next half gop to see if we will run into trouble. If
so increase quant until the
projection is safe (+ some tweak to reserve more space for the 1st intra).
It is a bit like what i done in lavcodec , before doing the 2nd pass,
but it is done on the fly rather than
before doing the actual encoding.
The other way to do it would be, IMHO, to use a gop based ratecontrol in
addition to the global ratecontrol, but it would work for mpeg1/2,
probably not for mpeg4/...
Merry Christmas Eve :)
More information about the ffmpeg-devel