DivX4 encoding in Linux (by Roland Seuhs)

Warning: Please note that you are only allowed to use this guide according to fair-use laws which vary from country to country. You are not allowed to redistribute copyrighted material. Also note that you have to use this guide and all software mentioned at your own risk.

You will need the following software for this guide:

Win32 DLLs
DivX 4 codec for Linux
transcode
Usability Perl scripts written by Roland Seuhs

1: Installation

Download all above files.
install the Win32 binaries:
Copy the contents of the .tgz file to /usr/lib/win32/ or run: "`cd /usr/lib; tar xvzf /path/to/binaries-011002.tgz`"

Install the DivX4 Codec:
Unzip the .tgz file and run "`sh install.sh`" as root

Install transcode:
Get the latest version of transcode and install as usual: `./configure; make; su -c "make install"`

Install Perl scripts:
Copy the scripts to a location in your $PATH, preferrably /usr/local/bin.

Notes:
This guide is only about DivX4 encoding, because it yields the best results in my opinion. Of course you can also encode DivX ;-) files, on the transcode homepage can be found some instructions for that. Currently this guide also does not cope with decrypting DVDs, yet. This will be added in the future.

Limitations:

transcode currently does not encode NTSC-vobs.

2: Decrypt the DVD

This chapter will be added later

3: Encode

3a:The easy way:
Type "`vob2divx4.pl /path/to/vobs/ 700`"
vob2divx will create a temporary directory "tmp" in the working directory in which all temporary files will be stored. A couple of hours later, a "movie.avi" file is created. The second parameter is the desired file size in megabytes.
This script will do:

- Do everything in small steps, you can interrupt the script anytime. To continue, just run "`vob2divx4.pl`" in the same directory again, it won't start from the beginning.
- Crop 64 pixels from top and bottom
- Crop 8 pixels from left and right
- Perform an audio rescale, so that all movies will have the same volume
- Do 2-pass encoding for better quality and smaller filesize. Almost all movies should fit on a single CD with adequate quality.
- Do everything at nice level 10, so you won't even notice it

This should get you an acceptable result for most movies. On IDE-systems, the system will slow down a bit at the beginning because the vobs are piped into a helper program to get the exact bitrate and audio rescale. After that the system should behave normally since the encoding itself is not very disk-intensive.

3b: For even better results:
Type "`vob2divx4.pl /path/to/vobs/ sample`"
This is will create small low-quality samples from the middle of the movie. (Taking all the samples takes about 10 to 30 minutes) Attention: This is just for boundary-cropping, resizing and audio (see below). It is ultra-low quality for faster speed, the end result will look much, much better!
When you have found the sample you like best, just type in:
"`vob2divx4.pl 700 <tmp/sample.avi>`" where <tmp/sample.avi> is the name of the sample - the corresponding movie will be created automatically.
To encode another audio-stream, just add the correct audio sample to your command: "`vob2divx4.pl 700 <tmp/sample.avi> <tmp/audio.avi>`"

4: Clean up
If you are satisfied with the result, just delete the tmp directory.
If you want to cut out the credits at the end of the movie, or want to create multiple avis for that movie, go to the tmp directory, and use avimerge to merge the avis in the tmp directory in the way you want. Those are 20 second-chunks, so it's not for professional cutting, but for cutting out credits it works great.