Mencoder

mencoder (MPlayer's Movie Encoder) is a simple movie encoder. It encodes to MPEG-4 (DivX/XviD), one of the libavcodec codecs and  PCM/MP3/VBRMP3 audio in 1, 2 or 3 passes. Furthermore it has stream copying abilities, a powerful filter system (crop,  expand,  flip, postprocess, rotate, scale, noise, rgb/yuv conversion) and more.

From FreeBSD Handbook

= Using Mencoder = Before using mencoder it is a good idea to familiarize yourself with the options from the HTML documentation. There is a manual page, but it is not very useful without the HTML documentation. There are innumerable ways to improve quality, lower bitrate, and change formats, and some of these tricks may make the difference between good or bad performance. Here are a couple of examples:

To convert a .dv video stream you got e.g. from your Camcorder, you can issue: $ mencoder test.dv -o test.avi -vf pp=ci -oac lavc -ovc lavc

-oac is the output audio codec, -ovc is the output video codec, -vf pp=ci makes a cubic interpolation which is fine if your camcorder does interLeaving.

Improper combinations of command line options can yield output files that are unplayable even by mplayer. Thus, if you just want to rip to a file, stick to the -dumpfile in mplayer.

To convert input.avi to the MPEG4 codec with MPEG3 audio encoding (audio/lame is required): $ mencoder input.avi -oac mp3lame -lameopts br=192 \ -ovc lavc -lavcopts vcodec=mpeg4:vhq -o output.avi

This has produced output playable by mplayer and xine.

input.avi can be replaced with dvd://1 -dvd-device /dev/dvd and run as root to re-encode a DVD title directly.

Adding subtitles to a DivX file
To add iso-8859-1 encoded subtitles from mymovie.srt file to mymovie.avi : $ mencoder -sub mymovie.srt -ovc lavc -subcp iso-8859-1 -oac copy -o mymovie2.avi mymovie.avi

= See also =
 * Multimedia_and_Graphics_Access
 * mPLayer
 * video conversion
 * Xine

= External Links =
 * DVD to DivX Using mencoder: http://axljab.homelinux.org/Mencoder_DVD_to_DivX
 * MPlayer Homepage: http://www.mplayerhq.hu/
 * Installing MPlayer: http://www.mplayerhq.hu/DOCS/HTML/en/install.html
 * MPlayer Documentation: http://www.mplayerhq.hu/DOCS/HTML/en/index.html