Friday, March 12, 2010

Multi-threaded mplayer for faster 720p (HD) decoding / playback

Unfortunately, the related thread here is outdated. The following should work:

sudo apt-get build-dep mplayer
sudo apt-get install build-essential git-core autoconf libtool
git clone git://
cd mplayer-build
./init --shallow
make -j 6

Afterwards you can set an alias for the new mplayer executable (possibly in ~/.bash_aliases):
alias mplayer=~/mplayer-build/mplayer/mplayer

Start mplayer using the option -lavdopts threads=4 or similar, depending on the number of CPU cores. You can also add the following to your ~/.mplayer/config file:

If that's still not fast enough, you can try disable deblocking filtering:
or even

Also make sure to select a decent vo option, e.g. try -vo xv or -vo gl.


mattydee said...

Awesome, nice little tutorial. Many thanks !

leo said...

Thanks, you're welcome!

neutrino said...

Didn't work for me. In conky I still see only one core (of four) loaded to 100% and others 0-5%, and of course stuttering.

Any clue?

P.S. I'm playing 1080p movie.

leo said...

neutrino, are you sure you actually ran the newly compiled executable? Or maybe you forgot the "./enable-mt" step?

W.F. said...

Followed instructions above and compiling went wel, but i have no video output (XV). mplayer -vo help gives me:

MPlayer SVN-r31642-4.4.3 (C) 2000-2010 MPlayer Team
Available video output drivers:
fbdev Framebuffer Device
fbdev2 Framebuffer Device
v4l2 V4L2 MPEG Video Decoder Output
cvidix console VIDIX
null Null video output
mpegpes MPEG-PES to DVB card
yuv4mpeg yuv4mpeg output for mjpegtools
png PNG file
tga Targa output
md5sum md5sum of each frame

Tried several methods to compile mplayer with mt, but all seems to lack the XV drivers.


leo said...

W.F., try installing the libxv-dev package, reconfigure, and rebuild. Maybe that'll fix the issue.

W.F. said...

was installed, but i got it working now. for some reason another mplayer executable was running instead of the newly compiled one. executing the full path e.g. /home/user/mplayer-build/mplayer/mplayer someH264.mp4 did the trick. But some MTS files do not play well though (Canon Legria HF200), audio / video sync problems.

DaVince said...

I compiled the multithreaded version, and sure enough, mplayer now uses two cores. However, it's also suddenly much slower, the frame rate is lower than when it was using a single core, and it's using only about 15% of the second core!

Thanks for this tutorial, but it simply doesn't seem to be working well for me.

roger said...

what are the implications of ffmpeg "fast" option do you know?

leo said...

The manpage says:

fast (MPEG-2, MPEG-4, and H.264 only)

Enable optimizations which do not comply to the specification and might potentially cause problems, like simpler dequantization, simpler motion compensation, assuming use of the default quantization matrix, assuming YUV
4:2:0 and skipping a few checks to detect damaged bitstreams.

Anonymous said...

3 years I've had my netbook and I didn't realize it could play back 720p smoothly all along. Just had to enable multi-core decoding and XvMC acceleration.

Thanks man. You made my day.

leo said...

Awesome! You're very welcome!