Scientific Linux Forum.org



  Reply to this topicStart new topicStart Poll

> Hardware assisted video decoding on RHEL 6 / SL 6 /Centos 6 How-To, how to offload video decoding to the GPU
tux99
 Posted: May 29 2012, 01:16 AM
Quote Post


SLF Moderator
********

Group: Moderators
Posts: 1273
Member No.: 224
Joined: 28-May 11









AMD/ATI:

AMD/ATI graphics cards, APUs (CPUs with integrated GPU) and IGPs (mainboard chipsets with integrated GPU) have been capable of assisting the processor when decoding video streams (playback of videos) since quite a while. Basically all AMD/ATI GPUs that support UVD 2.0 or later are supported.
See here for more info about UVD: https://en.wikipedia.org/wiki/UVD2

The API that implements this in the Linux world is called XvBA and is part of the official AMD/ATI graphics drivers for Linux (the AMD Catalyst a.k.a. fglrx drivers).
See here for more info about XvBA: https://en.wikipedia.org/wiki/X-Video_Bitstream_Acceleration

In Linux the XvBA API is accessed by media players via the VA-API (video acceleration API).
See here for more info about VA-API: https://en.wikipedia.org/wiki/VaAPI

Currently for EL6 based distros there is support for VA-API in VLC and for Gstreamer there is a VA-API plugin that allows Totem and other Gstremer based media players to use VA-API assisted video playback.

Therefore to achieve GPU assisted video decoding with an AMD/ATI GPU you need to have the following RPM packages from the Elrepo and Linuxtech repos installed:

- First add the repo config files (unless you already have elrepo and linuxtech repo files in /etc/yum.repos.d/ ):
su - root
cd /etc/yum.repos.d/
rpm -Uvh http://elrepo.org/elrepo-release-6-4.el6.elrepo.noarch.rpm
wget http://pkgrepo.linuxtech.net/el6/release/linuxtech.repo


- AMD Catalyst (fglrx) drivers from the ElRepo repo:
yum --enablerepo=elrepo install fglrx-x11-drv kmod-fglrx

For Totem and other Gstreamer based apps:
- Gstreamer VA-API plugin from the Linuxtech-release repo:
yum --enablerepo=linuxtech-release install gstreamer-vaapi
- Other Gstreamer plugins for full codec support from the Linuxtech-release repo:
yum --enablerepo=linuxtech-release install gstreamer-plugins-bad gstreamer-plugins-ugly gstreamer-ffmpeg

For VLC:
- VLC 2.0.x from the Linuxtech-release repo:
yum --enablerepo=linuxtech-release install vlc (see also dedicated thread)
In VLC you need to enable GPU assisted decoding in the preferences:
Tools > Preferences > Input & Codecs > Codecs: Use GPU accelerated decoding

And finally the XvBA VA-API backend driver:
- From the Linuxtech-release repo:
yum --enablerepo=linuxtech-release install vaapi-driver-xvba

After installing the above packages, try running VLC from a terminal window and then select for example a H.264 encoded high definition file to play back. You should see VA-API related messages on the terminal window that confirm that VA-API is being used for the video decoding.

If you don't have a test file handy download a trailer from ITunes Movie Trailers using wget like this:
wget -U QuickTime/7.6.2 http://trailers.apple.com/movies/universal/savages/savages-tlr1_h1080p.mov
beware, this is a 179 MB download.


Nvidia:

Nvidia graphics cards and mainboard chipsets with integrated GPU (for example the Nvidia ION) have been capable of assisting the processor when decoding video streams (playback of videos) since the Nvidia GeForce 8000 series (and equivalent mainboard chipsets). Nvidia calls their hardware decoding technology PureVideo HD and the related Linux API is called VDPAU (Video Decode and Presentation API for Unix).
See here for more info about VDPAU: http://en.wikipedia.org/wiki/VDPAU
Details about specific hardware support can be found here: http://en.wikipedia.org/wiki/PureVideo_HD

VDPAU currently only works with the Nvidia binary driver for Linux, not the FOSS Noveau driver that is included in EL6, so you first need to install the Nvidia driver from Elrepo.

- First add the repo config files for Elrepo and Linuxtech (unless you already have elrepo and linuxtech repo files in /etc/yum.repos.d/ ):
su - root
cd /etc/yum.repos.d/
rpm -Uvh http://elrepo.org/elrepo-release-6-4.el6.elrepo.noarch.rpm
wget http://pkgrepo.linuxtech.net/el6/release/linuxtech.repo


