Accelerated Video Playback: Difference between revisions

From NixOS Wiki
imported>Primeos
→‎Chromium: Replace the outdated information
imported>Asymmetric
improve mpv config
Line 49: Line 49:


===[[MPV]]===
===[[MPV]]===
@Mic92 needed the following configuration in <code>~/.mpv/config</code>
You can place the following configuration in <code>~/.config/mpv/mpv.conf</code>
for mpv to use hardware acceleration for VP9 on Intel Broadwell:
for mpv to use hardware acceleration for VP9 on Intel Broadwell (and probably later):


<syntaxHighlight lang=ini>
<syntaxHighlight lang=ini>
hwdec=vaapi
hwdec=auto-safe
vo=gpu
vo=gpu
hwdec-codecs=all
profile=gpu-hq
</syntaxHighlight>
</syntaxHighlight>



Revision as of 14:26, 7 May 2020

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
    ];
  };
  ...
}

32 bit example:

hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ vaapiIntel ];

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.

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 archlinux MPV article.

Other

See the Arch Linux wiki.