Accelerated Video Playback: Difference between revisions

Ardenet (talk | contribs)
Marked this version for translation
Ralith (talk | contribs)
Document use of vpl-gpu-rt for the Intel VPL API.
 
(5 intermediate revisions by 4 users not shown)
Line 7: Line 7:
<translate>
<translate>
== Installation == <!--T:18-->
== Installation == <!--T:18-->
</translate>
 
<translate>
=== Intel === <!--T:19-->
=== Intel === <!--T:19-->
</translate>
</translate>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
  pkgs,
  ...
}:
{
{
   hardware.graphics = {
   hardware.graphics = {
Line 17: Line 22:
     extraPackages = with pkgs; [
     extraPackages = with pkgs; [
       intel-media-driver # For Broadwell (2014) or newer processors. LIBVA_DRIVER_NAME=iHD
       intel-media-driver # For Broadwell (2014) or newer processors. LIBVA_DRIVER_NAME=iHD
      vpl-gpu-rt # For QSV/VPL API support on Tiger Lake (2020) or newer processors.
       intel-vaapi-driver # For older processors. LIBVA_DRIVER_NAME=i965
       intel-vaapi-driver # For older processors. LIBVA_DRIVER_NAME=i965
     ];
     ];
   };
   };
   environment.sessionVariables = { LIBVA_DRIVER_NAME = "iHD"; }; # Optionally, set the environment variable
   environment.sessionVariables = {
    LIBVA_DRIVER_NAME = "iHD";
  }; # Optionally, set the environment variable
}
}
</nowiki>}}
</nowiki>|name=|lang=}}
 
<translate>
<translate>
<!--T:2-->
<!--T:2-->
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>
</translate>


<translate>
<!--T:3-->
<!--T:3-->
For 32-bit support, use
For 32-bit support, use
</translate> {{nixos:option|hardware.graphics.extraPackages32}}:
</translate> {{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>}}
<translate>
<translate>
=== AMD === <!--T:4-->
=== AMD === <!--T:4-->
Line 43: Line 56:
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:
</translate>
</translate>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
{
Line 62: Line 76:
</translate>
</translate>


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{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 =
    ffVersion = config.programs.firefox.package.version;
    let
  in {
      ffVersion = config.programs.firefox.package.version;
    "media.ffmpeg.vaapi.enabled" = lib.versionOlder ffVersion "137.0.0";
    in
    "media.hardware-video-decoding.force-enabled" = lib.versionAtLeast ffVersion "137.0.0";
    {
    "media.rdd-ffmpeg.enabled" = lib.versionOlder ffVersion "97.0.0";
      "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;
      "gfx.x11-egl.force-enabled" = true;
    "widget.dmabuf.force-enabled" = true;
      "widget.dmabuf.force-enabled" = true;


    # Set this to true if your GPU supports AV1.
      # Set this to true if your GPU supports AV1.
    #
      #
    # This can be determined by reading the output of the
      # This can be determined by reading the output of the
    # `vainfo` command, after the driver is enabled with
      # `vainfo` command, after the driver is enabled with
    # the environment variable.
      # the environment variable.
    "media.av1.enabled" = false;
      "media.av1.enabled" = false;
  };
    };
}
}
</nowiki>}}
</nowiki>|name=/etc/nixos/configuration.nix|lang=nix}}
 
<translate>
<translate>
== Testing your configuration == <!--T:6-->
== Testing your configuration == <!--T:6-->


<!--T:7-->
<!--T:7-->
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>
</translate>
 
<translate>
<!--T:8-->
<!--T:8-->
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.
</translate>
 
<translate>
== Applications == <!--T:9-->
== Applications == <!--T:9-->
</translate>
 
<translate>
=== Chromium === <!--T:10-->
<!--T:10-->
 
=== Chromium ===
<!--T:27-->
See [[Chromium#Accelerated_video_playback]].
See [[Chromium#Accelerated_video_playback]].
</translate>
 
<translate>
=== Firefox === <!--T:11-->
=== Firefox === <!--T:11-->


<!--T:12-->
<!--T:12-->
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].
</translate>
 
<!--T:13-->
<translate>
=== MPV === <!--T:20-->
=== MPV === <!--T:20-->
</translate>
 
<translate>
<!--T:21-->
<!--T:21-->
You can place the following configuration in {{ic|~/.config/mpv/mpv.conf}}:
You can place the following configuration in {{ic|~/.config/mpv/mpv.conf}}:
</translate>
</translate>
<!--T:14-->
 
<syntaxHighlight lang=ini>
<syntaxHighlight lang=ini>
hwdec=auto
hwdec=auto
</syntaxHighlight>
</syntaxHighlight>


<!--T:15-->
<translate>
<translate>
<!--T:22-->
<!--T:22-->
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].
</translate>
 
<translate>
== Also see == <!--T:16-->
<!--T:16-->
 
== Also see ==
<!--T:28-->
* [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.
</translate>
</translate>


[[Category:Video]]
[[Category:Video]]