MCPcopy Index your code
hub / github.com/Breakthrough/PySceneDetect / split_video_command

Function split_video_command

scenedetect/_cli/__init__.py:1298–1376  ·  view source on GitHub ↗
(
    ctx: click.Context,
    output: str | None,
    filename: str | None,
    quiet: bool,
    copy: bool,
    high_quality: bool,
    rate_factor: int | None,
    preset: str | None,
    args: str | None,
    mkvmerge: bool,
)

Source from the content-addressed store, hash-verified

1296)
1297@click.pass_context
1298def split_video_command(
1299 ctx: click.Context,
1300 output: str | None,
1301 filename: str | None,
1302 quiet: bool,
1303 copy: bool,
1304 high_quality: bool,
1305 rate_factor: int | None,
1306 preset: str | None,
1307 args: str | None,
1308 mkvmerge: bool,
1309):
1310 ctx = ctx.obj
1311 assert isinstance(ctx, CliContext)
1312
1313 check_split_video_requirements(use_mkvmerge=mkvmerge)
1314 assert ctx.video_stream is not None
1315 if "%" in ctx.video_stream.path or "://" in ctx.video_stream.path:
1316 error = "The split-video command is incompatible with image sequences/URLs."
1317 raise click.BadParameter(error, param_hint="split-video")
1318
1319 # Overwrite flags if no encoder flags/options were set via the CLI to avoid conflicting options
1320 # (e.g. `--copy` should override any `high-quality = yes` setting in the config file).
1321 if not (mkvmerge or copy or high_quality or args or rate_factor or preset):
1322 mkvmerge = ctx.config.get_value("split-video", "mkvmerge")
1323 copy = ctx.config.get_value("split-video", "copy")
1324 high_quality = ctx.config.get_value("split-video", "high-quality")
1325 rate_factor = ctx.config.get_value("split-video", "rate-factor")
1326 preset = ctx.config.get_value("split-video", "preset")
1327 args = ctx.config.get_value("split-video", "args")
1328
1329 # Disallow certain combinations of options.
1330 if mkvmerge or copy:
1331 command = "mkvmerge (-m)" if mkvmerge else "copy (-c)"
1332 if high_quality:
1333 raise click.BadParameter(
1334 f"high-quality (-hq) cannot be used with {command}",
1335 param_hint="split-video",
1336 )
1337 if args:
1338 raise click.BadParameter(
1339 f"args (-a) cannot be used with {command}", param_hint="split-video"
1340 )
1341 if rate_factor:
1342 raise click.BadParameter(
1343 f"rate-factor (crf) cannot be used with {command}", param_hint="split-video"
1344 )
1345 if preset:
1346 raise click.BadParameter(
1347 f"preset (-p) cannot be used with {command}", param_hint="split-video"
1348 )
1349
1350 # mkvmerge-Specific Options
1351 if mkvmerge and copy:
1352 logger.warning("copy mode (-c) ignored due to mkvmerge mode (-m).")
1353
1354 # ffmpeg-Specific Options
1355 if copy:

Callers

nothing calls this directly

Calls 3

get_valueMethod · 0.80
add_commandMethod · 0.80

Tested by

no test coverage detected