forked from aylac.top/nixcfg
this repo has no description
at main 8.0 kB view raw
1{ 2 pkgs, 3 lib, 4 config, 5 ... 6}: { 7 options.myHome.programs.mpv.enable = lib.mkEnableOption "mpv"; 8 9 config = lib.mkIf config.myHome.programs.mpv.enable { 10 programs.mpv = { 11 enable = true; 12 scripts = with pkgs.mpvScripts; [ 13 uosc 14 sponsorblock-minimal 15 thumbfast 16 eisa01.simplehistory 17 eisa01.smart-copy-paste-2 18 autoload 19 ]; 20 config = { 21 # Video output and rendering 22 vo = "gpu-next"; 23 dither-depth = "auto"; 24 25 # Window and display 26 osd-bar = false; 27 border = false; 28 geometry = "50%:50%"; 29 autofit-larger = "1280x720"; 30 keep-open = true; 31 reset-on-next-file = "video-rotate,video-zoom,panscan"; 32 33 # Debanding 34 deband = false; 35 deband-iterations = 2; 36 deband-threshold = 64; 37 deband-range = 17; 38 deband-grain = 12; 39 40 # Audio and subtitle languages 41 alang = "ja,jp,jpn,en,eng"; 42 slang = "en,eng,pt-br,br,pt"; 43 44 # Subtitle settings 45 demuxer-mkv-subtitle-preroll = true; 46 sub-fix-timing = false; 47 sub-auto = "fuzzy"; 48 sub-scale = 0.5; 49 50 # Screenshot settings 51 screenshot-format = "png"; 52 screenshot-high-bit-depth = false; 53 screenshot-png-compression = 3; 54 screenshot-directory = "~/Pictures/mpv-screenshots"; 55 screenshot-template = "%wH.%wM.%wS.%wT-#%#00n"; 56 57 # YouTube-dl format 58 ytdl-format = "bv*[vcodec^=vp9][height<=?1080][vcodec!=av01]+ba/best"; 59 }; 60 profiles = { 61 video = { 62 profile-cond = "not get('current-tracks/video/image') and not get('current-tracks/video/albumart')"; 63 correct-downscaling = true; 64 linear-downscaling = false; 65 sigmoid-upscaling = true; 66 }; 67 "protocol.http" = { 68 hls-bitrate = "max"; 69 cache = true; 70 no-cache-pause = true; 71 }; 72 "protocol.https" = { 73 hls-bitrate = "max"; 74 cache = true; 75 no-cache-pause = true; 76 }; 77 "image-hq" = { 78 profile-cond = "get('current-tracks/video/image') and width < 10000"; 79 profile-restore = "copy"; 80 scale = "spline36"; 81 cscale = "spline36"; 82 dscale = "mitchell"; 83 dither-depth = "auto"; 84 correct-downscaling = true; 85 sigmoid-upscaling = true; 86 }; 87 }; 88 89 bindings = { 90 # VIDEO 91 d = "cycle deband"; 92 D = "cycle deinterlace"; 93 n = "cycle video-unscaled"; 94 C = "cycle-values video-aspect-override \"16:9\" \"4:3\" \"2.35:1\" \"-1\""; # cycle the video aspect ratio ("-1" is the container aspect) 95 96 # increase subtitle font size 97 "ALT+e" = "add sub-scale +0.1"; 98 99 # decrease subtitle font size 100 "ALT+n" = "add sub-scale -0.1"; 101 102 m = "cycle ao-mute"; 103 104 "Ctrl+q" = "script-binding pickshader"; 105 106 # IMAGES 107 "SPACE" = "{image} repeatable playlist-next force"; 108 "]" = "{image} no-osd add playlist-pos 10"; 109 "[" = "{image} no-osd add playlist-pos -10"; 110 111 # pan-image is a wrapper around altering video-align that pans 112 # relatively to the window's dimensions instead of the image's. 113 # +1 scrolls one screen width/height. 114 h = "{image} repeatable script-message pan-image x -.33"; 115 j = "{image} repeatable script-message pan-image y +.33"; 116 k = "{image} repeatable script-message pan-image y -.33"; 117 l = "{image} repeatable script-message pan-image x +.33"; 118 LEFT = "{image} repeatable script-message pan-image x -.33"; 119 DOWN = "{image} repeatable script-message pan-image y +.33"; 120 UP = "{image} repeatable script-message pan-image y -.33"; 121 RIGHT = "{image} repeatable script-message pan-image x +.33"; 122 H = "{image} repeatable script-message pan-image x -.033"; 123 J = "{image} repeatable script-message pan-image y +.033"; 124 K = "{image} repeatable script-message pan-image y -.033"; 125 L = "{image} repeatable script-message pan-image x +.033"; 126 "Shift+LEFT" = "{image} repeatable script-message pan-image x -.033"; 127 "Shift+DOWN" = "{image} repeatable script-message pan-image y +.033"; 128 "Shift+UP" = "{image} repeatable script-message pan-image y -.033"; 129 "Shift+RIGHT" = "{image} repeatable script-message pan-image x +.033"; 130 "Ctrl+h" = "{image} no-osd set video-align-x -1"; 131 "Ctrl+j" = "{image} no-osd set video-align-y 1"; 132 "Ctrl+k" = "{image} no-osd set video-align-y -1"; 133 "Ctrl+l" = "{image} no-osd set video-align-x 1"; 134 "Ctrl+LEFT" = "{image} no-osd set video-align-x -1"; 135 "Ctrl+DOWN" = "{image} no-osd set video-align-y 1"; 136 "Ctrl+UP" = "{image} no-osd set video-align-y -1"; 137 "Ctrl+RIGHT" = "{image} no-osd set video-align-x 1"; 138 139 "9" = "{image} add video-zoom +.25"; # easier to reach than = 140 "-" = "{image} add video-zoom -.25"; 141 "(" = "{image} add video-zoom +.05"; 142 "_" = "{image} add video-zoom -.05"; 143 "0" = "{image} no-osd set video-zoom 0; no-osd set panscan 0"; 144 145 # Toggle scaling the image to the window. 146 u = "{image} no-osd cycle-values video-unscaled yes no; no-osd set video-zoom 0; no-osd set panscan 0"; 147 # cycle video-unscaled will also cycle through downscale-big. 148 # autofit=100%x100% makes the window bigger than necessary with downscale-big 149 # though so you may want to replace it with autofit-larger=100%x100% 150 151 # panscan crops scaled videos with different aspect ratio than the window. 152 # At 1 it fills black bars completely. 153 o = "{image} no-osd set panscan 1; no-osd set video-unscaled no; no-osd set video-zoom 0"; 154 155 # Toggle slideshow mode. 156 s = "{image} cycle-values image-display-duration 5 inf; no-osd set video-zoom 0; no-osd set panscan 0; no-osd set video-unscaled no"; 157 158 # Compare the image quality with and without profile=gpu-hq. 159 "Ctrl+a" = "{image} apply-profile image-hq restore"; 160 a = "{image} apply-profile image-hq"; 161 162 # This mouse gesture executes one of 5 commands configured in 163 # script-opts/image_bindings.conf depending on the direction you drag the 164 # mouse. To use it without an input section you need window-dragging=no in 165 # mpv.conf. 166 MBTN_LEFT = "{image} script-binding gesture"; 167 MBTN_LEFT_DBL = "{image} ignore"; 168 MBTN_MID = "{image} script-binding align-to-cursor"; 169 MBTN_RIGHT = "{image} script-binding drag-to-pan"; 170 WHEEL_UP = "{image} script-message cursor-centric-zoom .1"; 171 WHEEL_DOWN = "{image} script-message cursor-centric-zoom -.1"; 172 173 GAMEPAD_DPAD_RIGHT = "seek +5"; 174 GAMEPAD_DPAD_LEFT = "seek -5"; 175 176 GAMEPAD_RIGHT_TRIGGER = "add chapter 1"; 177 GAMEPAD_LEFT_TRIGGER = "add chapter -1"; 178 179 GAMEPAD_ACTION_DOWN = "cycle pause"; 180 181 GAMEPAD_LEFT_SHOULDER = "cycle sub"; 182 GAMEPAD_RIGHT_SHOULDER = "cycle audio"; 183 }; 184 scriptOpts = { 185 "SimpleHistory" = { 186 open_list_keybind = "[[h,all],[H,all],[r,recents],[R,recents],[GAMEPAD_BACK,all]]"; 187 same_entry_limit = 0; 188 list_move_up_keybind = "[UP,WHEEL_UP,GAMEPAD_DPAD_UP]"; 189 list_move_down_keybind = "[DOWN,WHEEL_DOWN,GAMEPAD_DPAD_DOWN]"; 190 list_page_up_keybind = "[PGUP,GAMEPAD_LEFT_TRIGGER]"; 191 list_page_down_keybind = "[PGDWN,GAMEPAD_RIGHT_TRIGGER]"; 192 list_select_keybind = "[ENTER,MBTN_MID,GAMEPAD_ACTION_DOWN]"; 193 list_add_playlist_keybind = "[CTRL+ENTER,GAMEPAD_ACTION_RIGHT]"; 194 list_close_keybind = "[ESC,MBTN_RIGHT,GAMEPAD_BACK]"; 195 }; 196 "thumbfast" = { 197 max_height = 250; 198 max_width = 250; 199 spawn_first = "yes"; 200 network = "yes"; 201 hwdec = "yes"; 202 }; 203 "uosc" = { 204 }; 205 }; 206 }; 207 }; 208}