1
mirror of https://github.com/mpv-player/mpv synced 2024-11-14 22:48:35 +01:00

TOOLS/autocrop.lua: add support for detect_min_ratio

This was lost in 6b963857c0
This commit is contained in:
Kacper Michajłow 2023-10-05 20:31:08 +02:00 committed by Dudemanguy
parent 76de65f116
commit 78719c14ca

View File

@ -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