Mplayer-vaapi on Oneiric (Ubuntu 11.10) for AMD/ATI HowTo

Mplayer-vaapi is an official branch from the mplayer project team and can be checked out via subversion. VAAPI is an video output device for hardware accelerated HD content playback (VC1, H264). VLC, Mplayer and maybe one day Xine can make use of it.
I’ve bought a ATI/AMD Redeon HD 5450 graphics card on a budget (35€/40$) so I can test the newest development going on. Installing Ubuntu 11.10 Server (Kernel 3.0.0.4-14-server) with openbox as window manager, I’ve been able to make mplayer-vaapi work, but don’t ask me how long it took me. If you know what to do, it’s quite simple. Actually the only thing one has to know is, that the current libva1 (version 0.32) driver is broken. And the ATI/AMD’s fglrx driver version 8.88.7 makes mplayer crash after a while. These two simple facts took me a few evening to find out.

The steps to make it work are quite simple.

  • Install Ubuntu Server 11.10 and put a ATI/AMD graphics adapter into it.
  • Install ATI/AMD’s newest fglrx driver and the vaapi and xvba libs. Install openbox, if you like. Else use xinit -e <command> to start mplayer later on.
    apt-get install fglrx-updates vainfo xvba-driver

    Important is fglrx-updates and not the stand-alone fglrx, which is also available and might be taken because it looks reasonable! Else you’ll get the buggy version (today. V8.88.7)

  • How, since the last apt-get also installed the broken libva1 0.32 package, we have to correct this. Download the last know working lib, which is 0.31-sds4 from Splitted Desktop. This company has done the development of this drivers and their patch for mplayer was also made available to the official mplayer project team. But build the dependencies first, before you overwrite the inaccurate libs.
    apt-get build-dep mplayer
    wget http://www.splitted-desktop.com/static/libva/libva/pkgs/amd64/libva1_0.31.1-1+sds4_amd64.deb
    dpkg -i --force-overwrite libva1_0.31.1-1+sds4_amd64.deb
    wget http://www.splitted-desktop.com/static/libva/libva/pkgs/amd64/libva-dev_0.31.1-1+sds4_amd64.deb
    dpkg -i libva-dev_0.31.1-1+sds4_amd64.deb
  • Now we compile and install mplayer.
    aptitude install subversion
    wget http://www.splitted-desktop.com/static/libva/mplayer-vaapi/mplayer-vaapi-latest.tar.bz2
    tar xfvj mplayer-vaapi-latest.tar.bz2
    cd mplayer-vaapi-20*
    ./checkout-patch-build.sh
  • In case you didn’t start openbox yet, do it now, but configure an initial xorg.conf first.
    amdconfig --initial
    startx

    and open an terminal windows in your running openbox session

  • Now play a sample file.
    cd mplayer-vaapi
    ./mplayer -vo vaapi <your-hd-sample.mkv>
  • In case you don’t use openbox, but xinit only, start mplayer like this:
    aptitidute install xinit
    xinit -e mplayer -vo vaapi <your-hd-sample.mkv>

Debugging and Tips

  • Make sure your vainfo output looks like this:
    Xlib:  extension "XFree86-DRI" missing on display ":0.0".
    libva: va_openDriver() returns 0
    vainfo: VA API version: 0.31
    vainfo: Driver version: Splitted-Desktop Systems XvBA backend for VA-API - 0.7.8
    vainfo: Supported profile and entrypoints
          VAProfileH264High               : VAEntrypointVLD
          VAProfileVC1Advanced            : VAEntrypointVLD

    You can ignore the XFree86-DRI message. It took me a while to figure out it’s totally meaningless.

  • Check fglrx for the correct version and errors in the Xorg log-file:
    i# cat /var/log/Xorg.0.log | egrep "(Version: 8|EE)"
            (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
    [  1005.202] (II) Loading extension MIT-SCREEN-SAVER
    [  1005.650] (II) fglrx(0):     Version: 8.91.4
    [  1005.929] (EE) HID 046a:0023: failed to initialize for relative axes.

    If you get mplayer crashes/freezes, especially when using the “F” toggle-fullscreen key intensely, then its very likely you are on an older fglrx version. Mine was 8.88.7 and it was crashing all the time in my openbox session. The only way to use it reliably was to start it via xinit.

  • If you get this crash, if you start playing HD content in your new mplayer:
    root@ati:~/mplayer-vaapi/mplayer-vaapi-20110127/mplayer-vaapi# ./mplayer -vo vaapi hd-sample.mkv
    MPlayer SVN-r32819 (C) 2000-2011 MPlayer Team
    mplayer: could not connect to socket
    mplayer: No such file or directory
    Failed to open LIRC support. You will not be able to use your remote control.
    
    Playing /data/Videos/hd-sample.mkv.
    libavformat file format detected.
    [matroska,webm @ 0x1ea8dc0] max_analyze_duration reached
    [matroska,webm @ 0x1ea8dc0] Estimating duration from bitrate, this may be inaccurate
    [lavf] stream 0: video (h264), -vid 0, 12 Mbp/s AVC H.264
    [lavf] stream 1: audio (ac3), -aid 0, -alang ger, 5.1 AC3 640 Kbp/s
    [lavf] stream 2: audio (ac3), -aid 1, -alang eng, 2.0 AC3 192 Kbp/s Commentary
    [lavf] stream 3: subtitle (unknown), -sid 0, -slang ger, German Forced
    [lavf] stream 4: subtitle (unknown), -sid 1, -slang ger, Commentary
    [lavf] stream 5: subtitle (ass), -sid 2, -slang eng
    [lavf] stream 6: subtitle (ass), -sid 3, -slang eng, Commentary
    VIDEO:  [H264]  1920x800  0bpp  23.976 fps    0.0 kbps ( 0.0 kbyte/s)
    Load subtitles in /data/Videos/
    libva: libva version 0.32.0-sds2
    Xlib:  extension "XFree86-DRI" missing on display ":0".
    libva: va_getDriverName() returns 0
    
    
    MPlayer interrupted by signal 11 in module: preinit_libvo
    - MPlayer crashed by bad usage of CPU/FPU/RAM.
      Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and
      disassembly. Details in DOCS/HTML/en/bugreports_what.html#bugreports_crash.
    - MPlayer crashed. This shouldn't happen.
      It can be a bug in the MPlayer code _or_ in your drivers _or_ in your
      gcc version. If you think it's MPlayer's fault, please read
      DOCS/HTML/en/bugreports.html and follow the instructions there. We can't and
      won't help unless you provide this information when reporting a possible bug.
    

    then you definitely installed the wrong libva-version. It must be the version 0.31.1-sds4 and no other!

  • If you want your new mplayer as an Debian Package, use checkinstall. I use this one-liner in the installation directory of mplayer:
    sudo checkinstall --pkgname=$( basename $(pwd) ) --pkgversion="3:$(./version.sh | 
        awk -F'[" ]' '/POINT/{print $4"+svn"$5}')" --backup=no --deldoc=yes 
        --fstrans=no --default
  • If you want your manually installed packages upgrade persistent, than mask them on hold.
    echo libva1 hold | dpkg --set-selections
    echo libva-dev hold | dpkg --set-selections
    echo mplayer hold | dpkg --set-selections

    You can see them marked as hi standing for hold, installed.

    dpkg -l | egrep "(mplayer|libva)" | grep ^hi
    hi  libva-dev  0.31.1-1+sds4     Video Acceleration (VA) API for Linux -- development file
    hi  libva1     0.31.1-1+sds4     Video Acceleration (VA) API for Linux -- runtime
    hi  mplayer    1-1               mplayer-vaapi from splitted desktop
    