- install Nvidia drivers from the ElRepo repo:
yum --enablerepo=elrepo install nvidia-x11-drv kmod-nvidia

For Totem and other Gstreamer based apps:
- Gstreamer VDPAU plugin (included in gstreamer-plugins-bad) from the Linuxtech-release repo:
yum --enablerepo=linuxtech-release install gstreamer-plugins-bad
- Other Gstreamer plugins for full codec support from the Linuxtech-release repo:
yum --enablerepo=linuxtech-release install gstreamer-plugins-ugly gstreamer-ffmpeg

For VLC:
VLC only supports VA-API, not VDPAU, so you first need to install the VDPAU backend for VA-API:
yum --enablerepo=linuxtech-release install vaapi-driver-vdpau
- VLC 2.0.x from the Linuxtech-release repo:
yum --enablerepo=linuxtech-release install vlc (see also dedicated thread)
In VLC you need to enable GPU assisted decoding in the preferences:
Tools > Preferences > Input & Codecs > Codecs: Use GPU accelerated decoding


Intel:

(to follow soon)

--------------------
My personal SL6 repository, specialized in audio/video software: http://pkgrepo.linuxtech.net/el6/
(can be used together with EPEL and ELRepo repositories) - repository mirror: http://linuxsoft.cern.ch/linuxtech/el6/
PM
^
Nux
 Posted: Jun 23 2012, 10:29 PM
Quote Post


SLF Rookie
*

Group: Members
Posts: 17
Member No.: 158
Joined: 12-May 11









Good job, Tux99. I do have a laptop with an ATI GPU and will try to get the acceleration going with your instructions.

On my Intel laptop here's how I did it:
http://www.nux.ro/archive/2012/06/Hardware_accelerated_video_playback_on_EL6__RHEL__Centos__SL__and_Intel_SandyBridge.html
(I really should pack that mplayer-vaapi)

--------------------
Check out my EL6-based desktop remix:
http://li.nux.ro/stella

PMUsers Website
^
Nux
 Posted: Jun 23 2012, 10:58 PM
Quote Post


SLF Rookie
*

Group: Members
Posts: 17
Member No.: 158
Joined: 12-May 11









Tux99,

This is just great, with some HD video I have here I'm getting 17-25% CPU usage on my Radeon HD 3200 in totem; without vaapi-driver-xvba and gstreamer-vaapi I'm seeing 50-60%!

With VLC however I don't see ANY difference. I tried both VLC 1.1.13 (from my repo) and 2.0 (from your repo), I'll need to investigate this some more.

Thanks for your efforts; I'll try to come back with more info.


--------------------
Check out my EL6-based desktop remix:
http://li.nux.ro/stella

PMUsers Website
^
tux99
 Posted: Jun 23 2012, 11:11 PM
Quote Post


SLF Moderator
********

Group: Moderators
Posts: 1273
Member No.: 224
Joined: 28-May 11









QUOTE (Nux @ Jun 24 2012, 12:29 AM)
I really should pack that mplayer-vaapi
I was working on that (see my workinprogress repo), but the resulting RPM has some problems on some setups which I couldn't figure out, so I stopped working on that for now.

QUOTE
With VLC however I don't see ANY difference. I tried both VLC 1.1.13 (from my repo) and 2.0 (from your repo), I'll need to investigate this some more.
Hmm, you probably have some mix of packages from various repos, if you install the linuxtech VLC with all dependencies from linuxtech (and enable GPU assisted decoding in VLC) it should definitely work, it does on all systems I tried.

Run VLC from a terminal window and check the debug output, it should say: using VA-API.

--------------------
My personal SL6 repository, specialized in audio/video software: http://pkgrepo.linuxtech.net/el6/
(can be used together with EPEL and ELRepo repositories) - repository mirror: http://linuxsoft.cern.ch/linuxtech/el6/
PM
^
Nux
 Posted: Jun 24 2012, 09:53 AM
Quote Post


SLF Rookie
*

Group: Members
Posts: 17
Member No.: 158
Joined: 12-May 11









The problem is I have my own repo which provides most of this stuff so it's a bit more tricky, but I'm getting there. For example I had to rebuild gstreamer-vaapi against libva-freeworld that I use to get it working, but it's fine now.

What kind of CPU usage difference to you usually see for VLC on ATI systems?


