Enable Hardware Acceleration for Video Playback in Fedora 39

image by EscanorRaito from reddit.com/r/wallpaper

This simple tutorial shows how to enable VAAPI hardware acceleration for playing videos in Fedora Linux 39.

Hardware Video Acceleration takes use graphics card for video encoding/decoding, thus offloading the CPU and saving power.

Due to licensing issue, Fedora does not support for hardware-accelerated video playback out-of-the-box. However, user can easily enable this feature by installing third-party media codecs, and here’ how to do the trick step by step.

Step 1: Add RPM Fusion repository

The popular RPM Fusion repository includes the full FFmpeg and hardware accelerated codec for all current Fedora, RHEL releases.

First, launch terminal by pressing Super (Windows logo) key, and searching from the overview screen (or from application menu depends on Desktop environment).

Open terminal

When it opens, run command to add the RPM Fusion free repository:

sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm

Also, run this command to install the non-free repository:

sudo dnf install https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

Step 2: Install the Hardware Accelerated Codec

For Intel (tested in my i5 5200u integrated graphics card), run command in terminal to install the driver:

sudo dnf install intel-media-driver

Then, you may verify VA-API info by running command:

vainfo

Run sudo dnf install libva-utils to install the package, if the command above not found.

For NVIDIA, the proprietary driver does NOT support VA-API. But, there’s a wrapper which can be installed by running command:

sudo dnf install nvidia-vaapi-driver

For AMD hardware, run command to switch Mesa-based VA-API drivers to the one from RPM Fusion repository:

sudo dnf swap mesa-va-drivers mesa-va-drivers-freeworld

Also switch the Mesa-based VDPAU drivers via command:

sudo dnf swap mesa-vdpau-drivers mesa-vdpau-drivers-freeworld

Step 3: Install Full FFmpeg library

Fedora ships with free variant of FFmpeg library, that does not work for me to enable va-api for MPV media player. In the case, just install the full functionality FFmpeg from RPM Fusion repository.

To do so, run command in terminal:

sudo dnf swap ffmpeg-free ffmpeg --allowerasing

Step 4: Install Additional Codec

After step 3, hardware video acceleration is working good in my case in both MPV and Firefox for supported video codec.

For choice, you may also run command to install the media codec for gstreamer based media players:

sudo dnf groupupdate multimedia

Step 5: Verify

If you use MPV media player for playing video files, then just start it from command line with:

mpv --hwdec=auto /path/to/video
Tips: Instead of typing /path/to/video file, drag'n'drop file into terminal also works.

The terminal should outputs something like “Using hardware decoding (vaapi or vaapi-copy).” if vaapi in use.

For Intel GPU:

  • run command to install the required package:
    sudo dnf install intel-gpu-tools
  • then run command below and check Video Engine in the terminal output, while video playback:
    sudo intel_gpu_top

For NVIDIA:

  • run command to install the monitoring tool:
    sudo dnf install nvtop
  • then start playing video and check “DEC” (decoder) by running command:
    nvtop

And for AMD GPU

  • run command to install the monitoring tool:
    sudo dnf install radeontop
  • then check while video playback by running command in terminal:
    radeontop

That’s all. Enjoy!

Hi, I'm Merilyn Ne, a computer geek working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.