Posts Tagged mencoder

Converting my cellphone videos

I’ve got an LG ENV2 cell phone and it takes pretty decent videos (for a cell phone). The problem is that I’m stuck watching the finished videos on a tiny screen. If I play the videos I copy off the SD card onto my computer I don’t get any audio.

One solution is to upload the videos directly to YouTube:

YouTube does the conversion and maintains the audio in the resulting video.


But what if I don’t want to go through the trouble of uploading and waiting for the video to be converted? Linux to the rescue!

First of all, install ffmpeg and mencoder:
(actually, I’m not sure if you need ffmpeg or not. In my case it didn’t hurt anything.)

sudo apt-get install mencoder ffmpeg

Then copy the video(s) to your computer, open a terminal window and change to the directory in which you’ve copied the files.

Then run mencoder:

mencoder input_filename.3g2 -o output_filename.avi -oac mp3lame -ovc lavc
  • mp3lame is the used audio-codec (here mp3)
  • lavc is the used video-codec (here libavcodec)

After the conversion is complete you should have a playable (audio included!) .avi file in the same folder! Easy.

Here’s a video I just pulled off my phone and converted –
Happy Birthday Max!

Tags: , ,

Rip a DVD into a DivX with Mencoder on MisterHowto.com

Rip a DVD into a DivX with Mencoder

We’re going to use Mencoder and Mplayer to backup a DVD you own into a DivX file.

Find out which part and language we want

mplayer dvd://2

A DVD can have several “titles” (parts), and the actual movie is not always the first one. Replace “2″ in the command above with any number, beginning from 1, until you find the part you want. Keep that number in mind.

The language you want is not necessarily the default one either. Run this command:

mplayer -alang en dvd://2

Replace “2″ with the number you found earlier, and “en” (English) with a two-letter code for the language you want (fr for French, etc.).

Make the right crop

The DVD will probably have black borders at the top and bottom of the movie, and we don’t want them in our DivX (they would make the file pointlessly larger), so we need to crop them out. Run this command:

mplayer -ss 60 -vf cropdetect dvd://2

This will make Mplayer start playing the movie 60 seconds after the beginning (replace “2″ with the right title number). Navigate in the movie (Right and Left arrows) until you reach a sequence that is bright enough to let you clearly see the movie’s borders. Close the movie and look at what Mplayer has been outputting in the terminal: lots of lines like this one:

crop area: X: 0..719 Y: 72..503 (-vf crop=720:432:0:72)30.0% 33 0

The part between brackets is exactly what you’ll need to use in a few moments to get the right crop.

Encode!

We’re all set, let’s encode the movie. We’re going to do it in two passes (better quality).

mencoder -alang en dvd://2 -ovc xvid -xvidencopts pass=2:bitrate=-700000 -oac mp3lame -vf crop=720:432:0:72 -o Movie.avi

Of course, replace “en”, “2″ and the crop options with what you need. The “bitrate” value is usually set to how much disk space (in Kb) the video will use for each second. However, by using a negative value (here -700000) you can just ask for a (very) approximate file size (here about 700 M) and Mencoder will calculate the bitrate for you.

via Rip a DVD into a DivX with Mencoder on MisterHowto.com.

Tags: , , ,