Useful Mplayer/Mencoder Commands

mplayer/mencoder are powerful tools. This is a list of useful mplayer/mencoder commands.

Extract the audio, convert it to PCM and write the resulting wave file to audio.wav:

mplayer -vo null -hardframedrop -ao pcm:file=audio.wav video.avi

Convert .wav file to .mp3 file:

lame -h out.wav out.mp3

Preview a video composed of all jpeg files from the current folder at 15fps:

mplayer "mf://*.jpg" -mf fps=15

Create a 15fps video from all jpeg files of the current folder:

mencoder "mf://*.jpg" -mf fps=15 -ovc lavc -o ./output.avi

Cut a video from second 6 to second 206 (which is 200+6, the output.avi is 200 seconds long):

mencoder big-file.avi -ss 6 -endpos 200 -ovc copy -oac copy -o output.avi

Convert raw videos into ISO standard MPEG-4 (DivX 5, XVID compatible) videos:

mencoder source.avi -ovc lavc -oac lavc -ffourcc DX50 -lavcopts 
 -vf hqdn3d -o output.avi

Get informations about a video:

mplayer -frames 0 -identify ./video.avi

Show all mplayer filter list:

mplayer -vf help

Play audio files over ssh connection

ssh "cat audio.mp3" | mplayer -cache 8192 -

Play files from FTP:

wget -O - | mplayer -cache 8192 -

Repeat a file multiple times:

mplayer file1 -loop 2 file2 -loop 1 file3 -loop 4

Record stream:

mplayer -dumpstream -dumpfile output.rm -cache 4096 rtsp://

Update history:
Jun 23, 2010. Correct the errors about vcodec and endpos options.

Eric Zhiqiang Ma

Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

One comment:

Leave a Reply

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