How to correctly enable/test VA-API on Intel Sandy Bridge?

libva-intel-vaapi-driver Install libva-intel-vaapi-driver vainfo Install vainfo

Then run vainfo to check if you see the entry points for some profiles:

[...]
vainfo: Supported profile and entrypoints
    VAProfileMPEG2Simple            : VAEntrypointVLD
    [...]

For all GStreamer-based video players, this package should be sufficient: gstreamer0.10-vaapi Install gstreamer0.10-vaapi. If I'm correct most standard video players like Totem are GStreamer based.

VLC is a different story, but it's being built with the --enable-libva build flag in Ubuntu (as shown by the apt-get source vlc). This means it should just work by enabling it in the configuration:

enter image description here

Or, manually, on the command line:

vlc --ffmpeg-hw -v
[...]
libva: VA-API version 0.32.0
[0x7feeecc02a28] avcodec decoder: Using VA API version 0.32 for hardware decoding.

  1. Decoding:
    sudo apt-get install i965-va-driver libva-intel-vaapi- driver vainfo
    
    Then setup vlc to use hardware decoding, run it from the command line (to get the debug messsages) and open am .mp4 file. You should see:
    [0x1781058] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
    libva info: VA-API version 0.35.0
    libva info: va_getDriverName() returns 0
    libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
    libva info: Found init function __vaDriverInit_0_35
    libva info: va_openDriver() returns 0
    [0x7fd825a569a8] avcodec decoder: Using VA API version 0.35 for **hardware decoding**.*
    
  2. Encoding: Install Gstreamer, libgstremaer-vaapi1.x, i965-va-driver; The following command will launch a gstremaer filter graph which takes input from your web camera (/dev/video0) then encodes and muxes into test2.mp4 file:
    gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1800 ! video/x-raw,format= I420,width=640,height=480 ! vaapipostproc ! queue ! vaapiencode_h264 ! qtmux ! filesink location=test2.mp4
    
    It will fail if you don't have hardware encoding support for your sandy bridge graphics (HD 2000/3000 GPU). Note it fails for me (Core i7, HD3000 graphics) and according Intel it shouldn't, because HD2000/3000 supports H.264 HW encoding....

Just a quicknote on Totem : it's not possible to use the gstreamer-vaapi right now for Totem as it use a special GTK widget which does not interface with gstreamer like a classic player. the team is working on it.