Fix poor Firefox performance when playing video on Linux

Disable Hardware Acceleration or install nvidia-vaapi-driver.

Fix poor Firefox performance when playing video on Linux

If you're experiencing poor YouTube video playback performance in Firefox, Floorp, LibreWolf, or another Firefox-based browser on Linux and you're using an NVIDIA GPU, this might help you.

If you want a super easy solution, you can disable hardware acceleration in your Firefox settings. This will reduce performance overall, but modern computers should still run Firefox at high speed on most sites.

If you need hardware acceleration, nvidia-vaapi-driver is an open-source VA-API implementation using NVIDIA's NVENC. It is specifically designed to be used by Firefox for accelerated decode of web content.

Open your software manager and install nvidia-vaapi-driver. If you're using Debian, Ubuntu, Mint, Zorin, or another APT-based distro, you can also install using this command:

sudo apt install nvidia-vaapi-driver

You'll also need to configure some advanced properties inside of your browser. In the omnibar where you typically see the URL, type about:config and press Enter. Using the search bar, find the following options and double-click to toggle their values, if necessary:

  • media.ffmpeg.vaapi.enabled - true
  • media.hardware-video-decoding.force-enabled - true
  • media.rdd-ffmpeg.enabled - true
  • gfx.x11-egl.force-enabled - true
  • widget.dmabuf.force-enabled - true

If your GPU doesn't support AV1, you need to set media.av1.enabled to false. If you have a GPU that starts with 20XX or higher, you should have AV1 decoding support and you don't need to change anything.

Finally, restart your computer. Your browser should now handle video playback smoothly.