psych-major
06-19-2007, 05:38 PM
*NOTE - This is intended to enable you to rip DVD's that you legally own into a format more suitable for portable viewing!
I travel frequently for work, and I like to take movies to watch on the plane. However, I also like to put the extra battery in the DVD drive bay of my laptop, and I don't have gobs of extra hard drive space, so I needed a simple tool to rip and encode movies to a really small file size.
I also use this tool to encode video for my wife's Palm Treo...
I have tried a number of apps including DVD::Rip, AcidRip, DeVeDe and shell scripts for mencoder and transcode. All have been marginally successful, but none is as easy as I need in order to do it at work while doing other things.
I found an app called HandBrake (http://handbrake.m0k.org/), which was originally developed for MacOS to rip DVD video for iPods. It is open source, and has been ported to Windows and Linux. The Linux version is cli only, and has all the necessary codecs compiled in, so it should just work! (it did on mine, but I already had my system pimped out with the various multimedia codecs like libdvdcss, ffmpeg, etc)
The following is how I use it in Ubuntu, adjust as needed for your distro.
For the Linux version, first download the cli executable (http://mirrors.m0k.org/handbrake/testing/HandBrakeCLI-0.8.5b1-Linux_i386.tar.gz).
Then cd into the directory where you downloaded it and unzip it:tar -xvzf HandBrakeCLI*.tar.gz
This will extract a single file called HandBrakeCLI.
I like to copy it to a directory in my path so I can run it from anywhere:sudo cp HandBrakeCLI /usr/local/bin
I'm also lazy, and I don't want to have to type capital letters every time I run it so:sudo ln -s /usr/local/bin/HandBrakeCLI /usr/local/bin/handbrake
Make sure it is executable:sudo chmod +x /usr/local/bin/handbrake
You are now ready to run handbrake!
To access the help, handbrake -h
To check for updates, handbrake -u
There is an excellent tutorial about usage here (http://handbrake.m0k.org/trac/wiki/CLIGuide), and below is how I am using it.
First for the Palm Treo...
This model has PalmOS, a 320x320 Hi-res color screen, and a 2GB Secure Digital card. I installed a viewer on it called TCPMP (http://picard.exceed.hu/tcpmp/test/) as well as the ffmpeg (http://picard.exceed.hu/tcpmp/test/ffmpeg.plugin.0.72RC1.zip) and aac (http://home.earthlink.net/~corey.maddocks/data/treo/tcpmp_aac_plugin.prc) plugins.
To encode video for the Treo or other similar mobile device, select a dvd and load it into the DVD drive on your Linux PC.
Run the command lsdvd to determine which track you need to rip.
Then rip and encode:handbrake -i /dev/dvd -t 1 -b 256 -w 320 -o ~/my-ripped-movie.mp4
(My laptop rips and encodes at a rate of about 85 frames per second, your mileage may vary...)
The above command does the following:
-i Defines the dvd drive as the input.
-t specifies track 1
-b sets the bitrate of the encoded video to 256. I find this to be a comfortable compromise between file size on the memory card and decent video on the Treo screen. You can alternatively use -S <number> and define a target size (in megabytes) for the resulting file and handbrake will calculate the bitrate for you.
-w sets the width of the video to 320. handbrake will automatically preserve the aspect ratio unless you specify both width and height. My setting results in a 320x240 video that has black bars on the top and bottom of the Treo screen, but it's close enuf.
Finally, -o sets the output file name and type, which in my case is an mp4 file in my home directory.
All other options are left at the default values.
A couple of notes: Handbrake supports encoding the audio in aac, mp3 or straight ac3 pass through. On my system, however, when I try the various sound options via the -E switch, I get either no sound, or aac sound. I'm not sure why, but I'm OK with aac encoded sound, so I just leave it as is. This is why I need the aac plugin for my PalmOS video player, however...
The default encoder is ffmpeg, but you can instead specify xvid or h264. ffmpeg encodes really fast, so that is my choice.
Also, if you're ripping a dvd with multiple videos on it, like a television series, you can either write a shell script to pipe the output of lsdvd into sequential handbrake calls, or you can string separate handbrake commands in the console separated by a ';'
For the laptop...
On the laptop, file size isn't as much of an issue, and I want full screen video in wide screen format.
First, for a player I use either mplayer or VLC, depending on my mood.
To get decent output, with reasonable file size, I use the following:handbrake -i /dev/dvd -t 1 -S 2000 -p -m -s 1 -o ~/my-ripped-movie.mp4
The above command does the following:
-i Defines the dvd drive as the input.
-t specifies track 1
-S sets the target size of the output file at 2GB, the bitrate is then automatically calculated.
-p sets the output to use anamorphic (http://handbrake.m0k.org/trac/wiki/AnamorphicGuide) encoding (for my wide-screen laptop!) ;)
-m includes the chapter markers in the encoded file
-s 1 includes the first subtitle (English) in the encoded file
Finally, -o sets the output file name and type, which in my case is an mp4 file in my home directory.
All other options are left at the default values.
This results in a movie file playable in VLC or mplayer that has decent graphics, chapter markers, subtitles and fits on my FAT partition that is shared by Windows XP on my dual-boot laptop.
Said laptop completes the ripping and encoding of a 2 hour 18 min movie in 40 minutes. (2Ghz core duo, 2GB RAM, 7200RPM SATA hard drive)
Happy encoding!
I travel frequently for work, and I like to take movies to watch on the plane. However, I also like to put the extra battery in the DVD drive bay of my laptop, and I don't have gobs of extra hard drive space, so I needed a simple tool to rip and encode movies to a really small file size.
I also use this tool to encode video for my wife's Palm Treo...
I have tried a number of apps including DVD::Rip, AcidRip, DeVeDe and shell scripts for mencoder and transcode. All have been marginally successful, but none is as easy as I need in order to do it at work while doing other things.
I found an app called HandBrake (http://handbrake.m0k.org/), which was originally developed for MacOS to rip DVD video for iPods. It is open source, and has been ported to Windows and Linux. The Linux version is cli only, and has all the necessary codecs compiled in, so it should just work! (it did on mine, but I already had my system pimped out with the various multimedia codecs like libdvdcss, ffmpeg, etc)
The following is how I use it in Ubuntu, adjust as needed for your distro.
For the Linux version, first download the cli executable (http://mirrors.m0k.org/handbrake/testing/HandBrakeCLI-0.8.5b1-Linux_i386.tar.gz).
Then cd into the directory where you downloaded it and unzip it:tar -xvzf HandBrakeCLI*.tar.gz
This will extract a single file called HandBrakeCLI.
I like to copy it to a directory in my path so I can run it from anywhere:sudo cp HandBrakeCLI /usr/local/bin
I'm also lazy, and I don't want to have to type capital letters every time I run it so:sudo ln -s /usr/local/bin/HandBrakeCLI /usr/local/bin/handbrake
Make sure it is executable:sudo chmod +x /usr/local/bin/handbrake
You are now ready to run handbrake!
To access the help, handbrake -h
To check for updates, handbrake -u
There is an excellent tutorial about usage here (http://handbrake.m0k.org/trac/wiki/CLIGuide), and below is how I am using it.
First for the Palm Treo...
This model has PalmOS, a 320x320 Hi-res color screen, and a 2GB Secure Digital card. I installed a viewer on it called TCPMP (http://picard.exceed.hu/tcpmp/test/) as well as the ffmpeg (http://picard.exceed.hu/tcpmp/test/ffmpeg.plugin.0.72RC1.zip) and aac (http://home.earthlink.net/~corey.maddocks/data/treo/tcpmp_aac_plugin.prc) plugins.
To encode video for the Treo or other similar mobile device, select a dvd and load it into the DVD drive on your Linux PC.
Run the command lsdvd to determine which track you need to rip.
Then rip and encode:handbrake -i /dev/dvd -t 1 -b 256 -w 320 -o ~/my-ripped-movie.mp4
(My laptop rips and encodes at a rate of about 85 frames per second, your mileage may vary...)
The above command does the following:
-i Defines the dvd drive as the input.
-t specifies track 1
-b sets the bitrate of the encoded video to 256. I find this to be a comfortable compromise between file size on the memory card and decent video on the Treo screen. You can alternatively use -S <number> and define a target size (in megabytes) for the resulting file and handbrake will calculate the bitrate for you.
-w sets the width of the video to 320. handbrake will automatically preserve the aspect ratio unless you specify both width and height. My setting results in a 320x240 video that has black bars on the top and bottom of the Treo screen, but it's close enuf.
Finally, -o sets the output file name and type, which in my case is an mp4 file in my home directory.
All other options are left at the default values.
A couple of notes: Handbrake supports encoding the audio in aac, mp3 or straight ac3 pass through. On my system, however, when I try the various sound options via the -E switch, I get either no sound, or aac sound. I'm not sure why, but I'm OK with aac encoded sound, so I just leave it as is. This is why I need the aac plugin for my PalmOS video player, however...
The default encoder is ffmpeg, but you can instead specify xvid or h264. ffmpeg encodes really fast, so that is my choice.
Also, if you're ripping a dvd with multiple videos on it, like a television series, you can either write a shell script to pipe the output of lsdvd into sequential handbrake calls, or you can string separate handbrake commands in the console separated by a ';'
For the laptop...
On the laptop, file size isn't as much of an issue, and I want full screen video in wide screen format.
First, for a player I use either mplayer or VLC, depending on my mood.
To get decent output, with reasonable file size, I use the following:handbrake -i /dev/dvd -t 1 -S 2000 -p -m -s 1 -o ~/my-ripped-movie.mp4
The above command does the following:
-i Defines the dvd drive as the input.
-t specifies track 1
-S sets the target size of the output file at 2GB, the bitrate is then automatically calculated.
-p sets the output to use anamorphic (http://handbrake.m0k.org/trac/wiki/AnamorphicGuide) encoding (for my wide-screen laptop!) ;)
-m includes the chapter markers in the encoded file
-s 1 includes the first subtitle (English) in the encoded file
Finally, -o sets the output file name and type, which in my case is an mp4 file in my home directory.
All other options are left at the default values.
This results in a movie file playable in VLC or mplayer that has decent graphics, chapter markers, subtitles and fits on my FAT partition that is shared by Windows XP on my dual-boot laptop.
Said laptop completes the ripping and encoding of a 2 hour 18 min movie in 40 minutes. (2Ghz core duo, 2GB RAM, 7200RPM SATA hard drive)
Happy encoding!