[MEncoder-users] High quality encoding of anime and broken mencoder options
Jorge Peixoto de Morais Neto
please.no.spam.here at gmail.com
Thu Mar 6 21:51:24 CET 2008
> >>>> Hi. I seek high quality encoding of anime. I have tested
> >>>> many encoding options, always with vcodec=mpeg4 and 2-pass encoding.
> >>>> I have found that even with vbitrate, the actual bitrate depends on
> >>>> the options used. Therefore, to keep the comparison fair, I have
> >>>> measured encoding quality by Q=PSNR/bitrate, with bitrate in Mbits/s.
> >>>
> >>> I believe that your Q value is not relevant: why PSNR/bitrate rather than
> >>> PSNR²/bitrate or PSNR/bitrate², or PSNR/log(bitrate) or... PSNR itself is a
> >>> logarithm of mean square error, there is no reason that a simple division
> >>> should be the relevant measure.
> PSNR/bitrate is wrong because a _factor_ of X in bitrate corresponds to a
> _difference_ of Y in PSNR, for some content- and codec-dependent values of
> X and Y. And you don't need theory to prove this, just encode something at
> multiple bitrates.
I have tested this and it seems to be true. Thank you for this
information. It suggests that the PSNR is a linear function of
log(bitrate). I have tested this theory for three sets of encoding
options. For each set, I encoded with bitrate 384, 512, 768 and 1024,
resulting in 4 points of the form (log(bitrate),PSNR). In all three
cases, the 4 points fitted very well on a straight line! Interesting.
Based on this, I have devised a better way of measuring "ecoding
quality". For each set of options, I encode with vbitrate=512 and
vbitrate=640. I then take the resulting PSNR and bitrate, take the log
of the bitrate, and interpolate to calculate what bitrate I would need
for my desired PSNR.
I am remaking my tests based on this.
So far, the best I have is (excluding certain settings that are too slow)
vcodec=mpeg4:psnr:keyint=300:vmax_b_frames=2:vb_strategy=2:brd_scale=2:mbd=2:trell:v4mv:last_pred=3:predia=3:dia=3:mbcmp=2:cbp:mv0:preme=2:vqcomp=0.6
vbitrate=512: bitrate=507.935, PSNR=36.44
vbitrate=640: bitrate=637.676, PSNR=37.83
bitrate for 36.4 PSNR would be 504.620867953
In my case, the mbcmp=2 option is helpful, but setting any other
comparison function to 2 only makes things worse. Weird.
--
Software is like sex: it is better when it is free. --Linus Torvalds
More information about the MEncoder-users
mailing list