Test `split-video` command using mkvmerge.
(tmp_path: Path)
| 551 | |
| 552 | @pytest.mark.skipif(condition=not is_mkvmerge_available(), reason="mkvmerge is not available") |
| 553 | def test_cli_split_video_mkvmerge(tmp_path: Path): |
| 554 | """Test `split-video` command using mkvmerge.""" |
| 555 | assert ( |
| 556 | invoke_scenedetect( |
| 557 | "-i {VIDEO} -s {STATS} time {TIME} {DETECTOR} split-video -m", output_dir=tmp_path |
| 558 | ) |
| 559 | == 0 |
| 560 | ) |
| 561 | for scene in range(DEFAULT_NUM_SCENES): |
| 562 | path = tmp_path / (Path(DEFAULT_VIDEO_PATH).stem + f"-Scene-{1 + scene:03d}.mkv") |
| 563 | path.unlink(missing_ok=False) |
| 564 | # If only one scene (just using a few frames), should keep same output template. |
| 565 | assert ( |
| 566 | invoke_scenedetect( |
| 567 | "-i {VIDEO} -s {STATS} time -e 3 {DETECTOR} split-video -m", output_dir=tmp_path |
| 568 | ) |
| 569 | == 0 |
| 570 | ) |
| 571 | path = tmp_path / (Path(DEFAULT_VIDEO_PATH).stem + "-Scene-001.mkv") |
| 572 | path.unlink(missing_ok=False) |
| 573 | # -m takes precedence over -c |
| 574 | assert ( |
| 575 | invoke_scenedetect( |
| 576 | "-i {VIDEO} -s {STATS} time {TIME} {DETECTOR} split-video -m -c", output_dir=tmp_path |
| 577 | ) |
| 578 | == 0 |
| 579 | ) |
| 580 | # Custom filename format |
| 581 | for scene in range(DEFAULT_NUM_SCENES): |
| 582 | path = tmp_path / (Path(DEFAULT_VIDEO_PATH).stem + f"-Scene-{1 + scene:03d}.mkv") |
| 583 | path.unlink(missing_ok=False) |
| 584 | assert ( |
| 585 | invoke_scenedetect( |
| 586 | "-i {VIDEO} -s {STATS} time {TIME} {DETECTOR} split-video -m -f test$VIDEO_NAME", |
| 587 | output_dir=tmp_path, |
| 588 | ) |
| 589 | == 0 |
| 590 | ) |
| 591 | for scene in range(DEFAULT_NUM_SCENES): |
| 592 | path = tmp_path / ("test" + Path(DEFAULT_VIDEO_PATH).stem + f"-{1 + scene:03d}.mkv") |
| 593 | path.unlink(missing_ok=False) |
| 594 | # -a/--args and -m/--mkvmerge are mutually exclusive |
| 595 | assert invoke_scenedetect( |
| 596 | '-i {VIDEO} -s {STATS} time {TIME} {DETECTOR} split-video -m -a "-c:v libx264"', |
| 597 | output_dir=tmp_path, |
| 598 | ) |
| 599 | |
| 600 | |
| 601 | def test_cli_save_images(tmp_path: Path): |
nothing calls this directly
no test coverage detected