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.
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
where
A
is the title that you want to ripB
is the chapter that you want to start fromC
is the chapter that you want to end withD
is the angle that you want (typically, 1)filename.vob
is the file where you want the ripped output to goThe 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.
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.
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:
-sub script.mpsub
specifies the filename of the script
containing your subtitles. Omit if you are not adding any subtitles.-ffactor 1
controls the darkness of the black borders that
are used to outline the subtitles. See the mencoder
man page for
further information. If you're not adding subtitles, omit this as well.vbitrate=NNNN
is the bitrate that you want to encode
at. Replace NNNN
with the actual number that you want to use, in
kbits/sec.-npp ci
tells mencoder
to deinterlace the video, which
is a good thing to do for divx files. See
Myths about DeInterlacing for more
information.-o output.avi
is the filename that you want the output to
land in.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 http://www.divx.com/divx/. 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.