1
0
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:
Ricardo Constantino 2017-08-17 20:43:25 +01:00
parent b9430309ec
commit 1171f92beb
No known key found for this signature in database
GPG Key ID: EFD16019AE4FF531

View File

@ -66,8 +66,8 @@ function autocrop_start()
-- insert the cropdetect filter
ret=mp.command(
string.format(
'vf add @%s:lavfi=graph="cropdetect=limit=24:round=2:reset=0"',
cropdetect_label
'vf add @%s:cropdetect=limit=%f:round=2:reset=0',
cropdetect_label, 24/255
)
)
-- wait to gather data
@ -79,6 +79,7 @@ function do_crop()
local cropdetect_metadata = mp.get_property_native(
string.format("vf-metadata/%s", cropdetect_label)
)
-- use it to crop if its valid
if cropdetect_metadata then
if cropdetect_metadata["lavfi.cropdetect.w"]
@ -86,7 +87,7 @@ function do_crop()
and cropdetect_metadata["lavfi.cropdetect.x"]
and cropdetect_metadata["lavfi.cropdetect.y"]
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,
cropdetect_metadata["lavfi.cropdetect.w"],
cropdetect_metadata["lavfi.cropdetect.h"],