Main menu:

Sponsoring

Please consider a small donation:

 

Also appreciated: support me by clicking the ads (costs nothing) :-)

 

Or you can donate bitcoin:

 

Thanks to TekLinks in Birmingham, AL, for providing colocation and bandwidth.

Page Rank

Fame

FOSS Force Best Blog--2013 Award

Recent posts

Recent comments

About this blog

I am Eric Hameleers, and this is where I think out loud.
More about me.

Search

My Favourites

Slackware

Calendar

July 2014
M T W T F S S
« Jun    
 123456
78910111213
14151617181920
21222324252627
28293031  

RSS Alien's Slackware packages

RSS Alien's unofficial KDE Slackware packages

RSS Alien's multilib packages

Meta

Decoding HD video in VLC

In past posts, I talked a bit about video decoding in VLC, particularly using the GPU (your graphics card’s processor) to decode frames instead of letting the software do all the work. My previous posts mostly revolved around the fact that this did not yet work in the release candidates of VLC 1.1.0 (which will hopefully be released soon).

There is good news however! Last weekend, the bug in VLC was fixed which made the player crash as soon as the VAAPI functions were called. My updated packages (32-bit and 64-bit) for vlc-1.1.0-rc3 are available now, with the patch included, and indeed I have no more crashes. Get those new RC3 packages and enjoy!

So, what is this GPU supported hardware decoding of video and why is it beneficial?

High Definition video has become a de facto standard on the internet, and lots of home video recorders save in HD format too. Playback of a HD video on your computer will stretch the limits of what your CPU can do… resulting in stuttering playback (dropped video frames) or display artefacts because the CPU can not keep up.

This is where the Video Acceleration API (VAAPI) originally drafted by Intel, and adopted by other hardware vendors (Nvidia and Ati of course) comes into play. VAAPI is a software interface which provides access to hardware accelerated video processing, using your computer’s  GPU which is very much suited for computationally intensive operations. For instance, owners of a Nvidia graphics card will notice that VAAPI-supported HD playback will drop the CPU usage from 100 to 30 or less percent.

My VLC package supports VAAPI hardware acceleration, if you add the following package(s):

  • libva: your computer will at least need this one. This is the library which exposes the VA API and adds the driver which VLC will use if your graphics card is an Intel one.
  • vdpau-video: this is only needed if your graphics card is an Nvidia. Vdpau is Nvidia’s own acceleration API and this package adds a VDPAU backend to libva.
  • xvba-video: this is only needed if you own an Ati-powered graphics card. This package adds a XvBA backend to libva. Unfortunately (for you) I do not own an Ati card, so I can not compile this software into a Slackware package. Get the sources here and compile them yourself, after you installed my libva package.

I should mention one caveat:

It depends on your hardware, how good the support for GPU-accelerated video processing is. An Intel card can only accelerate MPEG-2 video, whereas Nvidia and Ati cards will also support acceleration for MPEG-4/H.264/VC-1 video formats. Note that hardware-acceleration is not limited to HD video. VAAPI will for instance be beneficial to Atom-powered netbooks too, their Intel graphics will allow fluent full-screen playback of DVDs in VLC with low CPU usage, thereby saving your battery.

You can easily determine what your card’s capabilities are. After installing libva, run the “vainfo” command and examine the output. This is what my T410 laptop reports:

$ vainfo
libva: libva version 0.31.0-sds6
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib64/va/drivers/i965_drv_video.so
libva: va_openDriver() returns 0
vainfo: VA API version: 0.31
vainfo: Driver version: i965 Driver 0.1
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple            : VAEntrypointVLD
VAProfileMPEG2Main              : VAEntrypointVLD

Have fun! Eric

Comments

Comment from mlangdn
Posted: June 14, 2010 at 15:37

Thanks Eric!
This sure made a difference in dvd playback for me. I no longer hear the fans screaming during playback, and cpu usage is next to nothing.

Comment from Desiderius
Posted: June 14, 2010 at 16:03

Thanks Eric ! VLC RC3 WORKS WELL with libva and vdpau-video on my Nvidia equipped laptop.

Here is the output of vainfo on my laptop

libva: libva version 0.31.0-sds6
Xlib: extension “XFree86-DRI” missing on display “:0.0″.
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib64/va/drivers/nvidia_drv_video.so
libva: va_openDriver() returns 0
vainfo: VA API version: 0.31
vainfo: Driver version: Splitted-Desktop Systems VDPAU backend for VA API – 0.6.9
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264High : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD

Comment from dolphin77
Posted: June 15, 2010 at 07:31

Goededag, Eric.

Thanks again for keeping your good work.

A question to ATI geeks. I have integrated r600 based ATI GPU in my laptop. I tried the above procedure, but here is what i get:
vladimir@darkstar:~$ vainfo
libva: libva version 0.31.0-sds6
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib64/va/drivers/r600_drv_video.so
libva: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

The question is – as I understood the above xvba-video is for fglrx drivers. But I use opensource drivers. Could anyone direct me to similar opensource solution?

thank you.

