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 …
1. 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.