Log in

View Full Version : Questions about compressibility


evade
22nd March 2004, 17:17
What is the best way to get a ballpark compressiblity with XviD and mencoder?

I generally use XviD options like this on a two-pass encode:

v4mv:turbo=1:trellis:chroma_me:vhq=4:autoaspect

Should I use the bitrate produced in the first pass to calculate the bpp and use a percentage of that?

However, I know that XviD turns off some of its quality enhancingfeatures to speed up the first pass so is it perhaps more accurate todoa partial fixed_quant=2 with these options calculate the bpp and usesome percentage of that?

Is 60% of this bpp a good value?


Also has anyone done or seen any recent comparisons between XviD and Libavcodec?

frodoontop
23rd March 2004, 08:53
It makes no sense to encode first pass with fixed_quant=2, because filesize is only little different than a fast pass. Xvid will automatically make a correction for this in 2nd pass.

Use Turbo only if encoding time is a issue, it will give slightly lower quality. 2 B-frames boost quality also, but they're already default nowadays.

Don't know if sixty percent is enough for you. I usually aim for 80-90 percent. But then again: I hate macro-blocks. You might like a higher resolution for instance.

echo
23rd March 2004, 19:21
I've been thinking on how to do proper compressibility tests with mplayer as well. In order to do it the way I am used to in windows you have to select a random 5% of the video encoded at fixed quant 2. I thought that maybe a simple and efficient way is to take the first 3 seconds of every minute. So if you do something like this:

mencoder -ss 60 -endpos 3 -xvidopts fixed_quant=2:_other_options_
mencoder -ss 120 -endpos 3 -xvidopts fixed_quant=2:_other_options_
mencoder -ss 180 -endpos 3 -xvidopts fixed_quant=2:_other_options_
mencoder -ss 240 -endpos 3 -xvidopts fixed_quant=2:_other_options_
...
and so on until the end of the video, you will get several small 3second files. Now you can get each files bitrate from the video itself or capture it from the mencoder messages and calculate its average bitrate. Once you get that you can go to 60% of that and you have a nice compressibility test for the selected output video size. Ofcourse it becomes a little bit tiresome since you have to make about 90 small encodes for a 1,5 hour movie.

I know very little about linux scripting so if someone could recomment a script that does exactly this and calculates the average bitrate automatically it would be very helpful. Ofcourse once you get the target bitrate you can do a normal 1st pass the way you like it including turbo option or whatever... I hope I helped... :)

regards
echo

evade
23rd March 2004, 22:08
Thanks for the advice, I will have more to say later.


@echo

The following script this shoud do what you want it to do.
execute it like this:
./comptest.sh dvd://1 7200 "-vf crop=704:464:0:0"




EDIT:

My Script didn't work, limitations of bash scalar variables, Iv'e rewritten it in perl and am testing it now, I will post it soon.

sorry

evade
24th March 2004, 05:32
As Promised here is a perl script to do a comptest. Adjust the xvidencopts as you see fit.
I've already noticed changing options significantly changes the bitrate produced.

This script is smarter than the last and can tell when the movie has ended. You only need to supply one argument, the last portion of your mencoder command line. Run it like this:

./comptest.pl "-vf crop=720:352:0:60 stream.dump"

or

./comptest.pl "-vf crop=720:352:0:60,scale=640:480,hqdn3d dvd://1"

If you want it you can download it here:

http://69.13.241.21/comptest.pl

echo
24th March 2004, 19:56
Thanks evade! That's exactly what I was looking for to make my life easier! :) I will test it as soon as I get to my linux box, but it seems to do everything correctly. I think its time to move entirely to linux now... ;)

regards
echo