Make MPlayer play h264 video files faster on multicore machines

By | July 26, 2009

You can make MPlayer play h264-encoded video files a lot faster on multicore machines if you graft some libraries from the ffmpeg-mt project into the resulting mplayer binary. We need to recompile for this. First, use Subversion to download the code for MPlayer:

svn co svn://svn.mplayerhq.hu/mplayer/trunk mplayer

Then the code for ff-mpeg

svn co svn://svn.mplayerhq.hu/mplayer/trunk ffmpeg-mt

Remove the old libavcodec, libavformat and libavutil code from MPlayer

rm -rf mplayer/libavcodec mplayer/libavformat mplayer/libavutil

…and merge in the new ones from ff-mpeg:

cp -a ffmpeg-mt/libavcodec ffmpeg-mt/libavformat ffmpeg-mt/libavutil mplayer/

compile everything

cd mplayer
./configure –disable-vdpau –disable-libdirac-lavc
nice make -j 4

Install the new mplayer-mt binary in your /usr/bin foder:

sudo install -m 755 mplayer /usr/bin/mplayer-mt

Now play your h264 files with the new binary mplayer-mt. Original idea here.

The examsheets offer you incredible online EX0-101 training to help you successfully pass 70-290 and 70-662 exam.

19 thoughts on “Make MPlayer play h264 video files faster on multicore machines

  1. T4L Post author

    The ff-mpeg SVN URL is the right one. I re-tested it and it works.

    Reply
  2. bob

    I like the idea of upgrading mplayers’ library, but I don’t really want my h264-encoded files to play any faster than they do. It would make the voices very chipmonky and it would be really hard to follow what was going on.

    Reply
  3. T4L Post author

    @bob: the idea of the tip was to make them run faster as in “smoother”. As in “without glitches” and not faster as in “with double the video/audio speed”.

    Reply
  4. Michael

    What is the difference between this and just enabling vdpau (if you have an nVidia video card)?

    Can you do this and enable vdpau? What effect?

    Reply
  5. Chandolias Nikos

    I did everything from above, I got no error, but when I try to open any file on smplayer, I get this error:

    /usr/bin/mplayer-mt -noquiet -nofs -nomouseinput -lavdopts threads=4 -sub-fuzziness 1 -identify -slave -vo gl:yuv=2:force-pbo:ati-hack -ao alsa:device=hw=1.0 -nokeepaspect -dr -double -input nodefault-bindings:conf=/dev/null -stop-xscreensaver -wid 33554777 -monitorpixelaspect 1 -ass -embeddedfonts -ass-line-spacing 0 -ass-font-scale 1 -ass-force-style PlayResX=512,PlayResY=320,Name=Default,Fontname=Arial,Fontsize=22,PrimaryColour=&H00ffffff,BackColour=&H00000000,OutlineColour=&H00000000,Bold=0,Italic=0,Alignment=2,BorderStyle=1,Outline=1,Shadow=2,MarginL=20,MarginR=20,MarginV=8 -fontconfig -font Arial -subfont-autoscale 0 -subfont-osd-scale 22 -subfont-text-scale 22 -subcp enca:el:CP1253 -subpos 100 -volume 40 -cache 2000 -osdlevel 0 -idx -vf-add screenshot -slices -channels 2 -af scaletempo -softvol -softvol-max 110 /media/MELKOR/Data/Shoot ‘Em Up/Shoot ‘Em Up.mkv

    Unknown option on the command line: -stop-xscreensaver
    Error parsing option on the command line: -stop-xscreensaver
    MPlayer SVN-r31525-4.4.3 (C) 2000-2010 MPlayer Team
    ID_EXIT=NONE

    Can someone help me?

    Reply
  6. T4L Post author

    @Nikos: you can add a line in your .mplayer/config file as “stop-xscreensaver = 1”. Try it that way.

    Reply
  7. Chandolias Nikos

    Thanks for the tip, but it didn’t worked. Every way I tried to do it, I get a message “unknown parameter”. I tried it like this “./configure stop-xscreensaver = 1” and “./configure –disable-stop-xscreensaver = 0” but the result was always the same.

    Reply
  8. Rashkae

    Chandolias: Look in the smplayer options for the check mark to disable screensaver and uncheck it. Or, you can try to install the xscreensaver devel libraries (whatever package they may be hidden in) and re-compile mplayer. (and hopefully, having found whatever libraries it needs, the disable x-screensaver function will be included in the build)

    Reply
  9. codethief

    I tried the ppa packages with the patches included which Lionheart mentioned above (https://launchpad.net/~rvm/+archive/testing) and things have become a bit better, now. It’s not lagging anymore but a short look at top and i7z told me that SMPlayer is still using a single core instead of all four (but now just < 90% usage instead of the previous 99-100%)
    I know that the fact that there’re four threads (at least, I set the number of threads in the settings respectively) doesn’t necessarily result in all four cores of my i7 720QM being used. But is there a way to make MPlayer use all four (or for all I care three) cores?

    Reply
  10. codethief

    Alright, I was a bit too optimistic as it seems.
    It’s still lagging every now and then. Sometimes more, sometimes less. But it’s nevertheless annoying.

    Reply
  11. davek

    Hi,
    great post, everything works just fine. Thx a lot, but I got one question: nice make -j 4 , that 4 stands for number of cores? thx

    Reply
  12. kotnik

    Davek, you double the number of cores and that’s your -j parameter. For example, if you have 2 cores, use -j4.

    Reply

Leave a Reply

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