TOOLS/autocrop.lua: disable hwdec when needed instead using -copy one

This is more stable in practice. Avoids switching between possibly
different hwdecs and avoids unnecessary init. Software decoding should be
more stable and possibly faster overall for decoding this small portion
of video needed for cropdetect.
This commit is contained in:
Kacper Michajłow 2023-10-08 15:31:40 +02:00 committed by Dudemanguy
parent 46842da8d5
commit d305dc8d25
1 changed files with 3 additions and 4 deletions

View File

@ -17,9 +17,8 @@ inserting the cropdetect filter and setting video-crop, the "C" key should be
pressed at a position in the video where the crop region is unambiguous (i.e.,
not a black frame, black background title card, or dark scene).
If non-copy-back hardware decoding is in use, hwdec is temporarily set to
auto-copy-safe for the duration of cropdetect as the filter would fail
otherwise.
If non-copy-back hardware decoding is in use, hwdec is temporarily disabled for
the duration of cropdetect as the filter would fail otherwise.
These are the default options. They can be overridden by adding
script-opts-append=autocrop-<parameter>=<value> to mpv.conf.
@ -132,7 +131,7 @@ function detect_crop()
if hwdec_current:find("-copy$") == nil and hwdec_current ~= "no" and
hwdec_current ~= "crystalhd" and hwdec_current ~= "rkmpp" then
hwdec_backup = mp.get_property("hwdec")
mp.set_property("hwdec", "auto-copy-safe")
mp.set_property("hwdec", "no")
end
-- Insert the cropdetect filter.