This article wants to cover some basic and advanced encoding using *mencoder* as the encoding engine. Basically all media [MPlayer](http://www.mplayerhq.hu/) can read is suitable for this howto.
# Source #
MPlayer knows of those sources (use these in substitution for SOURCE in below examples):
* file: uses a file as input
* URL: uses an URL as input (useful for streams)
* playlist: uses the given playlist as input
* -: uses stdin as input
* [dvd|dvdnav]://[title|[start_title]-end_title]: uses a DVD as input
* vcd://track[/device]: uses a VCD as input
* tv://[channel][/input_id]: uses some TV channel
* radio://[channel|frequency][/capture]: uses some radio channel
* pvr://: uses video-in of your TV card
* dvb://[card_number@]channel: uses DVB channel
* mf://[filemask|@listfile]: uses a list of jpg/png files
* [cdda|cddb]://track[-endtrack][:speed][/device]: uses audio CD
If you are unsure which source you want to use consult the man page:
# Copying #
If you just want to copy some SOURCE without changing its coding then this is what you need:
mencoder SOURCE -oac copy -ovc copy /tmp/MOVIE.avi
# Encoding #
Here is an example of encoding some SOURCE to DivX with Mp3 sound.
mencoder SOURCE -oac lavc -ovc lavc -lavcopts â†µ vcodec=divx:acodec=mp3:vbitrate=1800:abitrate=128 â†µ /tmp/MOVIE.avi
# Languages #
To select a specific language you need these parameters:
mencoder SOURCE OPTIONS -alang en -slang de /tmp/MOVIE.avi
# Crop and Scale #
Cropping cuts off parts of the visible movie screen. Scaling uses the input resolution and scales it to the given resolution. Scaling uses a lot of CPU and negatively effects not only encoding time but also quality.
mencoder SOURCE OPTIONS -vf crop=720:544:0:16,scale=720:576
MPlayer has a neat method to extract those values from the movie. Just run
mplayer SOURCE -vf cropdetect
and MPlayer will generate a lot of output. Let the movie play until these parameters don’t change anymore.
# Errors on Encoding #
From time to time you encounter a DVD you cannot encode. *mencoder* stops encoding and your DVD-drive makes a suspicious noice. This happens almost always at the beginning of the encoding process. Then you have two options to choose from:
* leave alone that DVD and don’t copy/rip it
* crop some seconds/minutes from the beginning
If your choise was number two – congratulations and welcome in my world. The first few seconds, eventually minutes, of every movie are the opening credits. If you’re not that much interested in this information then continue as follows.
mencoder -ss 40 SOURCE -ovc copy -oac copy -o /tmp/MOVIE.avi
The switch **-ss** tells mencoder to seek forward 40 seconds and start encoding at this position.
# See also #
* [HOWTO Mencoder Introduction Guide – Gentoo Linux Wiki](http://gentoo-wiki.com/HOWTO_Mencoder_Introduction_Guide)
I personaly don’t like mencoder that much. i think it is much overrated and there are better encoding tools out there
Cool, thanks for sharing!