Accelerated Video Playback: Difference between revisions

From NixOS Wiki
imported>Makefu
m (add note for nixos-19.03)
imported>Makefu
m (syntax highlight)
Line 8: Line 8:


Sample configuration:
Sample configuration:
 
<syntaxHighlight lang=nix>
  {
{
    ...
  ...
    nixpkgs.config.packageOverrides = pkgs: {
  nixpkgs.config.packageOverrides = pkgs: {
      vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
    vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
    };
  };
    hardware.opengl = {
  hardware.opengl = {
      enable = true;
    enable = true;
      extraPackages = with pkgs; [
    extraPackages = with pkgs; [
        vaapiIntel
      vaapiIntel
        vaapiVdpau
      vaapiVdpau
        libvdpau-va-gl
      libvdpau-va-gl
        intel-media-driver # only available starting nixos-19.03 or the current nixos-unstable
      intel-media-driver # only available starting nixos-19.03 or the current nixos-unstable
      ];
    ];
    };
  };
    ...
  ...
  }
}
 
</syntaxHighlight>


== Prepared Hardware configuration ==
== Prepared Hardware configuration ==
Line 41: Line 41:
for mpv to use hardware acceleration for VP9 on Intel Broadwell:
for mpv to use hardware acceleration for VP9 on Intel Broadwell:


<syntaxHighlight>
<syntaxHighlight lang=ini>
hwdec=vaapi
hwdec=vaapi
vo=gpu
vo=gpu

Revision as of 10:28, 18 February 2019

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 vaapiIntel package can be overriden 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 configuration:

{
  ...
  nixpkgs.config.packageOverrides = pkgs: {
    vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
  };
  hardware.opengl = {
    enable = true;
    extraPackages = with pkgs; [
      vaapiIntel
      vaapiVdpau
      libvdpau-va-gl
      intel-media-driver # only available starting nixos-19.03 or the current nixos-unstable
    ];
  };
  ...
}

Prepared Hardware configuration

Sometimes different opengl packages are required to achieve full performance. You can check different configuration repositories for similar hardware configuration:


Applications

Chromium

Needs a patch for VA-API support, see nixpkgs#21481 for current status.

MPV

@Mic92 needed the following configuration in ~/.mpv/config for mpv to use hardware acceleration for VP9 on Intel Broadwell:

hwdec=vaapi
vo=gpu
hwdec-codecs=all

This is based on the archlinux MPV article.

Other

See the Arch Linux wiki.