On May 2011 Intel released G45/GM45 h264 VA-API in their g45-h264 branch. More then one year later they still didn’t merge it to master and no one touched that code in the meantime.
Fortunately if you tweak your system a bit that code is good enough to play a 1080p video with a generous bitrate, unfortunately it will not work out of the box.
After putting the vaapi use flag in your /etc/make.conf you will need to modify the x11-libs/libva-9999 and x11-libs/libva-intel-driver-9999 ebuilds to checkout from the g45-h264 branch instead of master. Of course if you use the ebuilds from my overlay you will have to do nothing.
Then you will have to emerge a player which takes advantage of vaapi, you have three alternatives:
- VLC: the media-video/vlc ebuild in gentoo already supports vaapi, unfortunately I didn’t get good performances with vlc so I discourage using it. I didn’t waste lot of time trying to tweak it anyway because I don’t like vlc too much.
- media-plugins/gst-plugins-vaapi and your favorite gstreamer player (for example kde-base/dragonplayer if you use KDE). Unfortunately gst-plugins-vaapi isn’t in portage, you can find it the openoffice-geki overlay but it is broken so I suggest you to use the one in my overlay. Also you will need media-libs/gstreamer-0.10.36, gst-plugins-bad-0.10.23 and gst-plugins-* 0.10.36, they aren’t in portage of course so I suggest you to do a version bump or using the ebuilds in my overlay. Unfortunately gst-plugins-vaapi is currently broken with G45/GM45 so you should skip to the next alternative until it gets fixed. EDIT: it works now https://bugs.freedesktop.org/show_bug.cgi?id=50390
- media-video/mplayer with the SMPlayer frontend.
There isn’t any mplayer ebuild with vaapi support, so I suggest you to take it from my overlay. I made the ebuild using the latest git snapshot of mplayer-vappi. You can find a live ebuild of media-video/smplayer in the multimedia overlay.
You can check if everything works as expected with:
mplayer -vo vaapi -va vaapi file.mkv
but you will seriously need some tweaks until it gets usable.
- First of all you will have to disable the desktop compositing, you can temporarily do it with ALT+SHIT+F12 if you use kde.
- Then you will have to disable SwapbuffersWait:
# cat << EOF >> /usr/share/X11/xorg.conf.d/99-intel.conf
Option “SwapbuffersWait” “off”
- In SMPlayer go to Options –> Preferences and in the General section disable Screenshots. In the video tab select vaapi as Output driver. If you use pulseaudio or jack set it in the audio tab. In the Performance section disable Frame drop and set Threads to 1. Go to the Advanced section and then in the Options for mplayer tab, add -va vaapi in Options. If you have IPv6 connectivity set IPv6 in the Network tab.
Done, you can finally enjoy hardware accelerated VA-API video decoding. With vaapi I can even watch 1080p videos while emerging @world with my 1.4GHz cpu
Edit: I forgot to say you should not use SNA (Sandy Bridge New Acceleration) because VA-API becomes slower. (FIXED)
Anyway you will probably want to emerge mplayer2 and smplayer2 too, so if you want to use the cpu instead of the gpu to decode a particular video you will be able to do it without having to unset smplayer. If you have a slow cpu I suggest using:
mplayer2 -vc ffh264 -lavdopts threads=4:fast:skiploopfilter=all -vo gl file.mkv