Hardware-accelerated video playback in Fedora Silverblue 38

Screenshot showing a YouTube video playing in (system-installed) Firefox on Fedora 38 Silverblue.
The video shown is by Voidbrand about the classic game "Crusader: No Remorse". On YouTube.

More recently, Fedora removed support for hardware-accelerated playback of H.264 and H.265 content. This was done due to the need to avoid licensing complications (and costs) that surround these codecs. While understandable, this is less desirable to those using Fedora and wanting smooth video playback, especially on more limited hardware.

Option one: Flatpak Firefox

If you are not dependent on any extension that does not work with a Flatpak-installed Firefox installation (ie. 1Password), this might be the very best route to take as it's very easy to get up and running. Simply install Firefox through the Software application, or through the command line:

❯ flatpak install org.mozilla.firefox

Or if you prefer to specifically install the version provided by Flathub:

❯ flatpak install flathub org.mozilla.firefox

That's it, you'll now have Firefox with proper hardware acceleration support. If you'd like to remove the system-installed version, you can do this with an override like so:

❯ sudo rpm-ostree override remove firefox

Option two: OpenH264

One way to get back (somewhat limited) H.264 video playback functionality is by installing the mozilla-openh264 package, available from the fedora-cisco-openh264 repository. For the use of this codec Cisco is footing the bill to take care of the legal side of things, and it only adds support for H.264 video playback in Firefox, it does not enable hardware accelerated H.264 video playback system-wide.

The  fedora-cisco-openh264 repository is included with Fedora, but disabled by default. We'll have to enable it first by editing /etc/yum.repos.d/fedora-cisco-openh264.repo using your favorite text editor, and setting enabled=1.

Once this is done, you can install it like so:

❯ sudo rpm-ostree install mozilla-openh264 gstreamer1-plugin-openh264

Reboot once done. Then, open Firefox and enable the "OpenH264" plugin.

That should be it. Give it a try and see how that works.

Option three: Install full ffmpeg

If the above is not adequate for your needs, or if you just want to enjoy the full functionality offered by ffmpeg, we can replace the ffmpeg-free variant Fedora ships with these days with the full one provided by RPM Fusion.

If you've not done so already, please check out my RPM Fusion installation guide on how to install RPM Fusion in a way that works alongside future Fedora Silverblue releases.

Install RPM Fusion that automatically stays up-to-date alongside future Fedora Silverblue releases
I’d like to show a slightly Inception looking way you can install RPM Fusion in a way that you don’t have to worry about needing to remove-and-reinstall it with every Fedora update. The issue lies with the “normal” method of installing RPM Fusion being specific to the currently installed version

Installing ffmpeg and mesa-va-drivers-freeworld

Alright, back to ffmpeg. We need to remove some included base packages and replace these with ffmpeg. In order to dot his, we'll need to rely on rpm-ostree's override functionality, like so:

❯ sudo rpm-ostree override remove mesa-va-drivers libavcodec-free libavfilter-free libavformat-free libavutil-free libpostproc-free libswresample-free libswscale-free --install ffmpeg --install mesa-va-drivers-freeworld

Reboot, and you should now be able to to enjoy fully hardware accelerated video in Firefox and other system-installed applications that may support it.

Closing thoughts

It'd certainly be nice if we didn't have to jump through these hoops to get hardware accelerated video playback working (again), but the real issue lies with these codecs that basically became the defacto standard codecs on the internet being so patent encumbered. We collectively should've never jumped on the H.264 bandwagon the way we did.

But, at the time it offered all kinds of interesting benefits over the open alternatives available at the time. Or at least that that's what the big companies building GPUs and web browsers thought.

These days our hope is aimed directly at AV1, a codec that seems to offer even greater compression, playback quality and more, all while not being patent encumbered.

But until the day comes bigger players like YouTube adopt this codec, our options as end-users are more limited. Fortunately we have a few options available to us, so it's not all bad.

I hope this helps.