Closed murphym18 closed 1 year ago
It might be a good idea to include a short section that explains a little bit about how Linux supports hardware accelerated codecs. I'm not sure this is necessary, but I'm thinking it might be too jarring to jump directly into the how-tos. So here's a rough outline of what might be helpful:
Hardware-accelerated codecs allow for smoother video playback and reduced strain on your CPU by offloading video encoding and decoding tasks to your graphics hardware. Linux supports hardware-accelerated codecs through the Video Acceleration API (VA-API) (often pronounced as "vappy" (IPA: /ˈvæpi/) or "vah-appy" (IPA: /vɑː æpi/).). This is the most popular open-source API for hardware-accelerated video processing. One day in the future, we might all start using the Vulcan Video Extensions for all of our hardware accelerated video codecs. But for now, VAAPI is the most popular option.
VAAPI is supported by Intel and AMD (i)GPUs and ublue will install the necessary packages so you can get the most out of your hardware out-of-the-box.
For Nvidia graphics cards, there is no official support for VA-API. However, there is a community-made VAAPI driver for Nvidia called nvidia-vaapi-driver
. This adapts the VAAPI APIs to Nvidia's proprietary APIs. Nvidia also provides the NVIDIA Video Codec SDK. This SDK includes NVENC for video encoding and NVDEC for decoding. Some programs directly support this.
Overall, you likely want to offload encoding and decoding to the hardware that's been custom designed to process it. This makes it possible to enjoy smooth and efficient video playback while your computer uses less power and stays quieter.
Hardware-accelerated codecs offload the work of video encoding and decoding from the CPU to specialized hardware in your computer, such as your graphics card. This allows for smoother video playback and reduces the strain on your CPU, resulting in more efficient use of your system resources.
VA-API is an open-source API for hardware-accelerated video processing that is widely used in Linux. It provides a standard interface for applications to access the video encoding and decoding capabilities of the graphics hardware. VA-API is supported by Intel and AMD (i)GPUs and ublue includes the necessary packages to use it out-of-the-box.
For Nvidia graphics cards, there is no official support for VA-API. However, there is a community-made VAAPI driver for Nvidia called nvidia-vaapi-driver
. It adapts the VAAPI APIs to Nvidia's proprietary APIs, enabling VA-API support for Nvidia graphics cards. Nvidia also provides the NVIDIA Video Codec SDK, which includes NVENC for video encoding and NVDEC for decoding. Some programs directly support this.
Although VA-API is the most popular open-source API for hardware-accelerated video processing, there are other options available, like The Vulcan Video Extensions, Video Decode and Presentation API for Unix (VDPAU), and oneVPL. Vulcan may become a popular option in the future because it's designed to provide a cross-platform standard for hardware-accelerated video processing. It may offer improved performance and compatibility compared to existing APIs.
The ublue project installs the packages needed for hardware-accelerated codecs. And we need a page to guide people through some of the details.
Here's a super rough draft with some ideas:
How to configure the Firefox flatpak to use hardware-accelerated codecs
The Firefox package provided by default can already do this. But the Firefox flatpak requires a small configuration change.
To enable hardware accelerated codecs in the flatpak of firefox provided by flathub as of 2023-04-02:
flatpak run org.mozilla.firefox
about:config
in the address bar.media.ffmpeg.vaapi.enable
.Check if firefox is using codec hardware
You can check if hardware-accelerated codecs are working in Firefox by doing the following:
about:support
and press Enter.HW
listed next to some codecs. For exampleHow to Install the ffmpeg-full Flatpak Runtime
If you're using flatpaks and want to ensure that your codecs are hardware-accelerated, you may want to install the
org.freedesktop.Platform.ffmpeg-full
runtime. This runtime enables flatpaks to use hardware-accelerated codecs. You may or may not need to do this because some flatpaks support this runtime but do not specify it as a dependency. If you're running a flatpak and you want to be sure, it's safe to just install this. This section will show you how to install theorg.freedesktop.Platform.ffmpeg-full
runtime on your system.In a terminal, enter:
This command will ask you which version of the runtime you want to install. It's usually fine to pick the newest version, and you can install more than one version if needed. Once you've made your selection, the runtime will be downloaded and installed on your system.
To verify that the ffmpeg-full runtime has been installed correctly, you can run the following command in the terminal:
This command should return the version(s) of the runtime that you installed.