MPV: Difference between revisions
No edit summary |
Reviewed and included several improvements to the MPV page. |
||
Line 1: | Line 1: | ||
== Description == | |||
MPV is an open-source media player known for its high performance, versatility, and minimalist design. It supports a wide range of video and audio formats, ensuring extensive compatibility. MPV features advanced video rendering capabilities, including high-quality scaling algorithms, color management, and HDR support, which contribute to superior video playback quality. It utilizes hardware-accelerated video decoding through APIs such as VA-API, VDPAU, and DXVA2, enhancing performance and reducing CPU usage. The player’s design emphasizes minimalism and efficiency, offering a streamlined user interface with extensive configurability via command-line options and scripting interfaces. | |||
== Installation == | |||
=== Using <code>nix-env</code> === | |||
To install mpv using <code>nix-env</code>, execute the following command:<syntaxhighlight lang="nix"> | |||
nix-env -iA nixos.mpv | |||
</syntaxhighlight> | |||
=== Using <code>nix-shell</code> === | |||
To use MPV in a temporary environment with <code>nix-shell</code>, run:<syntaxhighlight lang="nix"> | |||
nix-shell -p mpv | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="nix"> | === System-Wide Installation on NixOS === | ||
To install MPV system-wide, add it to your system configuration. Edit your <code>/etc/nixos/configuration.nix</code> and include MPV in the <code>environment.systemPackages</code> list:<syntaxhighlight lang="nix"> | |||
environment.systemPackages = [ | |||
pkgs.mpv | |||
]; | ]; | ||
</syntaxhighlight>After modifying your configuration, apply the changes by running:<syntaxhighlight lang="nix"> | |||
sudo nixos-rebuild switch | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=== User-Specific Installation with Home Manager === | |||
If you use Home Manager, you can add MPV to your home configuration. Edit your Home Manager configuration file (usually <code>~/.config/nixpkgs/home.nix</code>) and include MPV in the <code>home.packages</code> list:<syntaxhighlight lang="nix"> | |||
home.packages = [ | |||
pkgs.mpv | |||
]; | |||
</syntaxhighlight>After updating your configuration, apply the changes by running:<syntaxhighlight lang="nix"> | |||
home-manager switch | |||
</syntaxhighlight> | |||
== Configuration == | |||
The recommended way to enable and configure MPV on NixOS is through the <code>programs</code> attribute in your NixOS home configuration.<syntaxhighlight lang="nix"> | |||
programs.mpv = { | |||
enable = true; | |||
}; | |||
</syntaxhighlight>A more comprehensive configuration of MPV would look like this.<syntaxhighlight lang="nix"> | |||
programs.mpv = { | |||
enable = true; | |||
# Custom package configuration for MPV | |||
package = | |||
(pkgs.mpv-unwrapped.wrapper { | |||
( | mpv = pkgs.mpv-unwrapped.override { | ||
mpv = | waylandSupport = true; | ||
x11Support = false; | |||
cddaSupport = false; | |||
vulkanSupport = false; | |||
drmSupport = false; | |||
archiveSupport = false; | |||
bluraySupport = true; | |||
bs2bSupport = false; | |||
cacaSupport = false; | |||
cmsSupport = false; | |||
dvdnavSupport = false; | |||
dvbinSupport = false; | |||
jackaudioSupport = false; | |||
javascriptSupport = false; | |||
libpngSupport = false; | |||
openalSupport = false; | |||
pulseSupport = false; | |||
pipewireSupport = true; | |||
rubberbandSupport = false; | |||
screenSaverSupport = false; | |||
sdl2Support = true; | |||
sixelSupport = false; | |||
speexSupport = false; | |||
swiftSupport = false; | |||
theoraSupport = false; | |||
vaapiSupport = true; | |||
vapoursynthSupport = false; | |||
vdpauSupport = true; | |||
xineramaSupport = false; | |||
xvSupport = false; | |||
zimgSupport = false; | |||
}; | }; | ||
}) | }) | ||
.override { | |||
} | scripts = with pkgs.mpvScripts; [ | ||
uosc | |||
sponsorblock | |||
]; | |||
}; | |||
# MPV configuration options | |||
config = { | |||
profile = "high-quality"; | |||
ytdl-format = "bestvideo+bestaudio"; | |||
cache-default = 4000000; | |||
}; | |||
}; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
<h2>Error, unknown format</h2> | === Finding MPV Scripts === | ||
You can find additional scripts for MPV under the <code>mpvScripts</code> attribute. To search for available scripts, use the following command:<syntaxhighlight lang="nix"> | |||
nix search nixpkgs mpvScripts | |||
</syntaxhighlight>The scripts are defined in the following Nixpkgs directory:<syntaxhighlight lang="nix"> | |||
pkgs/applications/video/mpv/scripts | |||
</syntaxhighlight><h2>Error, unknown format</h2> | |||
If you get the following sort of error, note that mpv currently uses the small ffmpeg version (ffmpeg_5) instead of the full version (ffmpeg_5-full). | If you get the following sort of error, note that mpv currently uses the small ffmpeg version (ffmpeg_5) instead of the full version (ffmpeg_5-full). | ||
Line 48: | Line 113: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
To address this problem, you can use the following | To address this problem, you can use the following package configuration for ffmpeg. | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
programs.mpv = { | |||
( | enable = true; | ||
mpv | |||
package = | |||
(pkgs.mpv-unwrapped.wrapper { | |||
mpv = pkgs.mpv-unwrapped.override { | |||
ffmpeg = pkgs.ffmpeg-full; | |||
}; | }; | ||
}) | }); | ||
}; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== References == | |||
# https://github.com/mpv-player/mpv/wiki | |||
# https://en.wikipedia.org/wiki/Mpv_(media_player) | |||
# https://mynixos.com/search?q=mpv | |||
[[Category:Applications]] | [[Category:Applications]] | ||
[[Category:Video]] | |||
[[Category:Audio]] |