Script to "cropping" dynamically, hard-coded black bars detected with lavfi-cropdetect filter for Ultra Wide Screen or any screen (Smartphone/Tablet).
It's now really stable, but can probably be improved to handle more case.
Save dynamic-crop.lua
in ~/.config/.mpv/scripts/
(Linux/macOS) or %AppData%\mpv\scripts\
(Windows).
Or edit your mpv.conf
file to add script=<custom path to the script>
, use absolute path and don't add it if you already put it in directory scripts
:
## Example
# Linux/macOS:
script=/home/<username>/<any custom path you choose>/dynamic-crop.lua
# Windows:
script=C:\Users\<username>\<any custom path you choose>\dynamic-crop.lua
# Android mpv-android:
script=/storage/emulated/0/<any custom path you choose>/dynamic-crop.lua
SHIFT+C do:
Cycle between ENABLE / DISABLE_WITH_CROP / DISABLE
To collect the log, add to mpv.conf, log-file=<any path you can find easily>
If the script doesn't work, make sure mpv is build with the libavfilter crop
and cropdetect
by starting mpv with ./mpv --vf=help
or by adding at the #1 line in mpv.conf vf=help
and check the log for Available libavfilter filters:
.
Make sure mpv option hwdec=
is no
(default) or any *-copy
(doc), otherwise the script will fail.
Performance issue with mpv client or specific gpu-api (solved with patch):
gpu-api=
(doc). limit_timer
to slow down limit change, main source of performance issue depending on gpu-api used. UseOpenGL
.Use the Desktop mode with a navigator on this page to access the button Code > Download Zip
.
Or transfer it from a computer or any other device.