How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs

  Thread Rating:
  • 23 Votes - 4.52 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Closed
wsnipex Offline
Team-Kodi Member
Posts: 3,710
Joined: Jun 2011
Reputation: 91
Lightbulb  How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs
Post: #1
XVBA has been deprecated and is not developed anymore.
AMD Gfx users should not use this howto anymore, instead follow http://forum.xbmc.org/showthread.php?tid=174854
Nvidia and Intel users should switch to mainline.

The information below is only kept for reference


Notice for xbmc-xvba-testing users:
FernetMenta bleeding edge development snapshots moved to ppa:wsnipex/xbmc-fernetmenta-master


------------------------------------- old post -------------------------------------

What is Xvba
X-Video Bitstream Acceleration is the AMD API for hardware accelerated video playback on Radeon and Fusion GPUs with UVD.
here is an article with some background information, if you are interested.
The development was started and organized by masterchief FernetMenta (H264, huge part of xbmc integration) and fritsch (VC1, bugfixes, (mpeg-2)).

Current Status
What you get on AMD:
- great improvements over VAAPI(xvba-va-driver) in stability, performance and robustness.
- H264, VC-1 decoding support including smooth 24p playback.

What does not yet work:
- mpeg2/4: not yet enabled in fglrx
- fglrx doesn't support HD audio(DTS HD/MA) yet


- H264 with Level >= 5.1 (artefacts, judder - fglrx driver limitation)
If you find garbage with non supported h264 levels or too many reframes(>4 @1080p), you can disable xvba for this file. You will need a fast CPU for this to work.

Fixed as of 06/28/12 Cool

General improvements:
- video renderer rewritten for improved performance and stability
- improved windowing: multi display support

What you need:
on AMD GPUs:
- fglrx binary driver(amd catalyst) >= 11.11 (>=fglrx 2:8.911) - 13.6 recommended - installed as debs (see step 2 below) on AMD (integrated) GPUs



on Nvidia GPUs:
- nvidia binary driver

on Intel (integrated) GPUs:
- intel open source driver, libva

GIT Source:
https://github.com/FernetMenta/xbmc/commits/master

Ubuntu Packages are available here:
Tested Git builds: https://launchpad.net/~wsnipex/+archive/xbmc-xvba not updated anymore
Frodo stable: https://launchpad.net/~wsnipex/+archive/xbmc-xvba-frodo

Unstable development snapshots: https://launchpad.net/~wsnipex/+archive/...ba-testing not updated anymore

---------------
Xbmc-Live Xvba: http://www.xbmcfreak.nl/en/exclusive-xbm...w-version/
edit 06/15/12: xbmcbuntu 12.04 with xvba: http://xbmcfreak.binkey.nl/xbmcbuntu-11....ing-v1.iso

Arch packages: http://aur.archlinux.org/packages.php?ID=55296
Gentoo ebuild: https://bugs.gentoo.org/show_bug.cgi?id=453012

please note, that those are not made and supported by us.
---------------

IRC:irc.freenode.net:7000 #xbmc-xvba

NOTE: Compositing window managers (e.g. compiz, gnome-shell) do not play well with XBMC
If you have issues, please first disable compiz. If you want unity you can try unity-2d.

You should also set vsync to always on in XBMC - system - settings - system - video output.
AMDs Tearfree option must be disabled as it causes problems.

fglrx cannot do DTS-HD and True-HD audio. You have to set the your speakers to 2.0 in order to get these formats correctly downmixed.
To workaround another bug, also enable LPCM for now if you use audio over HDMI.
assign 512MB RAM to your GFX card, if you have integrated GFX
Attention for AMD Trinity APUs(Ax5xxx): you need a newer kernel, so you must install ubuntu 12.10 quantal


Howto Install XBMC PVR Xvba for AMD GPUs from scratch
note this howto was originally written specifically for AMD Xvba. If you run nvidia or intel replace the drivers as appropriate.

