User Tools

Site Tools


MPlayer Usage (and some other video stuff)


Play video stream from webcam through v4l2

Make sure that mplayer is compiled with the v4l2 use flag. Make sure that the kerenl is compiled with video for linux support (Device Drivers —> Multimedia support —> <*> Video For Linux) and with proper device driver support (in the subsections of aforementioned config section).

mplayer -fps 15 tv:// -tv driver=v4l2:device=/dev/video0

Play MTS files

mplayer -demuxer lavf -lavdopts threads=4:fast:skiploopfilter=all:skipframe=none -fps 25 SOMEFILE.MTS


Encoding an xvid file in 2 pass mode

The following example will encode a file in xvid 2 pass mode with normalized mp3 audio.

mencoder -o /dev/null -ovc xvid -xvidencopts pass=1 -nosound $FILENAME
mencoder -o $OUTPUT -ovc xvid -xvidencopts bitrate=$BITRATE:pass=2 \
    -oac mp3lame -lameopts vbr=3:br=112:mode=1 -af volnorm $FILENAME

Encoding an h264 file

The following example will encode a file in h264 with normalized mp3 audio.

mencoder -o $OUTPUT -ovc x264 -x264encopts bitrate=$BITRATE:threads=3 \
    -oac mp3lame -lameopts vbr=3:br=112:mode=1 -af volnorm $FILENAME

Making a flash movie

Note it only works for 44100Hz sound, hence the -srate 44100 option.

mencoder -ovc lavc -oac mp3lame -srate 44100 -lavcopts vcodec=flv \
         -of lavf -lavfopts format=swf $FILENAME -o $OUTPUT

Making a DVD

Grabbing from X11

Low resolution and low quality:

ffmpeg -f x11grab -s vga -i :0.0 /tmp/out.mpg

Better quality and higher resolution:

ffmpeg -r 24 -f x11grab -s 1024x768 -i :0.0 -threads 0 -vcodec libx264 -vpre lossless_ultrafast /tmp/out.mkv

Fixing a noisy VHS rip

-vf-add hqdn3d=10:10:20 -vf-add pp=fd

hqdn3d is a denoise filter, pp=fd is a deinterlace filter.

Fixing annoying audio denormalisation

-af volnorm=1,ladspa=/usr/lib/ladspa/

Make sure that the swh-plugins ladspa package is installed on the system, and that mplayer is compiled with ladspa support.

Create Ogg/Theora file for the new html video tag

ffmpeg2theora movie.avi
mv movie.ogv movie.ogg

This is not exactly the mencoder approach… but this seemed to be the right place to put it.

Browser friendly videos

ffmpeg -i my-original-video.wmv -vcodec libx264 -f mp4 -vb 1024k -preset slow my-new-video.mp4
mplayer/mplayer_usage.txt · Last modified: 2019/11/12 21:56 by deva