Enable video hardware acceleration in Firefox Flatpak, on Wayland
Tags: linux, beginners, productivity, opensource
Published: 2023-04-04 20:24:22

> **UPDATE:** **[Firefox 115](https://www.mozilla.org/en-US/firefox/115.0/releasenotes/)** 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](https://bugzilla.mozilla.org/show_bug.cgi?id=1682593)** and **[Bugzilla Bug 1407202](https://bugzilla.mozilla.org/show_bug.cgi?id=1407202)**. It seems many users also want this feature back in the browser as shown in their **[Mozilla Connect page](https://connect.mozilla.org/t5/ideas/bring-back-pwa-progressive-web-apps/idi-p/35)** 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](https://bugs.chromium.org/p/chromium/issues/detail?id=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](https://bugs.chromium.org/p/chromium/issues/detail?id=1326754&q=vaapi)**, or **[issue 1434896](https://bugs.chromium.org/p/chromium/issues/detail?id=1434896&q=decode%20linux&can=2)** which specifically says _nobody available to fix_ and is labeled as **helpwanted** 🥲

Currently, there are many ways to **[install Firefox on Linux](https://support.mozilla.org/en-US/kb/install-firefox-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](https://flathub.org/apps/details/org.mozilla.firefox)** 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ewwry2t9450zq4n5epx.jpg)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7uke4u13rqjrejyflhzn.png)

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](https://github.com/alextrv/enhanced-h264ify)** to filter out unsupported codecs.

---

## Enable Wayland mode in Firefox

![Fixing 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l2t73cx7gtw1kf7fedlf.jpg)

1. Download **[Flatseal](https://flathub.org/apps/details/com.github.tchx84.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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h0i1a9k8uajruwyd72kn.png)

It's done!

---

I hope this helps, bye 💨

---

**Cover** Photo by **[Joel Holland](https://unsplash.com/@joelholland?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)** on **[Unsplash](https://unsplash.com/photos/YTFcqSn7zQk?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)**

**Fixing 1** Photo by **[Shane Aldendorff](https://unsplash.com/pt-br/@pluyar?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)** on **[Unsplash](https://unsplash.com/photos/mQHEgroKw2k?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)**

**Fixing 2** Photo by **[Alexander Andrews](https://unsplash.com/ko/@alex_andrews?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)** on **[Unsplash](https://unsplash.com/photos/rt6QV85-AIE?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)**