DEV Community

Cover image for Enable video hardware acceleration in Firefox Flatpak, on Wayland
Archer Allstars
Archer Allstars

Posted on • Updated on

Enable video hardware acceleration in Firefox Flatpak, on Wayland

UPDATE: Firefox 115 enables VA-API hardware video decoding for Intel GPUs on Linux by default now.

I am not using Firefox anymore since they removed PWA support, which I use exclusively (even when I use Windows), in the browser, see Bugzilla Bug 1682593 and Bugzilla Bug 1407202. It seems many users also want this feature back in the browser as shown in their Mozilla Connect page as the #2 most popular idea. Unfortunately, Mozilla is not an organization that would usually listen to users' feedback. I doubt this will be changed in the future.

However, this is not today's topic. Then, why would you use Firefox? Currently, it's the only browser that fully supports video hardware acceleration on Linux. Chrome/Chromium on the other hand is still working on this and expects to push this out in v114 with --enable-features=VaapiVideoDecodeLinuxGL flag, see Chromium Issue 1325824.

And the worst part regarding Linux hardware video decode in Chrome/Chromium is that most of the fixes are only for X11, not Wayland. For Wayland, it seems to be no progress at all, see issue 1326754, or issue 1434896 which specifically says nobody available to fix and is labeled as helpwanted 🥲

Currently, there are many ways to install Firefox on Linux, installing from your distro's repo is the recommended method. But the repo's version is usually not updated quickly. That's why I would recommend the Flatpak version which's officially maintaining by Mozilla. But this version doesn't enable VA-API video decoding and also doesn't run on Wayland by default. Let's see how to enable them.

Enable VA-API video decoding in Firefox

Fixing 1

  1. Open Firefox, and enter about:config in the address bar to go to Firefox's config page.

  2. Search for vaapi and change media.ffmpeg.vaapi.enabled to true, as shown in the screenshot below:

    Enable VA-API

  3. Restart the browser. Now, video hardware acceleration through VA-API should work.

It's important to note that you should know your GPU well. If you're not using a very recent GPU, there's a high chance that your GPU won't support all the codecs on the web. For instance, my GPU is not supported AV1 that YouTube uses by default (it saves a lot of bandwidth). Therefore, I use enhanced-h264ify to filter out unsupported codecs.

Enable Wayland mode in Firefox

Fixing 2

  1. Download Flatseal. It's the most important tool to manage Flatpak apps permission using GUI.

  2. Disable X11 windowing system for Firefox, as shown in the screenshot below:

    Flatseal window

It's done!

I hope this helps, bye 💨

Cover Photo by Joel Holland on Unsplash

Fixing 1 Photo by Shane Aldendorff on Unsplash

Fixing 2 Photo by Alexander Andrews on Unsplash

Top comments (0)