Enable Hardware Video Acceleration (VA-API) For Firefox in Ubuntu 20.04 / 18.04 & Higher

Last updated: February 13, 2024

This tutorial shows how to enable hardware video acceleration (VA-API) for Firefox, so it uses the video card to decode/encode video to save power.

Hardware video acceleration is a computer technology to make the graphics card to encode and decode video, thus offloading the CPU to save power. And compared to CPU, GPU are normally more efficient at the job.


There are a few ways to achieve this on Ubuntu Linux, including:

  • Video Acceleration API (VA-API) – an open source API developed by Intel.
  • Video Decode and Presentation API for Unix (VDPAU) – open source API developed by NVIDIA.
  • NVENC/NVDEC – NVIDIA’s proprietary API.

The VA-API supports Intel, AMD, and NVIDIA (via open-source Nouveau drivers) GPUs. And it is widely supported by software, such as MPV uses va-api hardware acceleration for video playback by default if available.

The VDPAU API supports both AMD and NVIDIA, but has no support in Firefox or Chromium. And while NVENC/NVDEC is used for NVIDIA GPU only, we usually use VA-API for hardware video acceleration.

Firefox pop-up video encoding/decoding via Intel GPU

Verify VA-API:

NOTE: VA-API does not work on NVIDIA via proprietary drivers as mentioned above. If you installed NVIDIA proprietary driver via ‘Additional Drivers’ utility, this will only work when you choose ‘Intel (Power Saving)’ mode in NVIDIA Prime settings.

The VA-API may work out-of-the-box in Ubuntu. You can firstly open terminal from start menu (click ‘Activities’ and search terminal).

Next install vainfo package via command:

sudo apt install vainfo

And run it to check VA-API info:


It outputs the driver as well as supported profile. VAEntrypointVLD means decoding support for this format, VAEntrypointEncSlice means encoding support.

If the command outputs an error, you can try to install drivers via command:

  • For NVIDIA nouveau and AMD, run command:
    sudo apt install mesa-va-drivers
  • For Gen 8+ Intel hardware, install via command:
    sudo apt install intel-media-va-driver

    And for old Intel hardware, install i965-va-driver instead via apt install command.

By setting the environment variable, you can choose which driver to use. For example, set “export LIBVA_DRIVER_NAME=i965” to use i965 driver. The value can also set to “nouveau” for NVIDIA, or “radeonsi” for AMDGPU.

Enable VA-API in Firefox:

Firefox added VA-API support since version 80, though it’s not enabled by default. You can enabled it manually by doing following steps one by one.

Firstly, open Firefox and go to about:config in url bar. Click on “Accept the Risk and Continue”. Then search for following keys, enable or disable them one by one:

  • media.ffmpeg.vaapi.enabled set to true
  • media.ffvpx.enabled set to false.
  • media.rdd-vpx.enabled set to false.
  • media.navigator.mediadatadecoder_vpx_enabled set to true.
  • If you experience page crashes, try setting security.sandbox.content.level to 0.

Secondly, set environment variable (for current user only). Open terminal and run command to edit profile file:

gedit ~/.profile

When file opens, add following lines to the end:

  • (Optional) Specify va-api driver as mentioned above (replace iHD accordingly):

    You can SKIP this if vainfo outputs without error!

  • Diable RDD sandbox:
  • For Xorg session, default in Ubuntu 18.04/Ubuntu 20.04:
    export MOZ_X11_EGL=1
  • For Wayland session, default in Ubuntu 21.04 & higher:

Finally, log out and back in. Open Firefox and play a video and see result!

Check if Hardware Video Acceleration working:

During video playback, you can use top command to see CPU usage before and after enable VA-API. For Intel GPU, there’s intel_gpu_top command that monitor it continuously.

Open terminal and run command to install the tool first:

sudo apt install intel-gpu-tools

Next, run command:

sudo intel_gpu_top

Start playing video in Firefox and you’ll see the video bar is busy (above 0%) if VA-API starts working.

For AMD GPU, there’s another command line tool “radeontop” available to monitor GPU activity.

NOTE for YouTube videos, the video codec may sometimes not supported by your hardware. To workaround, try h264ify or enhanced-h264ify extension to make YouTube stream H.264 videos instead of VP8/VP9.

That’s all. Enjoy!


I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee: https://ko-fi.com/ubuntuhandbook1

14 responses to Enable Hardware Video Acceleration (VA-API) For Firefox in Ubuntu 20.04 / 18.04 & Higher

  1. Hi,
    I checked it in Debian testing and didn’t work in my case and I think I did all the steps correctly.

    Maybe the Firefox version from Ubuntu and Debian is different. In Fact I have the latest version available downloaded directly from the website.


    • VA-API is ready and enabled by default in Chromium in Debian 11, but not tried in Debian testing. For Firefox, try launching it from terminal via MOZ_ENABLE_WAYLAND=1 variable since Debian defaults to Wayland session:

      MOZ_ENABLE_WAYLAND=1 firefox

      after you changed the keys in about:config dialog.

      • Hi, I use X11. Anyway I tried what you mentioned and in my case doesn’t work in Firefox using Debian.

        The Firefox version for Ubuntu maybe it’s slightly different. For instance mpv in Ubuntu the hardware acceleration use to work by default. In Debian you need to modify the config file or the command to launch mpv in order to get hardware acceleration.


  2. Hey. Thanks for this amazing guide! It worked for me. I just have one question. Does reducing the sandbox level to zero affect my security in any way? This question in giving me many sleepless nights lol.

    • Lower level value indicates a less restrictive sandbox. Reset the key (it’s 4 in my case) if you care about it. And keep the value if you don’t experience page crashes (see bug)

  3. I’m using Ubuntu 20.04.3 on X11, FF version 93.00 x64 and CPU is AMD 5300U with Renoir graphics. I did all the steps above but still I can’t get hardware decoding to work. I’m getting 85-90+ percent CPU usage on YouTube videos. I’ve also installed the h-264ify extension to no avail.

    • Same here with a bunch of Intel and NVidia laptops and PC, all running Mint, cannot make it to work even with the newest Firefox. I tried it for more than 1 year now, no success.

  4. God bless you dude!

    Works like charm.


    • Indeed!

      Even though the article suggested not to include “export MOZ_DISABLE_RDD_SANDBOX=1” and “export MOZ_X11_EGL=1” in ~/.profile if vainfo outputs without errors, I absolutely had to using Linux Mint 20.3 Cinnamon Edge (on Xorg session) with AMD Ryzen 5500u APU (AMD opensource driver).

      Now I finally get hardware acceleration on Linux Mint using Firefox!

  5. thank you so much, works on debian bookworms, firefox esr with a i985 intel gpu

  6. All works great, same situation as previous comment. Thanks so much.

  7. The intel-gpu-tools package is known as igt-gpu-tools in recent Fedora. You may need to run intel_gpu_top as root.

  8. media.ffvpx.enabled set to false.
    media.rdd-vpx.enabled set to false.
    explaining *why* those need be set to false wouldn’t have hurt