Mencoder – my hero

I’m just starting to fully realize how truly amazing mencoder actually is. It’s helping me do things that I previously thought were impossible.

For example, I have a few avi files which were split to fit on multiple cds. Now every time in the past that I’ve tried to combine these I’ve seen disaster (problems with audio/video syncing) until I tried mencoder. (I’ve also posted some other commands I find useful)

To combine files:

mencoder -forceidx -ovc copy -oac copy -o output.avi input1.avi input2.avi

To encode subtitles into the video (the xvidencopts bitrate in this example is set to 400mb, you should change this to your desired file size and remember to leave in the minus sign before the number):

mencoder -ovc xvid -oac mp3lame -xvidencopts bitrate=-400000 -subfont-text-scale 3 -sub subtitles-file.srt -o output.avi input.avi

To encode video for a PlayStation3 dlna server:

mencoder -ovc xvid -oac mp3lame -xvidencopts bitrate=-400000 -o output.avi input.avi

Convert any video file to a DVD compliant MPG:

mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd:tsaf -vf scale=352:240,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800: vbitrate=5000:keyint=18:vstrict=0:acodec=ac3:abitrate=192: aspect=16/9 -ofps 30000/1001 -o outputfile.mpg inputfile.avi

This entry was posted in Linux.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>