Notes
If you should get dependencies problems, install the libva packages right before the ./checkout-patch-build.sh command. Use apt-get -f install to fix integrity of the dependencies and install the libva1/libva-dev again.

I’m a big friend of it having it nice, smooth and quick. Therefor I’m using launchpad PPAs wherever I can. But looking through the available PPAs at launchpad.net I couldn’t find anything working. It’s old, outdated or simply the dependencies drove me into a mess.
If anybody have a working out-of-the-box PPA for Oneiric, feel free to post it here as a comment.

Debian Package
Download this package at your own risk. It’s build on a Ubuntu Server 11.10

Linux oneiric 3.0.0-14-server #23-Ubuntu SMP Mon Nov 21 20:49:05 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

Make sure you’ve installed the libva1-0.31.1-1+sds4 debian package.

Downlaod File: mplayer-vaapi_0-1_amd64.deb [9.3M]
md5sum: 1810f2fca428bb359d5341cda2565ac3

Links

Please post found errors, corrections, updates.
Thanks.

8 thoughts on “Mplayer-vaapi on Oneiric (Ubuntu 11.10) for AMD/ATI HowTo

  1. Francesco

    I got the error “unable to locate package xvba-driver” for:

    apt-get install fglrx-updates vainfo xvba-driver

    So instead I did:

    apt-get install fglrx-updates vainfo xvba-va-driver

    You think that’s ok?

    Thanks

  2. Francesco

    Also for me, I found that I need to invoke mplayer with the va option as well:

    ./mplayer -vo vaapi -va vaapi

    Thanks

  3. Zafer Kadi

    I have a HP 6565b, and I ma using x86 – Ubuntu 11.10, 32-bit.

    I replace the deb packages with the appropriate one but once I install all libs, the system does not boot.
    Neither vainfo recognizes vaapi .

    Any suggestions ?

    Note: I also tried the driver from AMD without success.

    Thx!

  4. Don

    Thanks for the tutorial, it has helped me get video acceleration running on my Acer Iconia W500 (or maybe more correctly *U*500). The branched mplayer for vaapi works fine & I’ve modified smplayer’s setup to call it instead of the default.

    However, by installing the libraries from splitted desktop my aptitude upgrades are now failing. Did you find a PPA for the vaapi libraries? Or how can I work around this:

    The following packages have unmet dependencies.
    libavcodec-extra-53 : Depends: libva1 (> 1.0.12~) but 0.31.1-1+sds4 is installed
    libva-glx1 : Depends: libva1 (> 1.0.12~) but 0.31.1-1+sds4 is installed
    libva-tpi1 : Depends: libva1 (> 1.0.12~) but 0.31.1-1+sds4 is installed
    vainfo : Depends: libva1 (> 1.0.12~) but 0.31.1-1+sds4 is installed

  5. David

    Yes, I too get dependency problems, like Don. If I fix them with apt-get -f install, mplayer won’t work, even though I make a backup of the libva.so files that mplayer has as dependencies (which I found out through ldd mplayer), and copy them back after the apt-get.

    This is a problem since Ubuntu refuses to install anything else until it is fixed.

  6. David

    I am an idiot. I only copied the symbolic links. Do “cp /usr/lib/libva-* /tmp” then “apt-get -f install”, then “cp /tmp/libva-0.31.1.1.so.1* /tmp/libva-x11-0.31.1.1.so.1* /tmp/libva-glx-0.31.1.1.so.1* /usr/lib” and everything should work! Also, make sure that the two environment variables are still set:
    export LIBVA_DRIVER_NAME=”fglrx”
    export LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri

Comments are closed.