web
counter


DVD Ripping Guide --UPDATED!!

Mencoder, Mplayer, and FFMpeg are wonderful and powerful tools you can use to rip various forms of media into other codecs, sizes, lengths and forms. Below you will find several examples as well as brief explainations about each. I hope you enjoy the updated pages!



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 2pass.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 2pass.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, but that does not mean you increase the quality! If you exceed the bitrate the media was recorded in, you won't "C.S.I." "enhance" the data... :) If it's pixelated, it's pixelated, and you can't "Enhance!" that into more detail.

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-device d: dvd://1 This tells mencoder to play track 1 of the dvd (using the D: as the dvd-device)
  • -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-device d: 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 (you don't have to remove the "turbo=1", it's ignored on 2nd pass anyway)
  • 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

Other Formats: Flac to MP3 etc..

ffmpeg.exe -i input.flac -qscale:a 0 output.mp3

That is pretty interchangable for many formats... you can do that with M4A or M4P for example too:

ffmpeg.exe -i input.m4a -qscale:a 0 output.mp3

Mencoder Super HQ and Advanced Settings!

Encoding using a highquality H264 codec

Change input.mov to any souce you want, like dvd://1 for example, or input.vob
*NOTE: If you do not have a Quad processor, remove "threads=4:", or change to suit your CPU(s)

mencoder.exe" -passlogfile "c:\temp\2passlog" -ofps 29.970 -ovc x264 -x264encopts threads=4:subq=1:partitions=all:8x8dct:me=esa:frameref=1:bframes=3:b_pyramid=normal:weight_b:bitrate=500:pass=1:turbo -vf scale=720:368 -oac mp3lame -lameopts vbr=3 input.mov -o output.avi

mencoder.exe" -passlogfile "c:\temp\2passlog" -ofps 29.970 -ovc x264 -x264encopts threads=4:subq=6:partitions=all:8x8dct:me=esa:frameref=15:bframes=3:b_pyramid=normal:weight_b:bitrate=500:pass=3 -vf scale=720:368 -oac mp3lame -lameopts vbr=3 input.mov -o output.avi

mencoder.exe" -passlogfile "c:\temp\2passlog" -ofps 29.970 -ovc x264 -x264encopts threads=4:subq=6:partitions=all:8x8dct:me=esa:frameref=15:bframes=3:b_pyramid=normal:weight_b:bitrate=500:pass=3 -vf scale=720:368 -oac mp3lame -lameopts vbr=3 input.mov -o output.avi

Use FFMpeg to create a H264 encoded mkv:

ffmpeg -i input.vob -acodec libmp3lame -aq 4 -vcodec libx264 -crf 24 -threads 0 output.mkv

The above will take the input, encode the audio to quality 4 (-aq 4 aka 128k or greater), use the libx264 video codec, then use the Constant Rate Factor of 24 (good quality, slow encoding speed), and use the optimal amount of threads possible for that codec, this should increase the speed of the encoding more than most other settings. The output will be a Matroska (mkv) file, read the wikipedia entry for more details. You can just as easily use AVI (output.avi).

Dump a DVD track as a raw VOB file: (using mplayer)

mplayer dvd-device d: dvd://11 -dumpstream -dumpfile e:\MOVIES\movie.vob

Naturally change the dvd device and or track to the proper drive and track, and output drive/folders

Mencoder Highest Quality, with Medium Sized Output

mencoder.exe -passlogfile "c:\temp\2passlog" -oac mp3lame -lameopts vbr=3 -ovc xvid -xvidencopts bitrate=1400:me_quality=6:chroma_me=1:nointerlacing:max_bframes=1:noqpel:hq_ac:trellis:quant_type=mpeg:chroma_opt:bvhq=1:vhq=4:autoaspect:pass=1:turbo -aid 128 -ofps 23.976 c:\fotr.vob -o c:\fotr.avi

mencoder.exe -passlogfile "c:\temp\2passlog" -oac mp3lame -lameopts vbr=3 -ovc xvid -xvidencopts bitrate=1400:me_quality=6:chroma_me=1:nointerlacing:max_bframes=1:noqpel:hq_ac:trellis:quant_type=mpeg:chroma_opt:bvhq=1:vhq=4:autoaspect:pass=2 -aid 128 -ofps 23.976 c:\fort.vob -o c:\fotr.avi

mencoder.exe -passlogfile "c:\temp\2passlog" -oac mp3lame -lameopts vbr=3 -ovc xvid -xvidencopts bitrate=1400:me_quality=6:chroma_me=1:nointerlacing:max_bframes=1:noqpel:hq_ac:trellis:quant_type=mpeg:chroma_opt:bvhq=1:vhq=4:autoaspect:pass=2 -aid 128 -ofps 23.976 c:\fort.vob -o c:\fotr.avi

The last two lines are identical, you can keep repeating it to get some limited gains in some scenes, like with scenes that involve a lot of rain, fog or fire; but overall no clarity or further compression will be seen from more than 2 or 3 passes. Also I find that if I don't encode the audio, and I use "-oac copy" with some media, that the audio output is out of sync. So I always encode the audio out of habit. There may be ways to lessen those affects, but it works well this way.