Media
Configuration adapted from Samillion/mpv-conf,
with custom scripts from Sam’s companion repos:
ModernZ (OSC fork),
mpv-boxtowide,
mpv-ytdlautoformat.
Adapted for Linux + NVIDIA Pascal (see §Linux Adaptations).
Architecture
config/mpv/
├── mpv.conf # Main configuration (High Quality profile)
├── input.conf # Custom keybindings
├── menu.conf # Right-click context menu
├── fonts/
│ └── modernz-icons.ttf # ModernZ OSC icon font (custom, not in nixpkgs)
├── script-opts/
│ ├── boxtowide.conf
│ ├── modernz.conf
│ ├── pause_indicator_lite.conf
│ ├── pip_lite.conf
│ ├── thumbfast.conf
│ └── ytdlautoformat.conf
└── scripts/
├── boxtowide.lua # Auto-convert 4:3 → 16:9
├── pause_indicator_lite.lua # Pause icon overlay
├── pip_lite.lua # Picture-in-Picture toggle
└── ytdlautoformat.lua # Auto yt-dlp format for streams
Scripts injected via Nix wrapper (mpv-with-scripts, see modules/desktop/media/video.nix):
| Script | Source | Purpose |
|---|
modernz | nixpkgs mpvScripts.modernz | Modern OSC — clean UI with fluent icons |
thumbfast | nixpkgs mpvScripts.thumbfast | Thumbnail preview on seekbar hover |
sponsorblock-minimal | nixpkgs mpvScripts.sponsorblock-minimal | Skip sponsor segments (lightweight) |
mpris | nixpkgs mpvScripts.mpris | Desktop media integration (play/pause/skip) |
Scripts built into mpv 0.41 (compiled into the binary):
| Script | Key bindings |
|---|
select.lua | select/select-playlist, select/menu, select/show-properties |
stats.lua | stats/display-stats, stats/display-stats-toggle |
console.lua | console/enable |
context_menu.lua | Right-click → menu.conf |
positioning.lua | positioning/cursor-centric-zoom (image viewer) |
commands.lua | commands/open (command palette) |
Hardware Configuration
| Setting | Value | Notes |
|---|
profile | high-quality | Demanding defaults — requires capable GPU |
vo | gpu-next | Modern Vulkan-based output |
gpu-api | vulkan | NVIDIA Pascal driver support |
hwdec | auto-safe | NVDEC when available, software fallback otherwise |
deband | yes | Reduce color banding |
sigmoid-upscaling | yes | Better upscaling quality |
Auto-Profiles
Profiles apply automatically based on conditions:
| Profile | Trigger | Effect |
|---|
[Video] | Any video playing | Taskbar progress |
[Image] | Image file opened | Image viewer mode (infinite display, no screensaver) |
[Stream] | URL detected (yt-dlp) | Smaller cache, stream title, user-agent |
[Media] | Path contains /mnt/nas/video/ or /video/ | Large cache (1.5 GiB), stereo downmix, dialogue normalization |
[2K+] | Video height >= 1440p | Disable subtitle blending for performance |
[Window-PiP] | Always-on-top + not fullscreen | Compact ModernZ for PiP mode |
[Minimized] | Window minimized | Auto-pause |
[Autofit-Small] | Manual (F11) | 50% window size |
[Autofit-Normal] | Manual (F12) | 80% window size |
Keybindings
input-default-bindings=no is set — all defaults are disabled.
The following are the custom bindings.
Mouse
| Key | Action |
|---|
Left double-click | Toggle fullscreen |
Right-click | Context menu (menu.conf) |
Playback
| Key | Action |
|---|
SPACE / KP_INS | Play/Pause |
q | Quit |
Q | Quit (save position) |
ESC | Exit fullscreen |
f / KP5 | Toggle fullscreen |
v | Toggle ModernZ OSC visibility |
O | Cycle OSD detail level |
i | Show playback stats |
I | Toggle persistent stats |
ENTER / KP_ENTER | Show progress bar |
Navigation
| Key | Action |
|---|
RIGHT / LEFT / KP6 / KP4 | Seek ±2s |
HOME | Seek to start |
. / , | Frame step forward/back |
FORWARD / REWIND (media keys) | Seek ±10s |
b / n / PGDWN / KP9 | Next file |
p / PGUP / KP7 | Previous file |
l | Toggle A-B loop |
BS | Reset speed to 1.0× |
Volume
| Key | Action |
|---|
UP / DOWN / KP8 / KP2 | Volume ±2 |
m / MUTE | Toggle mute |
| Key | Action |
|---|
g-m | Open select menu |
g-p | Toggle ModernZ persistent progress |
g-c | Open console (type paths, commands) |
Ctrl+p | Select playlist entry |
F11 | Apply Autofit-Small (50%) |
F12 | Apply Autofit-Normal (80%) |
Image Viewer
| Key | Action |
|---|
WHEEL_UP / WHEEL_DOWN | Zoom centered on cursor |
0 | Reset position/zoom |
Number Pad
| Key | Action |
|---|
KP9 / KP7 | Next/Prev file |
KP6 / KP4 | Seek ±2s |
KP8 / KP2 | Volume ±2 |
KP5 | Fullscreen |
KP_INS | Play/Pause |
KP_ENTER | Show progress |
KP_DEL | Quit |
Jellyfin Integration
jellyfin-mpv-shim is configured to use external mpv mode (mpv_ext: true) so the
mpv-with-scripts wrapper is spawned instead of bare libmpv. See
modules/services/media/jellyfin.nix.
Config mirroring
Six paths from ~/.config/mpv/ are symlinked into ~/.config/jellyfin-mpv-shim/:
mpv.conf, input.conf, menu.conf, script-opts/, fonts/, scripts/.
With mpv_ext_no_ovr: true, mpv reads from ~/.config/mpv/ directly — the shim
symlinks are a safety net for edge cases:
- The activation script hasn’t run yet (bootstrap gap: first launch creates
conf.json with defaults, next rebuild patches it)
mpv_ext_no_ovr has had bugs in past jellyfin-mpv-shim releases
- User manually sets
mpv_ext_no_ovr: false
The two runtime-mutable files (conf.json, cred.json) are NOT managed by Nix.
Fonts
| Font | Source | Used by |
|---|
| Montserrat | System package montserrat | OSD text (osd-font), subtitles (sub-font) |
| Roboto | fonts.packages = [pkgs.roboto] in video.nix | ModernZ OSC text (font=Roboto in modernz.conf) |
| ModernZ Icons | config/mpv/fonts/modernz-icons.ttf | OSC fluent icons (play/pause/volume/etc.) |
Why modernz-icons.ttf is in config/mpv/fonts/
mpv auto-loads all fonts from <config-dir>/fonts/ (~/.config/mpv/fonts/) at
startup. The ModernZ script references icon_font = "modernz-icons" — this matches
the font family name embedded in the ttf.
The nixpkgs mpvScripts.modernz package also ships modernz-icons.ttf at
share/fonts/truetype/, but mpv’s wrapper fonts.conf does NOT include nix store
font paths — only system fontconfig directories. Without the local copy, ModernZ
icons would render as tofu (□). Placing it in config/mpv/fonts/ ensures mpv
discovers it reliably via the ~~/fonts/ auto-load mechanism.
Linux Adaptations from Sam’s Config
| Sam’s (Windows) | Ours (Linux) |
|---|
hwdec=d3d11va | hwdec=auto-safe + gpu-api=vulkan |
sub-file-paths with ; separator | : separator |
taskbar-progress=yes | Removed (not available on Linux) |
screenshot-template=~/Desktop/... | ~/pictures/screenshots/mpv/... |
[Media] profile: Windows paths | Paths: /mnt/nas/video/, /video/ |
open_file Lua script (file dialog) | Disabled (Windows-only); use console (g-c) or drag-and-drop |
thumbnail=D:\...\thumbfast.out | Default cache path (~~/cache/) |