Accelerated Video Playback/en: Difference between revisions
Updating to match new version of source page |
Updating to match new version of source page |
||
| Line 3: | Line 3: | ||
== Installation == | == Installation == | ||
=== Intel === | === Intel === | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
{ | |||
pkgs, | |||
... | |||
}: | |||
{ | { | ||
hardware.graphics = { | hardware.graphics = { | ||
| Line 13: | Line 20: | ||
]; | ]; | ||
}; | }; | ||
environment.sessionVariables = { LIBVA_DRIVER_NAME = "iHD"; }; # Optionally, set the environment variable | environment.sessionVariables = { | ||
LIBVA_DRIVER_NAME = "iHD"; | |||
}; # Optionally, set the environment variable | |||
} | } | ||
</nowiki>}} | </nowiki>}} | ||
Note, <code>intel-vaapi-driver</code> still performs better for browsers (gecko/chromium based) on newer Skylake (2015) processors.<ref>https://github.com/intel/media-driver/issues/1024</ref> | Note, <code>intel-vaapi-driver</code> still performs better for browsers (gecko/chromium based) on newer Skylake (2015) processors.<ref>https://github.com/intel/media-driver/issues/1024</ref> | ||
For 32-bit support, use {{nixos:option|hardware.graphics.extraPackages32}}: | For 32-bit support, use {{nixos:option|hardware.graphics.extraPackages32}}: | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
{ | |||
pkgs, | |||
... | |||
}: | |||
{ | { | ||
hardware.graphics.extraPackages32 = with pkgs.pkgsi686Linux; [ intel-vaapi-driver ]; | hardware.graphics.extraPackages32 = with pkgs.pkgsi686Linux; [ intel-vaapi-driver ]; | ||
} | } | ||
</nowiki>}} | </nowiki>}} | ||
=== AMD === | === AMD === | ||
AMD configuration (at least for Ryzen 5 iGPUs) works out of the box: | AMD configuration (at least for Ryzen 5 iGPUs) works out of the box: | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
{ | { | ||
| Line 41: | Line 58: | ||
Users with only an NVIDIA GPU can attempt to use the third party implementation; the package is added to <code>hardware.graphics.extraPackages</code> by default, but it requires some additional setup to be useful<ref>https://github.com/elFarto/nvidia-vaapi-driver#configuration</ref>: | Users with only an NVIDIA GPU can attempt to use the third party implementation; the package is added to <code>hardware.graphics.extraPackages</code> by default, but it requires some additional setup to be useful<ref>https://github.com/elFarto/nvidia-vaapi-driver#configuration</ref>: | ||
{{file| | {{file|3=<nowiki> | ||
{ config, lib, ...}: { | { | ||
environment.variables.LIBVA_DRIVER_NAME = "nvidia" | config, | ||
lib, | |||
... | |||
}: | |||
{ | |||
environment.variables.LIBVA_DRIVER_NAME = "nvidia"; | |||
# If used with Firefox | # If used with Firefox | ||
environment.variables.MOZ_DISABLE_RDD_SANDBOX = "1"; | environment.variables.MOZ_DISABLE_RDD_SANDBOX = "1"; | ||
programs.firefox.preferences = let | programs.firefox.preferences = | ||
let | |||
ffVersion = config.programs.firefox.package.version; | |||
in | |||
{ | |||
"media.ffmpeg.vaapi.enabled" = lib.versionOlder ffVersion "137.0.0"; | |||
"media.hardware-video-decoding.force-enabled" = lib.versionAtLeast ffVersion "137.0.0"; | |||
"media.rdd-ffmpeg.enabled" = lib.versionOlder ffVersion "97.0.0"; | |||
"gfx.x11-egl.force-enabled" = true; | |||
"widget.dmabuf.force-enabled" = true; | |||
# Set this to true if your GPU supports AV1. | |||
# | |||
# This can be determined by reading the output of the | |||
# `vainfo` command, after the driver is enabled with | |||
# the environment variable. | |||
"media.av1.enabled" = false; | |||
}; | |||
} | } | ||
</nowiki>}} | </nowiki>|name=/etc/nixos/configuration.nix|lang=nix}} | ||
== Testing your configuration == | == Testing your configuration == | ||
You can test your configuration by running: <code>nix-shell -p libva-utils --run vainfo</code> | You can test your configuration by running: <code>nix-shell -p libva-utils --run vainfo</code> | ||
See [https://wiki.archlinux.org/index.php/Hardware_video_acceleration#Verification Arch Linux wiki#Hardware video acceleration] for more information. | See [https://wiki.archlinux.org/index.php/Hardware_video_acceleration#Verification Arch Linux wiki#Hardware video acceleration] for more information. | ||
== Applications == | == Applications == | ||
=== Chromium === | === Chromium === | ||
See [[Chromium#Accelerated_video_playback]]. | See [[Chromium#Accelerated_video_playback]]. | ||
=== Firefox === | === Firefox === | ||
See [https://wiki.archlinux.org/index.php/Firefox#Hardware_video_acceleration Arch Linux wiki#Firefox]. | See [https://wiki.archlinux.org/index.php/Firefox#Hardware_video_acceleration Arch Linux wiki#Firefox]. | ||
=== MPV === | === MPV === | ||
You can place the following configuration in {{ic|~/.config/mpv/mpv.conf}}: | You can place the following configuration in {{ic|~/.config/mpv/mpv.conf}}: | ||
<syntaxHighlight lang=ini> | <syntaxHighlight lang=ini> | ||
hwdec=auto | hwdec=auto | ||
</syntaxHighlight> | </syntaxHighlight> | ||
See [https://wiki.archlinux.org/title/mpv#Hardware_video_acceleration Arch Linux wiki#mpv]. | See [https://wiki.archlinux.org/title/mpv#Hardware_video_acceleration Arch Linux wiki#mpv]. | ||
== Also see == | == Also see == | ||
* [https://wiki.archlinux.org/index.php/Hardware_video_acceleration Arch Linux wiki#Hardware video acceleration]. | * [https://wiki.archlinux.org/index.php/Hardware_video_acceleration Arch Linux wiki#Hardware video acceleration]. | ||
* [https://wiki.gentoo.org/wiki/VAAPI Gentoo Wiki#VAAPI.] | |||
* [https://github.com/NixOS/nixos-hardware nixos-hardware] has example configurations for various types of hardware. | * [https://github.com/NixOS/nixos-hardware nixos-hardware] has example configurations for various types of hardware. | ||
[[Category:Video]] | [[Category:Video]] | ||