[Ffmpeg-devel] xvid ratecontrol tests

Corey Hickey bugfood-ml
Sat Mar 18 03:18:42 CET 2006


Corey Hickey wrote:
> I tested xvid ratecontrol on The Matrix with my current set of "best"
> encoding parameters:
> 
> for i in 1:turbo:vb_strategy=2 2 ; do
>   time mencoder ~/dumpstream/matrix.vob -nosound -vf \
>   crop=718:356:0:60,scale=640:272 -sws 9 -ovc lavc -lavcopts \
> vcodec=mpeg4:vbitrate=581:psnr:vpass="$i":mbd=2:mv0:trell:cbp:precmp=2:\
> cmp=2:subcmp=2:predia=2:dia=2:preme=2:vme=5:v4mv:last_pred=2:\
> vmax_b_frames=2:qpel:sc_factor=6:vqcomp=0.6 -ofps 24000/1001 -o test.avi
> done
> 
> Despite fairly reasonable PSNR values, the xvid ratecontrol videos look
> pretty bad. I don't know what is wrong, and I intend to test a reduced
> set of options to see if the problem stems from B-frames or something.
> Meanwhile, though, here's what I have.

Yes, it is a problem with B-frames, at least when using vqscale=2 for
the first pass. With xvid ratecontrol, that combination is making the
chosen QP values messed up. With a more reduced command line:

for i in 1:vb_strategy=2:vqscale=2 2:vrc_strategy=1 ; do
  mencoder ~/dumpstream/matrix.vob -nosound -vf \
  crop=718:356:0:60,scale=640:272 -sws 9 -ovc lavc -lavcopts \
  vcodec=mpeg4:vbitrate=581:psnr:vpass="$i" -ofps 24000/1001 -o test.avi
done

...I get this:

Video stream:  580.742 kbit/s  (72592 B/s)  size: 593646054 bytes
8177.753 secs  196070 frames
PSNR: Y:40.77, Cb:44.27, Cr:44.87, All:41.71


...and an xvid-ish QP histogram (few low quantizers, no high ones):

 1 :      0
 2 :   1266   =
 3 :  17621   =================
 4 :  68256
====================================================================
 5 :  80159
================================================================================
 6 :  25528   =========================
 7 :   3237   ===




Adding vmax_b_frames=2 changes the results to these:

Video stream: 1349.490 kbit/s  (168686 B/s)  size: 1379474982 bytes
8177.753 secs  196070 frames
PSNR: Y:43.14, Cb:46.22, Cr:47.27, All:44.04

qp   frames   histogram; each '=' is 1000 frames
 1 :      0
 2 : 130783
==================================================================================================================================
 3 :     31
 4 :     34
 5 :    181
 6 :  24523   ========================
 7 :  40515   ========================================



The quantizer range is the same, but the distribution is messed up.
Also, the bitrate is way off.


I had a look at two encodes without B-frames: one with xvid ratecontrol
(and vqscale=2 for the first pass) and one with lavc ratecontrol. Since
neither of them had any high-quality options enabled, they both looked
bad; the xvid-rc encode did look like it had xvid's ratecontrol, though:
a little worse in low-motion scenes, and much better in high-motion scenes.

Other than the B-frames (so far), xvid ratecontrol appears to be working
right, and I think it's promising. With B-frames and other high-quality
options, the differences in low motion scenes should be all but eliminated.

-Corey





More information about the ffmpeg-devel mailing list