Do you like playing videos in your web browser? Well, good news, the Chromium web browser available in Fedora gets a Video Acceleration API support. That makes video playback much smoother while using significantly less resources.
A little bit of history
Chromium with a VAAPI patch was already available on other distributions. But this was not the case with Fedora. I really want hardware acceleration. But my love for Fedora was holding me back. Then with sheer willpower, I joined Fedora and started maintaining a package in COPR.
I am not really a distro hopper but a DE hopper. I usually jump from Gnome to KDE and vice versa depending upon my mood. Then I started maintaining Chromium with vaapi patch on COPR. I was using the official patch which was submitted upstream for code review. I had very little hope that it will get merge. The patch is outdated and and try jobs were failing at that time.
After six months, the Chromium upstream maintainers made a statement that they are not interested to include this patch. So after that I started working on my own patch with referenced from the official patch. My patch is about using the existing flags that other operating system uses instead of creating a new flag just for experimentation.
Effects of the VAAPI patch
Chromium with this patch was extremely stable on both of my machines. They both have AMD GPU. The video playback is smooth. This improved overall power savings as well.
As you can see, chromium with the vaapi patch takes up significantly less resources in comparison to chromium without the patch and Firefox. The CPU usage went down from 120% to 10%. The playback is smooth with no shuttering.
VA-API patch in chromium for Fedora
It was then Fedora’s former Engineering Manager @ Red Hat and Chromium maintainer, Tom Callaway, finally recognises the VAAPI patch and decides to include in Fedora’s Chromium browser. Fedora becomes the second distribution to include the VAAPI patch in their official Chromium package.
Thanks for your work! Nice to hear that Fedora’s Chromium browser now includes the VAAPI patch.
I am left wondering how you get Chromium to play h264 content. The Chromium package in the Fedora repo is not compiled with that codec, however in your screenshot you are clearly using it.
Is there a way to install the codec separately to get it to work without recompiling Chromium? I really want to try it, however without content hardware decoding’s potential is largely lost.
There is a plugin called chromium-libs-media-freeworld. For that you have to get it from a separate third party repository called RPMFusion. In case of my build, I have compiled with all possible codecs but due to legal limitations Fedora actually doesn’t allows that.
However if you have Intel Skylake or similar, you also get VP9 acceleration as well.
Honestly I am also hoping to get hardware accelerated aom support in the future.
Thanks for the chromium-libs-media-freeworld tip, that worked!
I have Intel Skylake, however neither VP9 nor H264 hardware acceleration worked with Chromium(-vaapi). The flags are set the same as yours and chrome://gpu states that hardware acceleration is on, however gpu://media-internals states that FFmpegVideoDecoder is used for h264 and VpxVideoDecoder is used for vp9.
I cannot figure out what the problem is. I guess I will stay with software decoding for the foreseeable future.
Are you running on Wayland session by any chance? Do you have libva intel driver installed?
The libva intel driver was already installed. It was indeed the Wayland session, I can confirm that it does indeed work in X.
This makes me wonder if it’s possible to do hangouts. How hard would it be to get video chat with Facebook massager on Fedora?
thanks, and congratulations
Fedora ist one of the few distros that uses Wayland by Default.
In the past there have been many issues with vaapi and Wayland especially with chromium.
Do you know the current state of affairs?
AMD plays very well under Wayland(Xwayland) since it has DRI3 support. Intel driver doesn’t actually supports that. There was a PR for enabling DRI3 but it has been closed due to inactivity.
As for as Wayland support in Chromium is concerned, we are still too far from it.
There’s a typo in a title “VAPPI in Fedora”.
Did you have to install some driver for va-api out for Fedora repository?
Yes I saw that and the typo has been fixed. 🙂
For AMD, you don’t have to do anything. For Intel, unfortunately you need a driver out of Fedora repository(libva-intel-driver/intel-media-driver).
Good work. I use a ppa in Ubuntu to enable hardware decoding (https://launchpad.net/~saiarcot895/+archive/ubuntu/chromium-beta), and it’s completely stable (on a laptop with intel hardware). Plus I use it on an Intel NUC, where the advantages of hardware decoding are really clear. Works great there too. And for you, it works well on AMD. It’s very disappointing that upstream is ignoring this work.
Fedora is a very influential distribution and this decision may trigger the Chromium devs to be more flexible. It will probably cause Ubuntu to have a look too, and Firefox may take this seriously at last. So I see lot of good things happening because of your efforts.
Thank you for your kind words 🙂 There has been some activity regarding enabling VA-API support in upstream recently.
im pretty new to the scence and build chromium out of source with h264 support just a few days ago.
Is there a way (for a newbie) to include your work ontop of the source and build it myself? i didnt found anything like that.
I dont think the gn argument
is all i need ?
Thank you for your work!!!!!
Does it work with AMD graphics on Wayland?
Yes. But you have to specify the driver name using the env variable “LIBVA_DRIVER_NAME” explicitly.
What’s missing to also take advatange of hardware decoding in firefox?
Hardware accelerated composting and a vaapi decoder.
Is VA API driver utilized normally on wayland session through XWayland? Thanks for any replies 🙂 VA API is really crucial for my ultrabook, but under Xorg the desktop performance is horrible.
Thanks to the contributors. The only things missing are hw decoding on Wayland for Intel chips, and it seems there is no possibility to get widevine working with chromium ?
Looks like chromium uses a wrong widevine patch. Will fix it.
Hello, thanks for the article and comments!
I have Lenovo T460s with intel 520 gpu, fedora 28 plasma.
I have installed chromium 71 and got the new chrome://flags stuff
I have installed libva-intel-driver
I have installed the chromium-libs-media-freeworld
In chromium media-internals I still see VpxVideoDecoder and not GPU.
Any help will be appreciated 🙂
Please check what video codecs/profiles are supported in “Video Acceleration Information” section in chrome://gpu
Also Intel libva driver doesn’t work on Wayland(yet)
It support also older AMD GPU? Like HD5850/6950?
Testing Chromium dev in PPA for Ubuntu and working fine with vaapi but now in Fedora I still see ffmpeg decoder and not a gpuvideodecoder.
Any suggestion? Or maybe old AMD Gpu not supported?
It is supported. Please check if it is running on a wayland session for that you have to set an environment variable “LIBVA_DRIVER_NAME”.
Not so interesting?
I could try it in a Fedora 28, Kde, Xorg. The lower CPU usage is there, but battery is not so happy : I left playing a 720p movie in http://arte.tv for 5 minutes with chromium-vaapi and firefox.
Result, upower tells me this energy rate :
– 6,44W for chromium
– 6,32W for firefox
– 2,6W idle
(Looks like Fedora Magazine doesn’t like sharing imdb links in comments, but anyway.)
In my case:
chromium-vaapi: 11.79 W
Firefox: 17.58 W
Both playing the same video and same format.
Good article, except for one thing. You failed to explain how to install the patch.
I tried this but still see ~200% CPU usage when playing h264 video. Skylake laptop running Fedora 29, Xorg, chromium-71.0.3578.98-1.fc29.x86_64, intel-media-driver-18.3.0-2.fc29.x86_64, libva-intel-driver-2.2.0-3.fc29.x86_64. chrom://gpu says under Graphics Feature Status, Video Decode: Hardware accelerated. But it’s still using the same amount of CPU as Firefox and Chrome.
You should start a video and go to chrome://media-internals in another tab. There you can click on the video that is playing and it will either say GpuDecoder or FFmpegdecoder.
The chrome://gpu tab only states if your browser is capable of using it, not actually if it is being used.
Finally, make sure that you are testing in X and not in Wayland.
I see the problem. Search results for some H.264 videos in fact aren’t, and media-internal shows them as VP9, and VP9 videos use VpxVideoDecoder, and H.264 videos use GpuVideoDecoder.
Then it is highly likely that your hardware does not support hardware acceleration for VP9. As mentioned in the comments above only pretty recent GPUs support VP9.
YouTube wil almost always send VP9 content as it is their default format, however you can force YouTube to send h264 video with the add-on h264ify.
The only downside to this I have found so far is that YouTube only keeps video up to 1080p in the h264 format. So if you have a 1080p screen or don’t mind video to be 1080p, then you can use that extension.
Booting Windows 10 and using Chromium, chrome://media-internals confirms that it too uses VpxVideoDecoder for VP9 videos, however Chromium itself uses ~7% CPU with total CPU (all processes) usage at 11% and the laptop remains cool. So I’m guessing the Chromium VpxVideoDecoder must somehow be leveraging hardware acceleration via Windows 10; VP9 videos on Linux whether Firefox, Chrome, Chromium are ~150% CPU for the top process, with a few more, including gnome-shell itself, using 15+% each, totalling ~200%, laptop is warm and fans run at a moderate speed.
No matter what i do, i can’t get the gpu decoder to kick in. Here is some info about the system http://paste.openstack.org/show/744338/ I am running Xorg.
3887 6.3 0.3 327400 62868 tty2 Sl+ 14:00 1:52 _ /usr/libexec/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -background none -noreset -keeptty -verbose 3
chrome://media-internals always says
I was able to get the gpuVideoDecoder by launching chromium as
Any idea how to get chromium working with gpudecoder without having to launch it from terminal?