Having your software leverage hardware as much as possible is a good thing.
The same applies to video playback hardware acceleration, of course. Instead of using the CPU, the graphics card should be leveraged for the job.
Do you have an Intel integrated graphics card and CentOS/RHEL 8 system? Read on 🙂
Enable Required Repositories
First, ensure all required RPM repositories are set up on your system:
EPEL
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
On RHEL 8, it is recommended to also enable the codeready-builder-for-rhel-8-*-rpms
repository since EPEL packages may depend on packages from it:
sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-$(rpm -E %{_arch})-rpms"
On CentOS 8 it is recommended to also enable the PowerTools
repository since EPEL packages may depend on packages from it:
sudo dnf config-manager --set-enabled PowerTools
GetPageSpeed repo
sudo dnf -y install https://extras.getpagespeed.com/release-latest.rpm
RPM Fusion
Follow along configuration and set up both free
and nonfree
RPM repositories.
Install VLC
sudo dnf install vlc
Install VA-API implementation for Intel G45 and HD Graphics family
The VA-API implementation is basically an interface library that allows application with video playback to talk to an Intel GPU in order to provide hardware video acceleration.
So far, there’s been a few such implementations from Intel.
The “default” one is libva-intel-driver
, however, it is prone to stuttering while playing 4K videos.
In my experience, it also has playback problems after resuming from sleep.
If you have a relatively old Intel GPU, there’s nothing you can do other than using this buggy driver and hope for the best:
sudo dnf -y install libva-intel-driver
Alternatively, with a newer Intel CPU/GPU in mind, you can use the newer driver called intel-media-driver
.
This did not have the aforementioned issue with 4K playback:
sudo dnf -y install intel-media-driver
To ensure that the apps actually use it, add LIBVA_DRIVER_NAME=iHD
to /etc/environment
file.
Reboot to apply.
You can then check your selected VA-API interface by examining the output of vainfo
command (from libva-utils
package).
Confirm VA-API is working
Run vlc
on the command line to check:
vlc "https://youtu.be/6An_c0FOlew"
Output should include which VA-API implementation is in use, e.g. for libva-intel-driver
:
[00007f03b06656e0] avcodec decoder: Using Intel i965 driver for Intel(R) Coffee Lake – 2.1.0 for hardware decoding
or, for intel-media-driver
:
[00007fe52866d420] avcodec decoder: Using Intel iHD driver – 1.0.0 for hardware decoding
Hardware video acceleration in Chrome
Browser is another story. It needs to support the aforementioned VA-API interface. And the standard Chrome version doesn’t.
There is a project named chromium-freeworld
, which is basically a Chromium that integrates the necessary patches for supporting VA-API, and thus hardware acceleration!
So you can;
sudo dnf -y install chromium-freeworld
This will install the Chromium with VA-API support. To verify if video acceleration is supported, navigate to chrome://gpu
page. And you will see it say:
Video Decode: Hardware accelerated