edit: updated guide to ubuntu 12.04
edit 2012-08-10: very comprehensive guide by guilmxm: http://youresuchageek.blogspot.fr/2012/0...linux.html
edit 2012-09-30: install script for ubuntu 12.10 by Bram77: http://forum.xbmc.org/showthread.php?tid=141369

Step 1:
We will use an 64-bit 12.04 Ubuntu Precise minimal to start with the newest basic packages for your OS.
AMD trinity users must use ubuntu 12.10

Choose Command-line-install and use xbmc for username.

After reboot, install ssh so you can continue work with Putty (for win) or with the "ssh -l xbmc your.IP.address" from a linux terminal. We will install py-properties to easyly add the needed ppas and add the user (I have chosen xbmc as the username) to the video and audio group because without this the xserver can not access your gpu directly and falls back to software rasterizer.
Get a terminal with crtl+alt+f1, then

Code:
sudo apt-get update
sudo apt-get install ssh python-software-properties software-properties-common udisks upower xorg alsa-utils mesa-utils git-core librtmp0 lirc libmad0 lightdm lightdm-gtk-greeter lm-sensors libmpeg2-4 avahi-daemon
sudo adduser xbmc video
sudo adduser xbmc audio

sudo reboot # not sure if this is needed

Step 2:
We need to install the AMD/ATI drivers

Code:
sudo apt-get install fglrx
sudo aticonfig --initial -f
sudo aticonfig --sync-vsync=on
sudo aticonfig --set-pcs-u32=MCIL,HWUVD_H264Level51Support,1

optional: disable underscan(black borders)
Code:
sudo aticonfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0

Choose which Xvba build to use, do only one step here
-------------------------------------
Step 3: Tested Git Builds
Code:
sudo add-apt-repository ppa:wsnipex/xbmc-xvba
sudo apt-get update
sudo apt-get install xbmc xbmc-bin

Alternative Step 3: Frodo stable
Code:
sudo add-apt-repository ppa:wsnipex/xbmc-xvba-frodo
sudo apt-get update
sudo apt-get install xbmc xbmc-bin
-------------------------------------

Step 4:
Auto Start Xbmc

edit /etc/lightdm/lightdm.conf

Code:
[SeatDefaults]
autologin-user=xbmc
autologin-user-timeout=0
user-session=XBMC
greeter-session=lightdm-gtk-greeter

edit /usr/share/xsessions/XBMC.desktop

Code:
[Desktop Entry]
Name=XBMC
Comment=This session will start XBMC Media Center
Exec=xbmc-standalone
TryExec=xbmc-standalone
Type=Application

Step 5:
allow xbmc to change its nice level:

edit /etc/security/limits.conf
add following line at the end of the file. xbmc stands for your username, so adjust to fit if you chose something else
Code:
xbmc             -       nice            -1

Step 6:
create the file /etc/polkit-1/localauthority/50-local.d/custom-actions.pkla
Code:
[Actions for xbmc user]
Identity=unix-user:xbmc
Action=org.freedesktop.upower.*;org.freedesktop.consolekit.system.*;org.freedesk​top.udisks.*
ResultAny=yes
ResultInactive=yes
ResultActive=yes

[Untrusted Upgrade]
Identity=unix-user:xbmc
Action=org.debian.apt.upgrade-packages;org.debian.apt.update-cache
ResultAny=yes
ResultInactive=yes
ResultActive=yes

Step 7:
XBMC tweaks

Enable Dirty Region Rendering (drastically reduces CPU load on XBMC idle) and DDS Fanart
NOTE: do not do this as root or with sudo. this file must belong to your normal xbmc user

create: ~/.xbmc/userdata/advancedsettings.xml
Code:
<advancedsettings>
   <loglevel hide="false">0</loglevel>
  <cputempcommand>sensors|sed -ne "s/temp1: \+[-+]\([0-9]\+\).*/\1 C/p"</cputempcommand>
  <gputempcommand>/usr/bin/aticonfig --od-gettemperature | grep Temperature | cut -f 2 -d "-" | cut -f 1 -d "." | sed -e "s, ,," | sed 's/$/ C/'</gputempcommand>
  <gui>    
    <algorithmdirtyregions>3</algorithmdirtyregions>
    <nofliptimeout>0</nofliptimeout>
  </gui>    
