Skip to content

Commit 9224666

Browse files
charlesvestalclaude
andcommitted
split-video: rename --expand-to-video to --expand, add cfg/docs
Addresses PR #551 review: - Rename CLI flag --expand-to-video to --expand (terser form). - Add `expand` entry to scenedetect.cfg template. - Document --expand option in docs/cli.rst. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 86625cf commit 9224666

5 files changed

Lines changed: 17 additions & 8 deletions

File tree

docs/cli.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,10 @@ Options
857857

858858
Split video using mkvmerge. Faster than re-encoding, but less precise. If set, options other than :option:`-f/--filename <-f>`, :option:`-q/--quiet <-q>` and :option:`-o/--output <-o>` will be ignored. Note that mkvmerge automatically appends the $SCENE_NUMBER suffix.
859859

860+
.. option:: --expand
861+
862+
Extend the first/last output clips to cover the full input video, even if the :ref:`time <command-time>` command's ``--start``/``--end`` limited the analysis window. Useful for keeping content outside the analyzed region attached to the adjacent split.
863+
860864

861865
.. _command-time:
862866

scenedetect.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@
206206
# Arguments to specify to ffmpeg for encoding. Quotes are not required.
207207
#args = -map 0:v:0 -map 0:a? -map 0:s? -c:v libx264 -preset veryfast -crf 22 -c:a aac
208208

209+
# Extend the first/last output clips to cover the full input video, even if
210+
# `time -s/-e` limited the analysis window. Useful for keeping content outside
211+
# the analyzed region attached to the adjacent split.
212+
#expand = no
213+
209214

210215
[save-images]
211216
# Folder to output videos. Overrides [global] output option.

scenedetect/_cli/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,12 +1295,12 @@ def list_scenes_command(
12951295
),
12961296
)
12971297
@click.option(
1298-
"--expand-to-video",
1298+
"--expand",
12991299
is_flag=True,
13001300
flag_value=True,
13011301
default=False,
13021302
help="Extend the first/last output clips to cover the full input video, even if `time -s/-e` limited the analysis window. Useful for keeping content outside the analyzed region attached to the adjacent split.{}".format(
1303-
USER_CONFIG.get_help_string("split-video", "expand-to-video")
1303+
USER_CONFIG.get_help_string("split-video", "expand")
13041304
),
13051305
)
13061306
@click.pass_context
@@ -1315,7 +1315,7 @@ def split_video_command(
13151315
preset: str | None,
13161316
args: str | None,
13171317
mkvmerge: bool,
1318-
expand_to_video: bool,
1318+
expand: bool,
13191319
):
13201320
ctx = ctx.obj
13211321
assert isinstance(ctx, CliContext)
@@ -1382,7 +1382,7 @@ def split_video_command(
13821382
"output": ctx.config.get_value("split-video", "output", output),
13831383
"show_output": not ctx.config.get_value("split-video", "quiet", quiet),
13841384
"ffmpeg_args": args,
1385-
"expand_to_video": ctx.config.get_value("split-video", "expand-to-video", expand_to_video),
1385+
"expand": ctx.config.get_value("split-video", "expand", expand),
13861386
}
13871387
ctx.add_command(cli_commands.split_video, split_video_args)
13881388

scenedetect/_cli/commands.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,16 @@ def split_video(
217217
output: str,
218218
show_output: bool,
219219
ffmpeg_args: str,
220-
expand_to_video: bool,
220+
expand: bool,
221221
):
222222
"""Handles the `split-video` command."""
223223
del cuts # split-video only uses scenes.
224224
assert context.video_stream is not None
225225

226-
if expand_to_video and scenes:
226+
if expand and scenes:
227227
video_duration = context.video_stream.duration
228228
if video_duration is None:
229-
logger.warning("Cannot expand-to-video: video duration is unavailable for this stream.")
229+
logger.warning("Cannot --expand: video duration is unavailable for this stream.")
230230
else:
231231
scenes = expand_scenes_to_bounds(
232232
scenes,

scenedetect/_cli/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ class FcpFormat(Enum):
468468
"split-video": {
469469
"args": _DEFAULT_FFMPEG_ARGS,
470470
"copy": False,
471-
"expand-to-video": False,
471+
"expand": False,
472472
"filename": "$VIDEO_NAME-Scene-$SCENE_NUMBER",
473473
"high-quality": False,
474474
"mkvmerge": False,

0 commit comments

Comments
 (0)