Mencoder with xvid: video bitrate 1.25 times smaller

Did anyone try mencoder to try and convert a dvd to xvid?
It works fine, but there seems to be a bug, which I do not
know if it is openSUSE specific or is it caused by mencoder or xvid.

I don’t have the exact script right now, but it is a slightly modified version of the following two lines from Gentoo’s two pass encoding howto:

mencoder dvd:// -oac mp3lame -ovc xvid -xvidencopts pass=1 -o /dev/null
mencoder dvd:// -oac mp3lame -ovc xvid -xvidencopts pass=2:bitrate=1200 -o <filename.avi>

I’ve added cropping, scaling, and changed audio parameters, but that is irrelevant for the behaviour in question. The resulting video bit rate is exactly and consistently 1.25 smaller than the bitrate setting, regardless of what the bitrate setting is (1200 is just an example, I tried several numbers).

I guess I can see where the error is coming from, and it is probably related to bit to byte rate conversion, and a factor of 1/8 is somewhere applied incorrectly.

I’ve googled a bit, and I’ve seen some old reports where people were not able to go beyond a certain rate, but that was related to default minimal quantization level set in mencoder. That does not appear to be the case here.

Also, if I set the negative value to indicate the size, I see the same bitrat (and file size) reduction 1.25 factor (I have my own bitrate calculator).

This is fine by me, I can always set the bit rate to 1.25x desired value, but just wanted to share the experience, and see if somebody knows if this is a bug or something else.

Our user/member microchip has done this with his script “xvidenc”. xvidenc - the interactive shell script ripper

That script was recently picked up by the packman packagers, and is now included in the packman repositories.

Thanks, I will try it. I’ve looked at the screenshots and it seems like it has a lot of options that go beyond my level of expertise (I am a signal processing guy, but don’t know much abut video). Hopefully the defaults will be OK for most of the settings.

I use the defaults 99% of the time.

To start it I typically type:

xvidenc -2p -p uhq

Excellent, thank you for telling me how to start. I’ve tried it just now and it works. It did not have the 1.25 scaling, but from the options it created I cannot tell what made it work with the right bitrate.

I like the fact that cropdetect works well, and that it offers you to select your own scaling (e.g., crop = 704:448.x.y, you may decide to go with 624x336).

I also liked the -scan option.

What I did not like is the fact that even though I selected one chapter of a DVD only (for a quick test), the first pass kept on going and going, so I killed it, saved the options in a scriptfile (batchfile), and manually added -endpos 01:00. It works great.

Running a script is probably what I will end up doing anyway.

Thanks !

Read how to encode only one chapter of a DVD: xvidenc FAQ