diff --git a/users/simon/modules/mpv.nix b/users/simon/modules/mpv.nix index 3ec4f02..1e4acb4 100644 --- a/users/simon/modules/mpv.nix +++ b/users/simon/modules/mpv.nix @@ -158,56 +158,65 @@ in "Alt+Z" = "add sub-delay +1"; }; - profiles = { - musicvideo = { - lavfi-complex = "[aid1]asplit=4[ao][a1][a2][a3];[a1]avectorscope=m=lissajous:s=640x600:draw=dot:r=25[avectorscope];[a2]aresample=44100,showwaves=s=1280x600:mode=p2p:colors=red|lightgreen:r=25[showwaves];[a3]showcqt=s=1920x600:axis=0:axis_h=0:r=25[showcqt];[showwaves][avectorscope]hstack=shortest=1[top];[top][showcqt]vstack=shortest=1,fps=25[vo]"; - alpha = false; - }; + profiles = + let + mkVisualiser = width: height: rate: { + lavfi-complex = lib.concatStringsSep ";" [ + "[aid1]asplit=4[ao][a1][a2][a3]" + "[a1]avectorscope=m=lissajous:s=${toString (width / 3)}x${toString (height / 2)}:draw=dot:r=${toString rate}[avectorscope]" + "[a2]aresample=44100,showwaves=s=${toString (width / 3 * 2)}x${toString (height / 2)}:mode=p2p:colors=red|lightgreen:r=${toString rate}[showwaves]" + "[a3]showcqt=s=${toString width}x${toString (height / 2)}:axis=0:axis_h=0:r=${toString rate}[showcqt]" + "[showwaves][avectorscope]hstack=shortest=1[top]" + "[top][showcqt]vstack=shortest=1,fps=${toString rate}[vo]" + ]; + alpha = false; + }; + in + { + visualiser = mkVisualiser 1920 1200 30; + visualiser-1080 = mkVisualiser 1920 1080 30; + visualiser-60 = mkVisualiser 1920 1080 60; + visualiser-1080-60 = mkVisualiser 1920 1080 60; - musicvideo-1080 = { - lavfi-complex = "[aid1]asplit=4[ao][a1][a2][a3];[a1]avectorscope=m=lissajous:s=640x540:draw=dot:r=25[avectorscope];[a2]aresample=44100,showwaves=s=1280x540:mode=p2p:colors=red|lightgreen:r=25[showwaves];[a3]showcqt=s=1920x540:axis=0:axis_h=0:r=25[showcqt];[showwaves][avectorscope]hstack=shortest=1[top];[top][showcqt]vstack=shortest=1,fps=25[vo]"; - alpha = false; - }; + hqencode = { + ovc = "libx264"; + ovcopts-add = "crf=18"; + oac = "flac"; + audio-format = "s16"; + }; - hqencode = { - ovc = "libx264"; - ovcopts-add = "crf=18"; - oac = "flac"; - audio-format = "s16"; - }; + lq = { + scale = "bicubic_fast"; + cscale = "bicubic_fast"; + dscale = "bicubic_fast"; + }; - lq = { - scale = "bicubic_fast"; - cscale = "bicubic_fast"; - dscale = "bicubic_fast"; - }; + hq = { + scale = "ewa_lanczossharp"; + dscale = "mitchell"; + linear-downscaling = "no"; # for KrigBilateral + cscale = "ewa_lanczos"; + glsl-shader = [ + "${shaders.SSimDownscaler}" # dscale + "${shaders.KrigBilateral}" # cscale + "${shaders.fsrcnnx_x2}" # scale + ]; + }; - hq = { - scale = "ewa_lanczossharp"; - dscale = "mitchell"; - linear-downscaling = "no"; # for KrigBilateral - cscale = "ewa_lanczos"; - glsl-shader = [ - "${shaders.SSimDownscaler}" # dscale - "${shaders.KrigBilateral}" # cscale - "${shaders.fsrcnnx_x2}" # scale - ]; - }; + interpolate = { + blend-subtitles = true; + video-sync = "display-resample"; + interpolation = true; + tscale = "box"; + tscale-window = "sphinx"; + tscale-radius = 1.0; + tscale-clamp = 0.0; + }; - interpolate = { - blend-subtitles = true; - video-sync = "display-resample"; - interpolation = true; - tscale = "box"; - tscale-window = "sphinx"; - tscale-radius = 1.0; - tscale-clamp = 0.0; + # adapted from https://github.com/mpv-player/mpv/issues/4418#issuecomment-368272929 + clear-speed.af-add = "scaletempo=stride=18:overlap=.6:search=10"; }; - # adapted from https://github.com/mpv-player/mpv/issues/4418#issuecomment-368272929 - clear-speed.af-add = "scaletempo=stride=18:overlap=.6:search=10"; - }; - scripts = [ pitchcontrol ];