Encode a DVD to MPEG4 from the Command Line

Use mencoder 2-pass encoding to encode VOB files to MPEG4 .avi files (and other formats), all from the command line.

If you travel with a laptop over long distances, you might decide to take some DVDs along with you to pass the time. Of course, optical drives require a lot of power, and on some laptops you might not have enough power to get through an entire movie. However, if you rip and then encode the movie to a smaller format ahead of time, you can store a number of movies on your laptop and watch them directly from the hard drive, which saves a considerable amount of battery life, because you don’t need to spin the DVD. This hack talks about how to encode a DVD to an MPEG4 (also known as “DivX”) .avi file from the command line. This hack assumes that you have already ripped the DVD to your hard drive, as explained in [Hack #59] .

There are a few DVD-encoding command-line tools available to Linux users, but one of the simpler methods involves 2-pass encoding with mencoder, part of the MPlayer project. If you don’t have mencoder installed yet, follow the installation instructions in “Use MPlayer” [Hack #48] and be sure to grab mencoder packages along with your MPlayer packages. mencoder’s 2-pass encoding actually processes the video twice using information gained in the first pass to create a final video with much better image quality in the second pass for about the same file size.

I provide several encoding scenarios in this hack, ...

Get Linux Multimedia Hacks now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.