-{ pkgs, lib, config, ... }:
+{ pkgs, lib, ... }:
{
-home.packages = [
- pkgs.mpv
-];
-xdg.configFile."mpv/input.conf".text = ''
- # Volume normalization
- # See https://github.com/mpv-player/mpv/issues/3979
- Alt+a cycle-values af "dynaudnorm=f=75:g=25:n=0:p=0.58" "loudnorm" ""
- Alt+f cycle video-unscaled
-'';
-xdg.configFile."mpv/mpv.conf".text = ''
- hwdec=auto-safe
- profile=gpu-hq
- vo=gpu
- ytdl-format=18/mp4-480p/hls-480p/http-360p/mp4
-'';
+ programs.mpv = {
+ enable = true;
+ bindings = {
+ # Volume normalization
+ # See https://github.com/mpv-player/mpv/issues/3979
+ "Alt+a" = ''cycle-values af "loudnorm=I=-25:TP=-1.5:LRA=1:linear=false" "dynaudnorm=framelen=100:gausssize=10:coupling=1:peak=0.58" "speechnorm" ""'';
+ "Alt+f" = "cycle video-unscaled";
+
+ # Show all chapters (like a right-clic on |<< or >>|)
+ "c" = "show_text \${chapter-list}";
+ "=" = "show-text \${playlist}";
+ "!" = "show-text \${track-list}";
+
+ # q is easier to type than Q
+ "q" = "quit-watch-later";
+ "ESC" = "quit-watch-later";
+ "Q" = "quit";
+ "ENTER" = "playlist-next force";
+
+ "Alt+BS" = "playlist-remove current";
+ };
+ config = {
+ af = "loudnorm=I=-25:TP=-1.5:LRA=1:linear=false";
+
+ hwdec = "auto-safe";
+ profile = "gpu-hq";
+ vo = "gpu";
+
+ ytdl-format = "18/mp4-480p/hls-480p/http-360p/mp4";
+
+ # Don't wait ages for the window to finally show up.
+ force-window = "immediate";
+
+ stop-screensaver = "yes";
+
+ slang = "eng,en,enUS,en-US,fr,fr-FR";
+ alang = "eng,en,enUS,en-US,fr,fr-FR";
+ sub-scale = "0.6";
+
+ # For arbtt
+ #title = "MPV: \${?pause==no:playing}\${?pause==yes:paused}: \${path}";
+ title = lib.mkDefault "MPV: \${?pause==no:playing}\${?pause==yes:paused}: ";
+
+ # Higher quality screenshots. Low compression rate to speed up saving.
+ screenshot-directory = "~/Images/mpv";
+ screenshot-template = "%{filename:unknown}.%wH-%wM-%wS-%wT";
+ screenshot-format = "avif";
+ screenshot-avif-encoder = "libsvtav1";
+ screenshot-avif-pixfmt = "yuv420p";
+ # TODO: change crf wrt. resolution
+ screenshot-avif-opts = "crf=24,aq-mode=complexity";
+ screenshot-high-bit-depth = "yes";
+ screenshot-tag-colorspace = "yes";
+ };
+ profiles = {
+ "extension.gif" = {
+ interpolation = "no";
+ };
+ };
+ };
}