Web Design

Make MPlayer play h264 video files faster on multicore machines

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.

Author Profile

T4L ;

Other posts by

Author's web site



Are you satisfied with this blog?
Why not subscribe our RSS Feed? you will always get the latest post.


19 Comments


  1. The ff-mpeg SVN URL is wrong.

    1
  2. T4L

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

    2
  3. 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.

    3
  4. T4L

    @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”.

    4
  5. 5
  6. LOL x2

    I would very much like to second the lol @ bob…

    6
  7. 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?

    7
  8. lionheart

    Ubuntu-users can add a PPA repository, see:

    https://launchpad.net/~rvm/+archive/testing

    …to get mplayer-mt (by the guy who makes smplayer, a graphical frontend to mplayer)

    Works really well even on the hyper-threaded Atom processor (netbooks).

    8
  9. Flink

    Yeah the ffmpeg-mt url is not the good one. This is the good one: http://gitorious.org/ffmpeg/ffmpeg-mt
    Just look at your svn commands, these are the same source urls, and only the directory to create locally is changed.

    9
  10. Mike

    Great guide T4L, worked perfectly.

    10

  11. Awesome, worked fine in the first try :3

    11
  12. 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?

    12
  13. T4L

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

    13
  14. 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.

    14
  15. 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)

    15

  16. 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?

    16

  17. 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.

    17
  18. 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

    18

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

    19

Leave A Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>