--------------------
Check out my EL6-based desktop remix:
http://li.nux.ro/stella

PMUsers Website
^
tux99
 Posted: Jun 24 2012, 10:47 AM
Quote Post


SLF Moderator
********

Group: Moderators
Posts: 1273
Member No.: 224
Joined: 28-May 11









QUOTE (Nux @ Jun 24 2012, 11:53 AM)
What kind of CPU usage difference to you usually see for VLC on ATI systems?

On my E350 based APU system, when playing back a 1080p H.264 file I get about 40-50% cpu usage with XvBA/VA-API, without XvBA it doesn't play (or rather it plays like a slide show), so usage goes down from over 100% to 40-50% with XvBA.

Keep in mind though that xvba only decodes VC1 and H.264 up to level 4.1, level 5 is not supported, see: http://www.phoronix.com/scan.php?page=article&item=amd_xvba_xbmc&num=1

--------------------
My personal SL6 repository, specialized in audio/video software: http://pkgrepo.linuxtech.net/el6/
(can be used together with EPEL and ELRepo repositories) - repository mirror: http://linuxsoft.cern.ch/linuxtech/el6/
PM
^
Nux
 Posted: Jun 24 2012, 12:49 PM
Quote Post


SLF Rookie
*

Group: Members
Posts: 17
Member No.: 158
Joined: 12-May 11









Got it, cheers for sharing.


--------------------
Check out my EL6-based desktop remix:
http://li.nux.ro/stella

PMUsers Website
^
tux99
 Posted: Sep 12 2012, 12:57 PM
Quote Post


SLF Moderator
********

Group: Moderators
Posts: 1273
Member No.: 224
Joined: 28-May 11









I finally got around to add the nvidia section. Let me know if you spot any mistaks.

--------------------
My personal SL6 repository, specialized in audio/video software: http://pkgrepo.linuxtech.net/el6/
(can be used together with EPEL and ELRepo repositories) - repository mirror: http://linuxsoft.cern.ch/linuxtech/el6/
PM
^
Nathan
 Posted: Sep 12 2012, 01:29 PM
Quote Post


SLF Geek
****

Group: Members
Posts: 243
Member No.: 928
Joined: 15-October 11









QUOTE (tux99 @ Sep 12 2012, 01:57 PM)
mistaks.

Here's one!
PM
^
tux99
 Posted: Sep 12 2012, 01:30 PM
Quote Post


SLF Moderator
********

Group: Moderators
Posts: 1273
Member No.: 224
Joined: 28-May 11









QUOTE (Nathan @ Sep 12 2012, 03:29 PM)
QUOTE (tux99 @ Sep 12 2012, 01:57 PM)
mistaks.

Here's one!


That was on purpose! tongue.gif

--------------------
My personal SL6 repository, specialized in audio/video software: http://pkgrepo.linuxtech.net/el6/
(can be used together with EPEL and ELRepo repositories) - repository mirror: http://linuxsoft.cern.ch/linuxtech/el6/
PM
^
Nathan
 Posted: Sep 12 2012, 02:05 PM
Quote Post


SLF Geek
****

Group: Members
Posts: 243
Member No.: 928
Joined: 15-October 11









Aw man, I totally fell for it, lol.
PM
^
anffdraco
 Posted: Sep 2 2013, 07:00 AM
Quote Post


SLF Newbie


Group: Members
Posts: 1
Member No.: 2698
Joined: 2-September 13









Hi, so I was trying to follow this guide and during step one I got an error:
error: Failed dependencies:
kernel = 2.6.32 is needed by elrepo-release-6-5.el6.elrepo.noarch

My kernel is 3.5, how do I install required dependancies?
Thanks in advance
I'm a linux newb, any help appreciated
PM
^
tux99
 Posted: Sep 2 2013, 10:59 PM
Quote Post


SLF Moderator
********

Group: Moderators
Posts: 1273
Member No.: 224
Joined: 28-May 11









I think one of the Elrepo maintainers (who are also members of this forum) would be most suited to answer this, but I think you won't be able to follow the above procedure when using an unofficial kernel as the ATi/Nvidia drivers from Elrepo only work with the official kernels (if I'm not mistaken).

--------------------
My personal SL6 repository, specialized in audio/video software: http://pkgrepo.linuxtech.net/el6/
(can be used together with EPEL and ELRepo repositories) - repository mirror: http://linuxsoft.cern.ch/linuxtech/el6/
PM
^
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll