summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-10-05 20:31:08 +0200
committerDudemanguy <random342@airmail.cc>2023-10-07 22:47:43 +0000
commit78719c14ca5e9e20fd75771a57e3fdc6585547a8 (patch)
tree38949806e9af404a975247eb35ecdacacee1442f /TOOLS
parent76de65f116abf403034984e8bbf105bb866f0a55 (diff)
downloadmpv-78719c14ca5e9e20fd75771a57e3fdc6585547a8.tar.bz2
mpv-78719c14ca5e9e20fd75771a57e3fdc6585547a8.tar.xz
TOOLS/autocrop.lua: add support for detect_min_ratio
This was lost in 6b963857c0
Diffstat (limited to 'TOOLS')
-rw-r--r--TOOLS/lua/autocrop.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/TOOLS/lua/autocrop.lua b/TOOLS/lua/autocrop.lua
index b5aac1d4c0..b3bc68c52b 100644
--- a/TOOLS/lua/autocrop.lua
+++ b/TOOLS/lua/autocrop.lua
@@ -212,7 +212,15 @@ function apply_crop(meta)
(meta.x > 0 or meta.y > 0
or meta.w < meta.max_w or meta.h < meta.max_h)
- if not is_effective then
+ -- Verify it is not over cropped.
+ local is_excessive = false
+ if is_effective and (meta.w < meta.min_w or meta.h < meta.min_h) then
+ mp.msg.info("The area to be cropped is too large.")
+ mp.msg.info("You might need to decrease detect_min_ratio.")
+ is_excessive = true
+ end
+
+ if not is_effective or is_excessive then
-- Clear any existing crop.
mp.command(string.format("%s set file-local-options/video-crop ''", command_prefix))
return