Next Previous Contents

4. Making a divx

It should be noted before we begin that the DVD ripping and transcoding guide with Linux as well as the mplayer user manual already do a fairly good job of explaining the DVD to divx conversion process. Most of this section is simply a distilled version of the information provided from these sources.

4.1 Ripping the DVD

You should use tccat, which is part of the transcode package. Use it like this:

tccat -i /dev/dvd -T A,B-C,D > filename.vob

4.2 Encoding the audio

The only tricky part about audio encoding is that, if your DVD has multiple language tracks, you need to decide which language track you want to encode the audio from. The choice of audio track is controlled by the -aid option in mplayer. Do not use the -alang option in mplayer; in my experience this option is buggy.

The first audio track in your .vob file has -aid 128; the second, -aid 129, and so on. To encode the audio from the first audio track, do

rm frameno.avi
mencoder -ovc frameno -o frameno.avi -oac mp3lame -lameopts abr:br=128 -aid 128 filename.vob

If you want to use a lower or higher bitrate for the audio, adjust the br=128 option to suit your tastes. Do not change the frameno.avi output filename; the video encoding portion of mencoder relies on this hard-coded filename.

Ripping the audio for timing purposes

You can easily use mplayer to extract a .wav file of any audio track contained in the .vob file. For example, to copy audio track #1 to a .wav file, run

mplayer -vo null -nogui -aid 128 -ao pcm -aofile audio.wav filename.vob

If you want to use this .wav file to time the dialogue in Sub Station Alpha, you have to convert it to mono, 44100 Hz sample rate, and 8 bit precision:

sox audio.wav -r 44100 -c 1 -b audio2.wav
You can then load the audio2.wav file into Sub Station Alpha and time from it, with digitally guaranteed accurate timings. What a deal.

4.3 Encoding the video

After the audio encoding process finishes, mencoder will print a list of recommended video bitrates to use for fitting the finished product onto CDs of various sizes. You can use one of the recommended bitrates, or you can choose a different bitrate if your goal is not to burn the result to a CD.

To perform the video encoding, run

mencoder -sub script.mpsub -ffactor 1 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=NNNN:vhq:vpass=1 -npp ci -o output.avi
mencoder -sub script.mpsub -ffactor 1 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=NNNN:vhq:vpass=2 -npp ci -o output.avi

Explanation of the options:

4.4 Playing back the video

An .avi file, unfortunately, does not have any aspect ratio information stored within the file. The lack of aspect ratio information causes problems when playing back "anamorphic" videos, which are designed to play back at a resolution different from the resolution that is actually used to store them on disc. If your original source DVD was anamorphic (and most film-source material is), then you have to explicitly tell your divx player what the right aspect ratio is at playback time. For example, with mplayer:

mplayer -aspect 16:9 output.avi

For playback on Windows, you will have to download the DivX 5.0 freeware player application at When playing back the divx files on windows, you must use the standalone DivX Player 2.0 application itself. Playing back the file in Windows Media Player, in my experience, does not work, even if you have the DivX codec installed.

Next Previous Contents