diff options
author | Kevin Mitchell <kevmitch@gmail.com> | 2014-04-29 05:11:39 -0700 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2014-04-29 08:31:44 -0700 |
commit | 8e8758dbe15ed7611c65856d62c3f44b5be73d7e (patch) | |
tree | ccbf2fbfec3ed404c61605587d050e9082126456 /TOOLS/lua/autocrop.lua | |
parent | 4b0a760d86381587eff3552c440fbe1bfbac03e5 (diff) | |
download | mpv-8e8758dbe15ed7611c65856d62c3f44b5be73d7e.tar.bz2 mpv-8e8758dbe15ed7611c65856d62c3f44b5be73d7e.tar.xz |
TOOLS: better documentation of lua scripts
Diffstat (limited to 'TOOLS/lua/autocrop.lua')
-rw-r--r-- | TOOLS/lua/autocrop.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/TOOLS/lua/autocrop.lua b/TOOLS/lua/autocrop.lua index 40dc6d1704..84c712e412 100644 --- a/TOOLS/lua/autocrop.lua +++ b/TOOLS/lua/autocrop.lua @@ -1,3 +1,31 @@ +-- This script uses the lavfi cropdetect filter to automatically +-- insert a crop filter with appropriate parameters for the currently +-- playing video. +-- +-- It registers the key-binding "C" (shift+c), which when pressed, +-- inserts the filter vf=lavfi=cropdetect. After 1 second, it then +-- inserts the filter vf=crop=w:h:x:y, where w,h,x,y are determined +-- from the vf-metadata gathered by cropdetect. The cropdetect filter +-- is removed immediately after the crop filter is inserted as it is +-- no longer needed. +-- +-- If the "C" key is pressed again, the crop filter is removed +-- restoring playback to its original state. +-- +-- Since the crop parameters are determined from the 1 second of video +-- between inserting the cropdetect and crop filters, 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). +-- +-- The default delay between insertion of the cropdetect and +-- crop filters may be overridden by adding +-- +-- --lua-opts=autocrop.detect_seconds=<number of seconds> +-- +-- to mpv's arguments. This may be desirable to allow cropdetect more +-- time to collect data. + script_name=string.gsub(mp.get_script_name(),"lua/","") cropdetect_label=string.format("%s-cropdetect",script_name) crop_label=string.format("%s-crop",script_name) |