If you're using a laptop you may be familiar with playing videos on Chrome or Chromium sucks the battery pretty quick.
Well, Google Chrome or Chromium are not video players, but they can play almost every video quite well.
And in case of watching youtube or other videos online, no one bothers to play that video with some other software that supports GPU accelerated video playback.
A laptop suffers most by this glitch in browsers, but even if you're on a desktop, you might want to take advantage of your GPU, let the GPU do what it deserved to do.
So, if you're planning to play youtube or other videos efficiently in Chromium browser, this tutorial is for you, let's get started ...
Contents
Show/Hide1. Why is this happening ?
It's simply because lack of proper H.264 decoding support in browsers, hardware accelerated video decoding is disabled in Chrome/Chromium for Linux.
There is another problem, most videos on youtube are encoded with VP9/VP8 codec, but older GPUs can't decode VP8 or VP9 at all, that could be fixed easily with the h264ify Chrome extension.
Though chrome://gpu URL says it can decode videos with GPU if Override software rendering list chrome flag is enabled, but actually it can't, more about this here.

Let's have a look at the chrome://flags URL for the Hardware-accelerated video decode flag. This feature is only available on Mac, Windows and Chrome OS, and there is no way to enable it with default Linux builds.

There is a workaround for this problem too, patch the source to enable chrome VAAPI support and rebuild, or use already patched Chromium builds, the second option is fairly easier.
2. Install Chromium Beta with hardware acceleration enabled
While patching chromium source and compiling it is the best choice for learning, but it's pretty impractical for most. Compiling Chromium from source also requires a descent hardware setup, you might want to check their official instruction.
So If you're running Ubuntu or Debian, why not use prebuilt Chromium Beta from Saikrishna Arcot's PPA ? Here the link to the PPA.
It's pretty simple to installing Chromium Beta with hardware acceleration enabled in Ubuntu,
sudo add-apt-repository ppa:saiarcot895/chromium-beta sudo apt-get update sudo apt-get install chromium-browser
You will also need proper GPU drivers for accelerated video decoding, for Intel GPUs install VA-API driver and relate shared libraries.
sudo apt-get install libva-glx1 libva-x11-1 i965-va-driver
Note: I was trying to use VDPAU for decoding videos with NVIDIA Optimus GPUs on Chromium, but that seems to be not possible at this moment.
3. Checking hardware accelerated video decoding capability
Now you can see the Hardware-accelerated video decode flag in enabled and it's available for Linux.

You can confirm that accelerated decoding is working by running a local or online 1080p video encoded with h.264, may be VP9 if your GPU supports decoding that, testing that on the chrome://media-internals URL, Example screenshot below,
Here yo can see video_decoder is GpuVideoDecoder , and the Video codec is avc.
Thoughts, Credits and Conclusion
No doubt that Saikrishna Arcot deserves a warm "thank you" for patching latest Chromium and maintaining the PPAs, excellent work, seriously !!!!
It would be a little better if the Saikrishna fixes the Chromium API key related problem, or completely disabling it.
Hope you all enjoyed this this tutorial, don't forget to share if you think it's helpful.
My Desktop PC:- Asus P5KC Intel Q6600 2.4GHz 4Gb RAM DDR3 Geforce GT1030 Lubuntu 64bit Geforce GT1030 driver version:- 390.12
Hi. I am using the right drivers from Linux Lubuntu CPU is 80% to 100% on YouTube 4K video
on YouTube playing on 4K @60fps very high CPU i tried h264ify still lag and very high CPU tried different Internet browser, for example chrome, Firefox, Opera still lag and very high CPU. tried patched chromium still lag very high CPU
i don't have this problem with windows 10 (64bit) on windows 10 64bit CPU usage is 10% or 20% to 30% on YouTube 4K video all web browsers work excellent on windows 10, only problem is Memory (RAM) on windows 10
so that's why i tried Linux Lubuntu
I don't think that VA-API is yet supported with Nvidia cards at least on Linux.
Yeah, Windows tends to perform much better in terms of video decoding on browsers, specially Edge browser.
FYI, the Chromium API key error message can be hidden with the parameters --disable-infobars
Unfortunately it doesn't seems to work anymore since version 65...
Checked it with a 1080p video, on youtube and from the file:// URL, VA-API decoding is working on Chromium 65.0.3298.3 , Developer Build.
Thank you very much.
Thanks very much for posting this. 1080p30 3mb/s High@L4.1 works great with GPU decoding on my Celeron N3000 which can barely handle 720p30 in software.
Unfortunately Widevine content is still not accelerated. Netflix does work in these builds of Chromium, assuming you change to a Chrome user agent, but rendering is performed in software, even after disabling the GPU whitelist.
I think VA-API is not smart enough to decode widevine encrypted streams.