MCPcopy Create free account
hub / github.com/Breakthrough/PySceneDetect / test_cli_split_video_ffmpeg

Function test_cli_split_video_ffmpeg

tests/test_cli.py:516–549  ·  view source on GitHub ↗

Test `split-video` command using ffmpeg.

(tmp_path: Path)

Source from the content-addressed store, hash-verified

514
515@pytest.mark.skipif(condition=not is_ffmpeg_available(), reason="ffmpeg is not available")
516def test_cli_split_video_ffmpeg(tmp_path: Path):
517 """Test `split-video` command using ffmpeg."""
518
519 # Assumption: The default filename format is VIDEO_NAME-Scene-SCENE_NUMBER.
520 command = f"{SCENEDETECT_CMD} -i {DEFAULT_VIDEO_PATH} -o {tmp_path} time {DEFAULT_TIME} {DEFAULT_DETECTOR} split-video -a".split(
521 " "
522 )
523 command.append(DEFAULT_FFMPEG_ARGS)
524 assert subprocess.call(command) == 0
525 entries = sorted(tmp_path.glob(f"{DEFAULT_VIDEO_NAME}-Scene-*"))
526 assert len(entries) == DEFAULT_NUM_SCENES, entries
527 [entry.unlink() for entry in entries]
528
529 assert (
530 invoke_scenedetect(
531 "-i {VIDEO} -s {STATS} time {TIME} {DETECTOR} split-video -c", output_dir=tmp_path
532 )
533 == 0
534 )
535 entries = sorted(tmp_path.glob(f"{DEFAULT_VIDEO_NAME}-Scene-*"))
536 assert len(entries) == DEFAULT_NUM_SCENES
537 [entry.unlink() for entry in entries]
538
539 command += ["-f", "abc$VIDEO_NAME-123$SCENE_NUMBER"]
540 assert subprocess.call(command) == 0
541 entries = sorted(tmp_path.glob(f"abc{DEFAULT_VIDEO_NAME}-123*"))
542 assert len(entries) == DEFAULT_NUM_SCENES, entries
543 [entry.unlink() for entry in entries]
544
545 # -a/--args and -c/--copy are mutually exclusive, so this command should fail (return nonzero)
546 assert invoke_scenedetect(
547 '-i {VIDEO} {DETECTOR} split-video -c -a "-c:v libx264"',
548 output_dir=tmp_path,
549 )
550
551
552@pytest.mark.skipif(condition=not is_mkvmerge_available(), reason="mkvmerge is not available")

Callers

nothing calls this directly

Calls 1

invoke_scenedetectFunction · 0.85

Tested by

no test coverage detected