<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Ripping DVDs to Divx with mencoder (mplayer)</title>
<meta http-equiv="content-type"
content="text/html; charset=ISO-8859-1">
</head>
<body>
<pre><font size="+3"><u><b>Ripping DVDs to Divx with mencoder (mplayer)</b></u></font> <br><br><font
color="#cc0000">by paranouei (paranouei@jazzfree.com)<br></font><br><br>We can do it in two ways, direct ripping to the .avi or doing "three pass encoding". The latter<br>method is explained in <a
href="http://www.bunkus.org/dvdripping4linux/single/index.html#transcoding_mplayer">http://www.bunkus.org/dvdripping4linux/single/index.html#transcoding_mplayer</a><br><br><br><br><font
size="+2"><u><b>Direct Ripping</b></u></font><br><br><br>1. play the DVD, calculate how long it last (including credits) in seconds, check if<br> the volume is too low (because we can turn it up with software). Also, if the image<br> looks strechted, maybe mplayer doesn't realize it's in 16:9 format, so we have to <br> explicitly indicate it (with -aspect 16:9), and the image will be all right (this<br> happened to me with "Crouching Tiger Hidden Dragon"). And don't forget to check<br> in which "title id" does the movie start, usually movies start in id 1, but sometimes<br> there are trailers and such so it starts in a different title id (i.e. Crouching <br> Tiger.. started in number 10) (mplayer -dvd 10).<br><br><br>2. calculate the rate to get the desired file size. Knowing how many seconds it lasts,<br> you can use my script dvd-ripping (it's at the end) to get the rate. For example, <br> if you want a file size below 700Mb, you have to calculate the best rate you can<br> use to get a file under that size."Rate" is the movie quality in kbits/s. <br><br><br>3. if the movie has black borders you can take them off. First, calculate the borders geometry<br> whith option cropdetect:<br><br> mencoder -aspect 16:9 -dvd 10 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=694 -vop cropdetect,scale -zoom -xy 640 -oac mp3lame -lameopts br=128:vol=9 -o tigreydragon.avi<br><br> let it run for a while to make sure is ripping the real movie (and not just the credits)<br> and you'll get the values you have to pass to crop option to take the black borders off<br> (i.e. in Crouching Tiger.. I get crop=640:272:0:44). Keep in mind these values are relative<br> to the output resolution.<br><br><br>4. run mencoder with your parameters. Here are some parameters I used:<br> vol=9 in -lameopts (this is because the volume was too low, so i gave it<br> some gain. Valid values are between 1 and 10).<br> -aspect 16:9 (this is because mplayer didn't realize this was the original format<br> so i was getting a stretched image).<br> vbitrate=694 in -lavcopts (video rate i got with my script dvd-ripping)<br> -dvd 10 it's the title id where the movie starts (usually is number 1)<br> crop=640:272:0:44 in -vop (to take the black borders off)<br><br> So the full command is<br><br> mencoder -aspect 16:9 -dvd 10 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=694 -vop crop=640:272:0:44,scale -zoom -xy 640 -oac mp3lame -lameopts br=128:vol=9 -o tigreydragon.avi<br><br><br><br>This will rip the movie directly from the DVD to the Divx avi file in only one pass. I<br>recommend that at the same time you are ripping, play with mplayer the .avi in a <br>different terminal to check you are getting the desired format (resolution, quality,<br>volume...)<br><br><br><br><font
size="+2"><b><u>Three pass encoding</u></b></font><br><br><br>This method is explained in http://www.bunkus.org/dvdripping4linux/single/index.html.<br>Anyway his method use the *.vob files in the hard drive, and you can make it directly<br>from the DVD with this method:<br><br>1. First the sound:<br><br> mencoder -dvd 1 -ovc frameno -o frameno.avi -oac mp3lame -lameopts abr:br=128<br><br><br>2. First pass:<br><br> mencoder -dvd 1 -nosound -oac copy -o /dev/null -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=800:vhq:vpass=1:vqmin=1:vqmax=31 -vop scale -zoom -xy 640 -npp lb<br><br><br>3. Second pass:<br><br> mencoder -dvd 1 -oac copy -o file.avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=800:vhq:vpass=2:vqmin=1:vqmax=31 -vop scale -zoom -xy 640 -npp lb<br><br><br><br><font
size="+2"><b><u>Script dvd-ripping:</u></b></font><br><br><br>#!/bin/bash<br><br>if [ $# != 1 ] ; then<br> echo "Use: dvd-ripping <movie size in seconds>"<br> echo ""<br> exit 1<br>fi<br><br># Biggest file size is 700mb, which is 716800kbytes but just in case we use a little smaller size<br>MAXSIZE=700000<br><br>SEGUNDOS=$1<br>MINUTOS=$(($SEGUNDOS/60))<br><br>#Audio rate is 128bits/s which is 16kbytes/s<br>AUDIOSIZE=$((16*$SEGUNDOS))<br>LIBRE=$(($MAXSIZE - $AUDIOSIZE))<br>RATE=$((($LIBRE*8) / $SEGUNDOS))<br><br><br>echo "Calculating rate for movie which lasts $MINUTOS minutes..."<br><br>echo "Estimated rate: $RATE"<br><br>FINALSIZE=$(( ($RATE * $SEGUNDOS)/8 + $AUDIOSIZE))<br><br>echo "Estimated size: $FINALSIZE"<br><br>echo "The command is:"<br>echo "mencoder -dvd 1 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=$RATE -vop scale -zoom -xy 640 -oac mp3lame -lameopts br=128 -o file.avi"<br><br></pre>
<br>
<br>
</body>
</html>