What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:



May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!

Top Tags



Commands tagged mencoder from sorted by
Terminal - Commands tagged mencoder - 26 results
mencoder -speed 2 -o output.avi -ovc lavc -oac mp3lame input.avi
cat part1.avi part2.avi part3.avi > tmp.avi && mencoder -forceidx -oac copy -ovc copy tmp.avi -o output.avi && rm -f tmp.avi
2013-09-05 01:47:22
User: sudopeople
Functions: cat rm

Useful for when you download movies split into < 700mb parts.

Credit to rich @ http://superuser.com/questions/318640/merge-avi-files-without-recoding-in-mac-os-x-lion

mencoder is generally included with mplayer.


sudo port install mplayer
mencoder mf://*.jpg -mf fps=50:type=jpg -ovc raw -oac copy -o out50fps.avi
2013-05-30 07:49:36
User: bhbmaster
Tags: video mencoder

Most of the commands require the jpegs a certain format, not this, it just follows alphabetical order. The same order you follow if you do "ls -lisah" from top to bottom, top frame is first, bottom is last...

This goes perfectly with a webcam timelapse... I have just the script for it:


mencoder FILENAME.3gp -ovc lavc -lavcopts vcodec=msmpeg4v2 -oac mp3lame -lameopts vbr=3 -o FILENAME.avi
mencoder "mf://*.jpg" -mf fps=8 -o ./video.avi -ovc lavc
mencoder -audiofile input.mp3 -oac copy -ovc lavc -lavcopts vcodec=mpeg4 -ffourcc xvid -vf scale=320:240,harddup input1.avi input2.avi -o output.avi
2010-01-28 21:14:03
User: ivalladt

Takes two input video files and an external audio track and encodes them together to an MPEG-4 DivX output video file with the correct size ready for uploading.

mencoder input.avi -of mpeg -ovc lavc -lavcopts vcodec=mpeg1video \ -oac copy other_options -o output.mpg
2010-01-18 13:12:03
User: slishan


MEncoder can create MPEG (MPEG-PS) format output files. Usually, when you are using MPEG-1 or MPEG-2 video, it is because you are encoding for a constrained format such as SVCD, VCD, or DVD.

To change MEncoder's output file format, use the -of mpeg option.

Creating an MPEG-1 file suitable to be played on systems with minimal multimedia support, such as default Windows installs:

mencoder input.avi -of mpeg -mpegopts format=mpeg1:tsaf:muxrate=2000 \

-o output.mpg -oac lavc -lavcopts acodec=mp2:abitrate=224 -ovc lavc \

-lavcopts vcodec=mpeg1video:vbitrate=1152:keyint=15:mbd=2:aspect=4/3

mencoder -ss <start point> -endpos <time from start point> -oac copy -ovc copy <invid> -o <outvid>
2010-01-11 22:59:13
User: Buzzcp


The following will take frames starting at 15.2 seconds for a total of 45.9 seconds:

mencoder -ss 15.2 -endpos 30.7 -oac copy -ovc copy mymovie.avi -o myeditedmovie.avi

Keep in mind -endpos is the total time, i.e. the output video in this is 3 minutes 3 seconds in length:

mencoder -ss 1 minute -endpos 2 minutes 3 seconds -oac copy -ovc copy mymovie.avi -o myeditedmovie.avi
mencoder -sub heading.ssa -subpos 0 -subfont-text-scale 4 -utf8 -oac copy -ovc lavc -lavcopts vcodec=mpeg4 -vf scale=320:-2,expand=:240:::1 -ffourcc xvid -o output.avi dvd.avi
2009-11-23 11:58:42
User: ivalladt

Reencodes to MPEG-4 DivX output video file from step 1. Audio stream is simply copied. Resizes to 320x240 and deinterlaces as needed. A heading subtitle file is applied as watermark. This heading subtitle file can be a URL.

mencoder -oac mp3lame -lameopts cbr=128 -ovc lavc -lavcopts vcodec=mjpeg -o dvd.avi dvd://0
2009-11-23 11:53:30
User: ivalladt

Rips DVD to lossless encoded video file. Reencodes audio to CBR MP3 for correct audio to video syncing. Be sure to have enough free disk space.

mencoder -oac mp3lame -lameopts cbr=128 -ovc lavc -lavcopts vcodec=mpeg4 -ffourcc xvid -vf scale=320:-2,expand=:240:::1 -o output.avi dvd://0
2009-09-25 19:29:25
User: ivalladt

