diff --git a/auto_editor/__main__.py b/auto_editor/__main__.py index 3eebdebe7..b8a6ab3e2 100755 --- a/auto_editor/__main__.py +++ b/auto_editor/__main__.py @@ -33,13 +33,12 @@ def main_options(parser: ArgumentParser) -> ArgumentParser: "-m", type=margin, metavar="LENGTH", - help='Set sections near "loud" as "loud" too if section is less than LENGTH away.', + help='Set sections near "loud" as "loud" too if section is less than LENGTH away', ) parser.add_argument( - "--edit-based-on", "--edit", metavar="METHOD", - help="Decide which method to use when making edits", + help="Set an expression which determines how to make auto edits", ) parser.add_argument( "--silent-speed", @@ -147,7 +146,7 @@ def main_options(parser: ArgumentParser) -> ArgumentParser: "--output", "-o", metavar="FILE", - help="Set the name/path of the new output file.", + help="Set the name/path of the new output file", ) parser.add_argument( "--player", "-p", metavar="CMD", help="Set player to open output media files" @@ -312,6 +311,7 @@ def main() -> None: ({"--export-as-json"}, ["--export", "json"]), ({"--export-as-clip-sequence", "-excs"}, ["--export", "clip-sequence"]), ({"--keep-tracks-seperate"}, ["--keep-tracks-separate"]), + ({"--edit-based-on"}, ["--edit"]), ], ) diff --git a/auto_editor/help.py b/auto_editor/help.py index 442feafaa..6594d0fb8 100644 --- a/auto_editor/help.py +++ b/auto_editor/help.py @@ -24,10 +24,23 @@ will set the speed from 400 ticks to 800 ticks to 2.5x If timebase is 30, 400 ticks to 800 means 13.33 to 26.66 seconds """.strip(), - "--edit-based-on": """ + "--edit": """ Evaluates a palet expression that returns a bool-array?. The array is then used for editing. +Examples: + --edit audio + --edit audio:0.03 ; Change the threshold. Can be a value between 0-1. + --edit audio:3% ; You can also use the `%` macro. + --edit audio:0.03,stream=0 ; Only consider the first stream for editing. + --edit audio:stream=1,threshold=0.05 ; Here's how you use keyword arguments. + --edit (or audio:0.04,stream=0 audio:0.08,stream=1) ; Consider both streams for editing (merge with logical or), but with different thresholds. + --edit motion + --edit motion:0.02,blur=3 + --edit (or audio:0.04 motion:0.02,blur=3) + --edit none + --edit all/e + Editing Methods: - audio ; Audio silence/loudness detection - threshold threshold? : 4% @@ -52,19 +65,6 @@ - none ; Do not modify the media in anyway; mark all sections as "loud" (1). - all/e ; Cut out everything out; mark all sections as "silent" (0). - - -Command-line Examples: - --edit audio - --edit audio:threshold=4% - --edit audio:threshold=0.03 - --edit audio:stream=1 - --edit (or audio:4%,stream=0 audio:8%,stream=1) ; `threshold` is first - --edit motion - --edit motion:threshold=2%,blur=3 - --edit (or audio:4% motion:2%,blur=3) - --edit none - --edit all/e """.strip(), "--export": """ This option controls how timelines are exported. diff --git a/auto_editor/make_layers.py b/auto_editor/make_layers.py index 71c9b08cd..f479d4a78 100644 --- a/auto_editor/make_layers.py +++ b/auto_editor/make_layers.py @@ -139,7 +139,7 @@ def make_timeline( for i, src in enumerate(sources): try: - parser = Parser(Lexer("`--edit`", args.edit_based_on)) + parser = Parser(Lexer("`--edit`", args.edit)) if log.is_debug: log.debug(f"edit: {parser}") diff --git a/auto_editor/utils/types.py b/auto_editor/utils/types.py index 9bd60a653..342ecb472 100644 --- a/auto_editor/utils/types.py +++ b/auto_editor/utils/types.py @@ -210,7 +210,7 @@ class Args: sample_rate: int | None = None resolution: tuple[int, int] | None = None background: str = "#000000" - edit_based_on: str = "audio" + edit: str = "audio" keep_tracks_separate: bool = False audio_normalize: str = "#f" export: str | None = None