Linux DVD Ripping Guide
In this article it's assumed you have the following installed:
- Mencoder / Mplayer: You can find RPM's on the Mplayer home page or try the GreySector
- Codecs Packages: Available from the Mplayer home page, see also the GreySector
- Divx Codec: The DivX4 and DivX5 codecs of Project Mayo. See also the Mecoder Doc's, FFmpeg is recommended.
- Remember that the Codec used to encode doesn't mean that Codec is necessary to decode it. Divx6 for linux is now in beta! Divx is merely an Mpeg4 codec, and compatible with the mpeg4 standard.
- Our old Linux DVD Ripping Guide has some extra examples and notes, this page will contain them all very soon
Encoding examples and definitions
In this section were teaching by example
The two pass method: With the first pass mencoder encodes the video as best it can as fast as it can, with relation to the settings you choose for it's encoding. Selecting a higher bitrate will increase the time it takes to encode and typically yield a higher quality rip. There are other encoding options that can affect speed and quaility, this guide is a brief overview of settings available. The rips made using these settings we consider to be very good quality, however there is also room for improvment.
When mencoder makes it's first pass, it create the "divx2pass.log" file. This file contains information that mencoder will use on the next pass to help it increase the quality of the rip. Motion, fire, rain, fog, water etc... are the hardest parts to encode, as one would suspect, so the divx2pass.log file contains info that helps on the next pass(s). You can do more than 2 pass's if you'd like, your ultimately confined by the bitrate you choose, and typically 2 pass's are all it takes to get the most out of the chosen bitrate. When the second pass is in progress the divx2pass.log file is again updated, and a 3rd, 4th etc.. pass does the same. There is no need to specify "4" or "5" for these passes, just re-rip with vpass=3 each time. Increasing the bitrate also increases the size of the file, naturally.
Examples, and explainations
mencoder dvd://1 -ofps 23.976 -ovc lavc -lavcopts vcodec=mpeg4:v4mv:mbd=2:trell:vbitrate=900:vpass=1:turbo=1 -oac copy -o /dev/null
- mencoder dvd://1 This tells mencoder to play track 1 of the dvd
- -ofps 23.976 This is specifing the typical NTSC DVD framerate. Read sections 8.2.x for more details on NTSC, interlaced and telecine
- -ovc lavc This is saying we are going to use the libavcodec family as our "output video codec, ovc"
- -lavcopts vcodec=mpeg4:v4mv:mbd=2:trell This is telling mencoder, that the libavcodec options are, use mpeg4 (aka Divx5) as our encoding codec, use the 4 motion vectors (per macroblock) option, use the highest setting of the Macroblock decision algorithm (mbd), also use Trellis quantization during the encoding process.
- :vbitrate=900:vpass=1:turbo=1 This means our bit rate is 900, this is the first video pass, and "turbo" is enabled, turbo only works on the first pass, rather when used with vpass=1
- -oac copy -o /dev/null This tell mencoder that the output audio codec (oac) is an exact copy of the audio stream, -o = output file name, and outputting to /dev/null is the "bit bucket" nothingness.
The second pass
mencoder dvd://1 -ofps 23.976 -ovc lavc -lavcopts vcodec=mpeg4:v4mv:mbd=2:trell:vbitrate=900:vpass=2 -oac mp3lame -lameopts vbr=3 -o Something-About-Mary.avi
- Almost everything is the same
- vpass=2 this time as it's the second pass
- -oac mp3lame -lameopts vbr=3 The output audio codec is mp3lame, it's options are variable bitrate equals 3 (bitrate is 128 with this setting)
- -o Something-About-Mary.avi is the output file name
Interlaced DVD's, Tv Series, Catoons and other Animation
mencoder dvd://1 -vf pp=md -ovc lavc -lavcopts vcodec=mpeg4:v4mv:mbd=2:trell:vbitrate=900:vpass=1:turbo=1 -oac mp3lame -lameopts vbr=3 -o Invader-Zim.avi
- -vf pp=md video filter is pp=md (post-processing median deinterlacer)
- -oac mp3lame -lameopts vbr=3 -o Invader-Zim.avi With this cartoon series, the deinterlacing filter does a fine job of creating a good quality rip on the first pass. Most cartoons tend to have solid colors, more stationary objects/backgrounds etc... that make it less difficult for mencoder to process the data. The first pass doesn't have to go to /dev/null, you can overwrite the file by using the same name on the next pass, or renaming the output file, and then maybe compare a first pass to a second/third pass.
- For higher quality rips consult the man pages for Mplayer/mencoder and the online Docs here: MplayerHQ