Rip DVD to YouTube ready AVI file, using MPEG-4 video codec and MP3 audio codec. Resizes to 320x240 and deinterlaces as needed.

mencoder -sub heading.ssa -subpos 0 -subfont-text-scale 4 -utf8 -oac mp3lame -lameopts cbr=128 -ovc lavc -lavcopts vcodec=mjpeg -vf scale=320:-2,expand=:240:::1 -o output.avi input.flv
2009-09-21 11:56:55
User: ivalladt

Create subtitle file heading.ssa with just one entry for the entire video duration. Command line sets that entry's text on top of the video as text watermark. If text is an URL works nice for sending people back to your site from a YouTube clip. Output file is lossless encoded and suitable for further processing. Subtitle file can be a URL so it's saved remotely.

mencoder tv:// -tv driver=v4l2:width=800:height=600:device=/dev/video0:fps=30:outfmt=yuy2:forceaudio:alsa:adevice=hw.2,0 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1800 -ffourcc xvid -oac mp3lame -lameopts cbr=128 -o output.avi
2009-09-15 19:46:06
User: ivalladt

Record audio to MP3 stream and video to MPEG-4 stream from webcam to AVI file using mencoder. Gives floating point exception in some mencoder versions.

mencoder -of rawaudio -ovc copy -oac mp3lame -o output.mp3 input.avi
2009-09-15 11:28:01
User: ivalladt

Extracts an MP3 encoded audio stream from an input video file.

mencoder -ovc copy -audiofile input.mp3 -oac copy input.avi -o output.avi
2009-09-15 11:26:05
User: ivalladt

Creates a new video file with video stream copied from input file and a different audio stream

mencoder -ovc copy -nosound input.avi -o output.avi
2009-09-15 11:22:51
User: ivalladt

Remove sound from input video file, output video stream is copied from input video stream, with no audio.

mencoder -sub subs.ssa -utf8 -subfont-text-scale 4 -oac mp3lame -lameopts cbr=128 -ovc lavc -lavcopts vcodec=mpeg4 -ffourcc xvid -o output.avi input.flv
2009-09-12 09:24:24
User: ivalladt

Gives MPEG-4/DivX output video file ready for uploading to YouTube from FLV file downloaded from the site and your own subtitle file UTF-8 encoded. No resizing needed. (?)

mencoder -of avi -ovc lavc movie.avi -o movie2.avi; ffmpeg -i movie2.avi -r 12 -b 100 movie.flv
2009-08-28 11:05:21
User: dcabanis

First, we convert the VMware avi (VMnc format) to the Microsoft avi format. Next, we convert the Microsoft avi format to FLV format.

You can play around with the -r switch (rate per second) and the -b switch (bitrate). But, if those get larger, so does your FLV file.

mencoder dvd://<title> -dvd-device <device> -aid 128 -info srcform='ripped by mencoder' -oac mp3lame -lameopts abr:br=128 -ovc xvid -xvidencopts pass=2:bitrate=-700000 -ofps 30000/1001 -o '<outputfile.avi>'
2009-07-19 20:53:54
User: din7
Tags: mencoder

This set of commands will rip a dvd title using a 2 pass mencoder xvid encode. It will provide a great quality rip. It will rip as close to 700MB as possible. (note the bitrate of -700000)


mencoder video.avi lavc -lavcopts vcodec=mpeg4:vbitrate=800 newvideo.avi
2009-06-19 17:30:46
User: dcabanis

Encode video.avi into newvideo.avi using the libav codec to produce an MPEG4 file with a bitrate of 800

mencoder -tv device=/dev/video1 tv:// -ovc copy -o video.avi
2009-06-19 17:21:33
User: dcabanis

video.avi is the resulting file. Press Ctrl+c to stop the recording. You can change the OVC option to another to record into a different format.

mencoder -aid 2 -oac copy file.avi -o english.mp3
mencoder your_video.flv -oac mp3lame -ovc xvid -lameopts preset=standard:fast -xvidencopts pass=1 -o your_video.avi
mencoder -ovc copy -oac copy -of avi -o remuxed.avi original.avi
2009-03-23 10:15:36
User: iain

When playback of AVI files (containing a video format like XviD or DivX) is stuttering, it in 90% of the files is caused by a poorly or wrongly interleaved file. The issue can be permanently resolved by RE-MUXING the AVI video-files that have this problem

mencoder -vf rotate=1 -ovc lavc -oac copy "$1" -o "$1"-rot.avi