<video>
  <latency>
    <delay>0</delay>
    <refresh>
      <min>23</min>
      <max>24</max>
      <delay>175</delay> <!-- set to zero or adjust if audio seems out of sync with 24p movies -->
     </refresh>
  </latency>
</video>
</advancedsettings>


Step 8:
reboot
Code:
sudo reboot


Step 9:
Recommended Xbmc settings

System->Settings->System->Video Settings:
  • Vertical Sync: Always on

System ->Video->Playback:
  • XVBA: On
  • Adjust Refreshrate to match video: On
  • Sync Playback to Display: On
  • Sync Method: Video Clock (Drop/Dupe)

----------------

Optional: workaround for suspend resume

since fglrx seems to have a bug with suspend/resume xbmc can have video playback problems after wakeup.
here is a workaround that will restart X automatically after resume. You should only use it if you have auto-login enabled.

add a new file /etc/pm/sleep.d/99_fglrx
Code:
#!/bin/sh

case $1 in
     suspend|suspend_hybrid|hibernate)
        /usr/sbin/service lightdm stop
        /sbin/rmmod -f fglrx
        ;;

     resume|thaw)
        /sbin/modprobe fglrx
        /usr/sbin/service lightdm start
        ;;
esac
make the file executeable:
Code:
sudo chmod +x  /etc/pm/sleep.d/99_fglrx

----------------

Movie Scraping not working with TMDB?
Install the Youtube plugin in Xbmc, the tmdb scraper depends on it.

----------------

too high idle CPU load?
disable the RSS feed in System - Appearance - Skin

----------------

Get wireless LAN working:
http://forum.xbmc.org/showthread.php?tid=81858

----------------

sample /etc/asound.conf for fusion systems: Only relevant for Eden branch, Audio Engine does not use it.
Code:
pcm.!default {
  type plug
  slave {
#    pcm "hw:1,0" #delete the first hash for sound over analog
#    pcm "hw:1,1" #delete the first hash for sound over optical
    pcm "hw:0,3" #delete the first hash for sound over hdmi
    rate 48000
  }
}
choose Standards (Alsa) for your output and hw:0,3 as your passthrough device
Adjust if you want SPDIF.

----------------
auto mount external drives/usb sticks
Code:
sudo adduser xbmc users

create the file /etc/udev/rules.d/11-media-by-label-auto-mount.rules
click the link above
----------------

How to use the Xvba packages from Xbmcbuntu

remove currently installed xbmc version:
Code:
sudo apt-get remove xbmc xbmc-bin

now follow step3 from above.

----------------
Manually upgrade fglrx:
This driver only supports AMD series >=5xxx cards. If you have <=4xxx series you must download the fglrx-legacy driver and replace the filename accordingly.
http://forum.xbmc.org/showthread.php?tid...pid1138272

Edit: update to best driver for precise:
http://forum.xbmc.org/showthread.php?tid...pid1212272
(This post was last modified: 2013-10-03 14:39 by wsnipex.)
find
jazzparadigm Offline
Junior Member
Posts: 12
Joined: Oct 2011
Reputation: 0
Post: #2
Great effort. Tried installing it according to guide, but get the following error:

Code:
20:58:03 T:140310643058432   ERROR: XVBA::Check - device didn't reset in reasonable time
20:58:03 T:140310643058432  NOTICE: XVBA::Check waiting for display reset event

Full log: http://pastebin.com/gk7dQ9nt

Any ideas?
find
wsnipex Offline
Team-Kodi Member
Posts: 3,710
Joined: Jun 2011
Reputation: 91
Post: #3
could you explain a bit what you did? does any mkv play?
does it work if you disable shared surfaces in video settings?
find
jazzparadigm Offline
Junior Member
Posts: 12
Joined: Oct 2011
Reputation: 0
Post: #4
wsnipex Wrote:could you explain a bit what you did? does any mkv play?
does it work if you disable shared surfaces in video settings?

