Useful Mplayer/Mencoder Commands
Posted on In Linuxmplayer/mencoder are powerful tools. This is a list of useful mplayer/mencoder commands.
Table of Contents
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 vcodec=mpeg4:vbitrate=400:v4mv:mbd=2:trell:autoaspect:dia=2:acodec=mp3:abitrate=32:vpass=1 -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 user@example.com "cat audio.mp3" | mplayer -cache 8192 -
Play files from FTP:
wget ftp://example.com/file.avi -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://example.com/file.rm
Update history:
Jun 23, 2010. Correct the errors about vcodec and endpos options.
One comment