http://www.mplayerhq.hu/

A movie encoder for Linux (runs on many other Unices, and non-X86 CPUs, maybe even Windows1). Mencoder is bundled with the excellent MPlayer.

Mencoder is a simple yet powerful tool that is designed to encode video with DivX4, XviD, or any of the libavcodec2 codecs, and audio with PCM/MP3/VBRMP3 using 1, 2 or 3 passes. As one would expect, audio/video synchronisation is excellent, and it can use MPlayer's plugins (crop, flip, rotate, scale, etc.) as well!

Why should you care? Because it's so simple that even someone like me, who knows next to nothing about encoding, can use it and get great results. Here's the skinny on backing up a dvd (compare with How to Make a DivX Rip):

Step 1: Preparation

Insert the dvd (I'll be using a Matrix: Reloaded region 2 for this example). You now have a choice on whether to rescale the movie or not. Personally, I don't because MPEG4 allows you to encode the aspect ratio in the video stream and I'd rather not lose the quality. According to the docs, only MPlayer supports this attribute of MPEG4 but I've found that Xine plays them fine, too; better, in fact, because MPlayer doesn't seem to select the right aspect for me automagically but Xine does. As I said, I know next to nothing but it looks okay to me.
You will definitely want to crop the annoying borders, though. So, find the area with
$ gmplayer -dvd 1 -v -vop cropdetect
Let it seek around for a bit until you're happy with the values. You'll end up with something like -vop crop=720:428:0:74 in the console repeating over and over. Exit gmplayer.
Next, scroll up and find the line that looks like [open] audio stream: 0 audio format: ac3 (5.1) language: en aid: 128 (under DVD successfully opened.). This is the audio stream you want, the other one is German.

Step 2: Testing

First, you'll want to see if it plays correctly. So let's take a look at the burly brawl:
$ gmplayer -dvd 1 -vop crop=720:428:0:74 -aid 128 -chapter 14-14
Cropping is fine, Hugo Weaving isn't speaking German, no directors commentary.
Let's extract that chapter:
$ mencoder -dvd 1 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:aspect=2.4 -oac copy -o burly.avi -vop crop=720:428:0:74 -aid 128 -chapter 14-14
Keanu says, "Woah!"
-ovc is the video codec and -lavcopts vcodec=mpeg4:vpass=1:aspect=2.4 are the options passed to it. We're using the ffmpeg version of MPEG4. This is the first-pass. The aspect ratio is 2.4 (it's what it says on the case).
-oac copy means no encoding the audio stream at all (quicker but larger filesize). The other possible values are PCM and mp3lame.
-o burly.avi is the output filename.
Play it! If the test was a success, all that's left is to set it up to encode the whole movie.

Step 3: Encoding

mencoder -dvd 1 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:aspect=2.4 -oac copy -o burly.avi -vop crop=720:428:0:74 -aid 128 && mencoder -dvd 1 -ovc lavc -lavcopts vcodec=mpeg4:vpass=2:aspect=2.4 -oac copy -o burly.avi -vop crop=720:428:0:74 -aid 128

That's it, quick -- 80 minutes or so; xp2500+, 512mb -- and dirty -- look at the other options for -lavcopts, such as vhq, to improve quality -- two-pass encoding.
Lather, rinse, repeat.

As is patently obvious, I am not an encoding expert, but I felt that mencoder needed to be noded because it's just so darn good. I hope this whet your appetite.


1. From the documentation, MPlayer/mencoder is currently ported to the following platforms:

There's also a beta binary compiled for Win32. caveat utilitor. Of course the source code is available for download, too.

2. http://ffmpeg.sourceforge.net/ An open source codec package. Most notably it allows encoding to DivX3, DivX4, DivX5, and Windows Media Video 7/8.

Log in or register to write something here or to contact authors.