mirror of
https://github.com/mpv-player/mpv
synced 2024-12-22 14:52:43 +00:00
TOOLS/autocrop.lua: fix cropdetect black limit for 10-bit videos
Also update to use newer lavfi-bridges for the relevant filters to shut up warnings about deprecated crop filter.
This commit is contained in:
parent
b9430309ec
commit
1171f92beb
@ -66,8 +66,8 @@ function autocrop_start()
|
|||||||
-- insert the cropdetect filter
|
-- insert the cropdetect filter
|
||||||
ret=mp.command(
|
ret=mp.command(
|
||||||
string.format(
|
string.format(
|
||||||
'vf add @%s:lavfi=graph="cropdetect=limit=24:round=2:reset=0"',
|
'vf add @%s:cropdetect=limit=%f:round=2:reset=0',
|
||||||
cropdetect_label
|
cropdetect_label, 24/255
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
-- wait to gather data
|
-- wait to gather data
|
||||||
@ -79,6 +79,7 @@ function do_crop()
|
|||||||
local cropdetect_metadata = mp.get_property_native(
|
local cropdetect_metadata = mp.get_property_native(
|
||||||
string.format("vf-metadata/%s", cropdetect_label)
|
string.format("vf-metadata/%s", cropdetect_label)
|
||||||
)
|
)
|
||||||
|
|
||||||
-- use it to crop if its valid
|
-- use it to crop if its valid
|
||||||
if cropdetect_metadata then
|
if cropdetect_metadata then
|
||||||
if cropdetect_metadata["lavfi.cropdetect.w"]
|
if cropdetect_metadata["lavfi.cropdetect.w"]
|
||||||
@ -86,7 +87,7 @@ function do_crop()
|
|||||||
and cropdetect_metadata["lavfi.cropdetect.x"]
|
and cropdetect_metadata["lavfi.cropdetect.x"]
|
||||||
and cropdetect_metadata["lavfi.cropdetect.y"]
|
and cropdetect_metadata["lavfi.cropdetect.y"]
|
||||||
then
|
then
|
||||||
mp.command(string.format("vf add @%s:crop=%s:%s:%s:%s",
|
mp.command(string.format("vf add @%s:lavfi-crop=w=%s:h=%s:x=%s:y=%s",
|
||||||
crop_label,
|
crop_label,
|
||||||
cropdetect_metadata["lavfi.cropdetect.w"],
|
cropdetect_metadata["lavfi.cropdetect.w"],
|
||||||
cropdetect_metadata["lavfi.cropdetect.h"],
|
cropdetect_metadata["lavfi.cropdetect.h"],
|
||||||
|
Loading…
Reference in New Issue
Block a user