It seems to work when I play 1080p mkv's in windowed mode, but on fullscreen I get artifacts all over. Did not try to switch off shared surfaces, deleted the binary and am building from source as we speak. Will let you know more once that is done.
find
fritsch Offline
Team-XBMC Developer
Posts: 6,131
Joined: Aug 2011
Reputation: 142
Location: Karlsruhe
Post: #5
Do you always try this with the same video?

Could you provide me a sample of it? just the first 5MB. Is this possible?
find
jazzparadigm Offline
Junior Member
Posts: 12
Joined: Oct 2011
Reputation: 0
Post: #6
fritsch Wrote:Do you always try this with the same video?

Could you provide me a sample of it? just the first 5MB. Is this possible?

Most of it is proprietary content, so that would not be a good idea. Here is some of the file information: http://pastebin.com/9DPJeDHV

Maybe you can provide a public file (i.e. http://www.h264info.com/clips.html) that you are certain that works. I will see if I can get it to play.
find
fritsch Offline
Team-XBMC Developer
Posts: 6,131
Joined: Aug 2011
Reputation: 142
Location: Karlsruhe
Post: #7
Every H264 movie with a h264 level <= 4.1 should work.

(sent you a pm with a sample link)

As talked per pm: disable compiz did fix the problems.
(This post was last modified: 2011-12-16 10:16 by fritsch.)
find
wsnipex Offline
Team-Kodi Member
Posts: 3,710
Joined: Jun 2011
Reputation: 91
Post: #8
added a note in OP about compiz, Please disable it if you have problems.
find
Infinitatus Offline
Junior Member
Posts: 18
Joined: Nov 2011
Reputation: 0
Post: #9
Congratulations, just installed your xbmc PVR Xvba and it is working perfectly till now. I tried 2 movies from http://www.h264info.com/clips.html and they work like a charm. And those menus, so snappy and quick, my hand can´t even follow.

(My system boots in +/- 20 seconds with a SSD installed and my media on a external usb Hd.
BTW I would like to know how Erhnam managed to boot to XBMC in 7 seconds with a SSD.)

Just 2 remarks:
1. You might want to put apt-get install lightdm in your guide for linuxnoobs like me, who just follow your guide to the letter. (I didn´t even know what a cross window manager was)
2. The standard weather script Weather Underground crashed. for the moment I use another weather add-on.

For the rest, I am really really impressed. Keep up the good work. I hope that AMD will help you too.
(This post was last modified: 2011-12-16 20:43 by Infinitatus.)
find
abudabi Offline
Senior Member
Posts: 109
Joined: Aug 2011
Reputation: 1
Post: #10
Yeah... kudos to you guys.

Has AMD been approached about the help that is needed from their side for the 5.1 problem? What has the response been? Anything us plebs can do to help? Big Grin
find
kobik Offline
Senior Member
Posts: 100
Joined: Jan 2009
Reputation: 4
Post: #11
Hey, it seems I was too slow to start this thread Smile
Nice work so far guys.
You really made me happy specifically about one issue I had and it's deinterlacing LiveTV content. At last I can see sports without having a feeling like someone is stabbing me in the eyes Wink

I would like to report a few things, though:
1. Unlike the builds from Lars' repository I'm having lots of crashes when navigating.
2. Fast forwarding on x16 or above stutters
3. Playing a video with the following specs shows a green solid image (Was playing fine on VAAPI)
Code:
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.0
Format settings, CABAC : Yes
Format settings, ReFrames : 3 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 31mn 17s
Bit rate mode : Variable
Bit rate : 3 734 Kbps
Maximum bit rate : 25.0 Mbps
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.162
Stream size : 836 MiB (89%)
Writing library : x264 core 114 r1924 08d04a4
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / constrained_intra=0 / bframes=3 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=18.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=25000 / vbv_bufsize=25000 / crf_max=0.0 / nal_hrd=vbr / ip_ratio=1.40 / aq=1:1.00
4. For the following video I'm having a constant macro-blocking making it un-viewable (This also happens on VAAPI too, though)
Code:
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L5.1
Format settings, CABAC : Yes
Format settings, ReFrames : 5 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 51mn 16s
Bit rate : 7 497 Kbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.151
Stream size : 2.62 GiB (92%)
Writing library : x264 core 59 r851M e11ef38
Encoding settings : cabac=1 / ref=5 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=6 / me-prepass=0 / brdo=1 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / chroma_qp_offset=0 / threads=3 / nr=0 / decimate=1 / mbaff=0 / fgo=0 / bframes=5 / b_pyramid=1 / b_adapt=1 / b_bias=0 / direct=3 / wpredb=1 / bime=1 / keyint=250 / keyint_min=25 / scenecut=40(pre) / rc=2pass / bitrate=7497 / ratetol=1.0 / rceq='blurCplx^(1-qComp)' / qcomp=1.00 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / pb_ratio=1.30 / aq=2:1.00
But I see in the OP that 5.1 profile isn't supported yet, so never mind.
(This post was last modified: 2011-12-16 21:48 by kobik.)
find
fritsch Offline
Team-XBMC Developer
Posts: 6,131
Joined: Aug 2011
Reputation: 142
Location: Karlsruhe
Post: #12
For the first video:
Could you provide me a sample of the first file? (5MB?)

Second one: 5.1 as you have seen right.

What crashes are this? Does it just quit to desktop or do you get a freeze? Does this happen with Shared Surfaces on? Do you watch interlaced TV while this happens?

If it does not crash to desktop, eg segfaults. Could attach to the running process with gdb?

We have seen some effects in fglrx we are not really amused about...
find
wsnipex Offline
Team-Kodi Member
Posts: 3,710
Joined: Jun 2011
Reputation: 91
Post: #13
howto get a gdb backtrace mini howto

In case of a hanging/locked up xbmc process

install gdb:
Code:
sudo apt-get install gdb pastebinit

with XBMC running:
Code:
sudo gdb --pid $(pidof xbmc.bin)

in the gdb shell/prompt (gdb):
Code:
set pagination off
set logging on xbmc-xvba-crash.log
thread apply all bt
detach
quit
cat xbmc-xvba-crash.log ~/.xbmc/temp/xbmc.log | pastebinit

In case xbmc crashes completely to desktop, or X restarts
you should have a xbmc_crashlog* file in your home dir
Code:
cd ~
ls -ltr xbmc_crashlog*  # not needed, just to check if there are crashlog files
pastebinit $(ls -1tr xbmc_crashlog*  | tail -1)


then let us know the url pastebinit outputs.
find
kobik Offline
Senior Member
Posts: 100
Joined: Jan 2009
Reputation: 4
Post: #14
fritsch Wrote:For the first video:
Could you provide me a sample of the first file? (5MB?)

Second one: 5.1 as you have seen right.

What crashes are this? Does it just quit to desktop or do you get a freeze? Does this happen with Shared Surfaces on? Do you watch interlaced TV while this happens?

If it does not crash to desktop, eg segfaults. Could attach to the running process with gdb?

We have seen some effects in fglrx we are not really amused about...

For some reason after reboot the video can be watched normally, do you still want a sample?

Regarding the crash, it crashes completely.
I'm not using any desktop, so, all I see is just a black screen and then monit restarts XBMC service.
Tell me what info and how to get it, and I'll deliver.
find
fritsch Offline
Team-XBMC Developer
Posts: 6,131
Joined: Aug 2011
Reputation: 142
Location: Karlsruhe
Post: #15
Okay, this looks like a segfault. Does this crash happen only with Shared Surfaces enabled?

Edit: Do you watch interlaced content when it crashes?
(This post was last modified: 2011-12-17 13:40 by fritsch.)
find
Thread Closed