Comment from alienbob
Posted: June 15, 2010 at 08:23

@dolphin77:
The XvBA backend driver unfortunately only works with the binary driver (fglrx). The same is true for the nvidia (vdpau) backend – that one also works exclusively with the binary driver.

Eric

Comment from dolphin77
Posted: June 15, 2010 at 10:42

Ok. thank you for explanations. I thought if vainfo looks for /usr/lib64/va/drivers/r600_drv_video.so, it should exist somewhere. But googling for the filename doesn’t help either.

Comment from Kenjiro
Posted: June 18, 2010 at 02:48

alien, on a side note, there is no need to compile xvba-video. You just have to download the ‘.tar.gz’ file, decompress it and then copy the contents of “decompressedfolder”/usr/lib/va/drivers to /usr/lib(your arch sufix here)/va/drivers/.

So, since I am running slackware64 I did:

cp -r xvba-video-0.6.11.x86_64# ls usr/lib64/va/drivers/* /usr/lib64/va/drivers

Thanks for this excelente post, alien.

Comment from valgors
Posted: June 18, 2010 at 19:29

Excuse me for stupid question but how to determine if vlc really uses GPU-acceleration? What video output module must be set in vlc? I have 8600GT, NVIDIA-Linux-x86-195.36.24 driver, vlc-1.1.0-rc4, libva and vdpau-video libs installed and I see no difference in CPU usage.

Comment from manciuleas
Posted: June 21, 2010 at 01:50

I have the same issue as valgors. I have a 9600 GT card, Nvidia 256.29 driver and alienbob’s libva, vdpau-video, vlc 1.1.0 rc4, ffmpeg-0.6 packages. I checked with cat /proc//maps and libva is not loaded neither by vlc nor by ffplay. With smplayer the CPU usage is 6-7% while with vlc it’s 40-60%.

Comment from valgors
Posted: June 21, 2010 at 12:25

I found the key of the problem :)
You just need to check one option:
Menu – Tools – Preferences – Input & Codecs Settings – Codecs – Use GPU acceleration (experimental)

Comment from alienbob
Posted: June 22, 2010 at 10:21

Well done valgors :-)
I had forgotten that I had been editing the .vlcrc file, manually enabling hardware acceleration before it was available as an option in the GUI..

Eric

Comment from hstun
Posted: June 22, 2010 at 18:55

Hi Alan,

Just a slight correction. Some intel graphic accelerators do support acceleration of vlc and .h264, not just mpeg-2. See: http://www.notebookcheck.net/Intel-Graphics-Media-Accelerator-HD.23065.0.html

“The DXVA Checker lists support for MPEG2 (VLD, IDCT, MoComp, A, C), H264 (VLD, MoComp, IDCT), WMV9 (MoComp, IDCT), and VC1 (MoComp, IDCT) in 72×480, 1280×720 and 1920×1080.”

Comment from hstun
Posted: June 22, 2010 at 18:56

whoops, i misread alien as alan :)

Comment from Ralph
Posted: June 24, 2010 at 00:46

Thanks for this post Eric!

There is also another dependency (at least, on Slackware 13.1): FFMpeg with VAPI enabled; otherwise, VLC does not allow to enable GPU acceleration.

Comment from alienbob
Posted: June 24, 2010 at 10:51

@Ralph:
An additional ffmpeg dependency would be very strange – because I built VLC with an internal ffmpeg library that has vaapi enabled.

I will check when I get back home.

Eric

Comment from Ralph
Posted: June 24, 2010 at 20:54

@Eric:

I had an old version 0.5 of FFMpeg. Compiling VLC 1.1.0 with that library I get the message: “LIBVA found but /usr/include/libavcodec/vaapi.h does not exist”; after the compilation I get a version of VLC with the “GPU acceleration” checkbox unchecked and grayed out.
Now I have installed FFMpeg 0.6 compiled with –enable-vdpau and VLC 1.1.0 recompiled with that library makes available the GPU acceleration.

Comment from alienbob
Posted: June 24, 2010 at 21:33

@Ralph – you did not tell the first time that you recompiled VLC in the presence of an already installed FFMPEG…
My package for VLC does not have that FFMPEG issue. I always build on a clean system. It is perfectly safe to use the pre-compiled package.

Eric

Pingback from Flash and Slackware – How to get every ounce of performance
Posted: February 24, 2012 at 02:59

[...] enable GPU video hardware acceleration that may help for those who nvidia cards that support this: http://alien.slackbook.org/blog/deco…-video-in-vlc/ I don't think this will help with a nvidia gforce 6200 [...]

Pingback from Vaapi Problem
Posted: January 22, 2013 at 02:59

[...] am not having much success with it. I followed the procedure in AlienBob's blog post for VLC here: http://alien.slackbook.org/blog/deco…-video-in-vlc/ I have fglrx, the proprietary ATI driver for my card, installed. I have installed libva once [...]

Comment from Multiple Transcoding
Posted: October 30, 2013 at 13:46

Hi,
This is really interesting take on the concept. I never thought of it that way. I came across this site . Any new version update for Multiple Transcoding ?

Write a comment