An mpv script that turns the tunable values in your shaders into on-screen sliders, and reloads a shader the moment you save it.
Status: v0.1.2. Tested on Windows with mpv 0.42; Linux and macOS should work but are untested. Issues are welcome.
Install: download hookdial-<version>.zip from
Releases and unzip it into mpv's
scripts folder, so you get scripts/hookdial/main.lua. Press Alt+h in mpv.
Manual: install, the menu and its keys, hot reload, presets, options. API: control hookdial from other scripts, input.conf or JSON IPC.
- Sliders for every
//!PARAMin your active shaders (glsl-shaders), applied live throughglsl-shader-opts, on bothvo=gpu-nextandvo=gpu. - Sliders for numeric
#definelines in shaders that have no//!PARAM(adaptive-sharpen, noise_static and similar). Your shader files are never modified; hookdial loads a tuned copy. - A shader picker in the menu: swap, add or remove shaders from your shaders folder
without input.conf bindings, or bind
script-binding hookdial/pickto switch without the menu. - Hot reload: edit a shader in your editor, save, see the result.
- Per-shader presets, and compile errors shown on screen with the line in your file.
- An API for other scripts: read every shader's values, and set, step, reset or load presets through script messages (docs/api.md).
Known limitations are listed in the manual. The one most
likely to surprise you: an input.conf binding that toggles a shader by its path
(change-list glsl-shaders toggle ~~/shaders/x.glsl) stops working for that shader once
hookdial has loaded a tuned copy of it, after a #define change or a hot reload.
The design and every module interface are in docs/spec.md.
Tests run inside mpv itself, so you only need mpv (0.39 or newer):
MPV=/path/to/mpv tests/run.sh # Linux, macOS
tests/run.ps1 -Mpv C:\path\to\mpv.com # WindowsThe integration suite drives the real script on both GPU renderers and checks pixels. It opens a small mpv window, so it needs a GPU and a desktop session:
MPV=/path/to/mpv tests/integration/run.sh # Linux, macOS
tests/integration/run.ps1 -Mpv C:\path\to\mpv.com # Windowstests/stress/run.ps1 (Windows) runs hookdial under random input for a set time on both
renderers, in its own mpv with an isolated config folder, and checks for script errors,
leaked shader copies, a stuck menu and memory growth; see the comment at the top of
tests/stress/stress.lua.
tests/tools/fixture_check.lua checks the fixture shaders against a real GPU renderer; see
the comment at its top.
tests/tools/cost.ps1 -Dir <folder of shaders> measures what each shader costs the GPU per
frame, from mpv's own pass timers, with a 1080p video shrunk into a 640x360 window and a 360p
video enlarged to 1280x720. It writes tests/tmp/cost/cost-<scenario>-<vo>.tsv; see the
comment at the top of tests/tools/cost.lua.
Contributions arrive as pull requests against main. Read section 8 of the spec first.
MIT, see LICENSE.