Accelerated Video Playback: Difference between revisions
m Add an example for AMD iGPU. I'm adding it because I searched examples in the wiki and elsewhere and didn't find anything related to AMD. It was maybe too obvious but just one line of config is enough. |
"See also" section |
||
Line 76: | Line 76: | ||
This is based on the [https://wiki.archlinux.org/title/mpv#Hardware_video_acceleration Arch Linux mpv article]. | This is based on the [https://wiki.archlinux.org/title/mpv#Hardware_video_acceleration Arch Linux mpv article]. | ||
== | == Also see == | ||
* [https://wiki.archlinux.org/index.php/Hardware_video_acceleration Arch Linux wiki#Hardware video acceleration]. |
Revision as of 03:52, 8 April 2024
This page is meant to help with techniques for getting accelerated video playback working in NixOS. This is generally done via libva and vaapi (and sometimes vdpau).
This is done by adding relevant libva
-related packages to the hardware.opengl.extraPackages
option.
Additionally, the intel-vaapi-driver
(previously vaapiIntel
) package can be overridden to enable Intel's Hybrid Driver.
Intel users also can enable intel-media-driver
. It can be used at runtime with LIBVA_DRIVER_NAME=iHD mpv ...
for example, if you use Mic92's mpv settings below.
Sample Intel configuration:
{
...
nixpkgs.config.packageOverrides = pkgs: {
intel-vaapi-driver = pkgs.intel-vaapi-driver.override { enableHybridCodec = true; };
};
hardware.opengl = {
enable = true;
extraPackages = with pkgs; [
intel-media-driver # LIBVA_DRIVER_NAME=iHD
intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
libvdpau-va-gl
];
};
environment.sessionVariables = { LIBVA_DRIVER_NAME = "iHD"; }; # Force intel-media-driver
...
}
32 bit example:
hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ intel-vaapi-driver ];
AMD configuration (at least for Ryzen 5 iGPUs) works out of the box:
{
hardware.opengl.enable = true;
}
Prepared Hardware configuration
Sometimes different opengl packages are required to achieve full performance. You can check different configuration repositories for similar hardware configuration:
Testing your configuration
You can test your configuration by running: nix-shell -p libva-utils --run vainfo
See Hardware video acceleration: Verification (Arch Wiki) for more information.
Applications
Chromium
See Chromium.
Firefox
See Firefox#Hardware_video_acceleration (ArchWiki).
MPV
You can place the following configuration in ~/.config/mpv/mpv.conf
for mpv to use hardware acceleration for VP9 on Intel Broadwell (and probably later):
hwdec=auto-safe
vo=gpu
profile=gpu-hq
With Wayland, you need to nudge mpv to do the right thing:
gpu-context=wayland
This is based on the Arch Linux mpv article.