(tmp_path, test_movie_clip)
| 64 | |
| 65 | @pytest.mark.skipif(condition=not is_ffmpeg_available(), reason="ffmpeg is not available") |
| 66 | def test_split_video_ffmpeg_formatter(tmp_path, test_movie_clip): |
| 67 | video = open_video(test_movie_clip) |
| 68 | # Extract three hard-coded scenes for testing, each 30 frames. |
| 69 | scenes = [ |
| 70 | (video.base_timecode + 30, video.base_timecode + 60), |
| 71 | (video.base_timecode + 60, video.base_timecode + 90), |
| 72 | (video.base_timecode + 90, video.base_timecode + 120), |
| 73 | ] |
| 74 | |
| 75 | # Custom filename formatter: |
| 76 | def name_formatter(video: VideoMetadata, scene: SceneMetadata): |
| 77 | return "abc" + video.name + "-123-" + str(scene.index) + ".mp4" |
| 78 | |
| 79 | assert ( |
| 80 | split_video_ffmpeg( |
| 81 | test_movie_clip, |
| 82 | scenes, |
| 83 | output_dir=tmp_path, |
| 84 | arg_override=FFMPEG_ARGS, |
| 85 | formatter=name_formatter, |
| 86 | ) |
| 87 | == 0 |
| 88 | ) |
| 89 | video_name = Path(test_movie_clip).stem |
| 90 | entries = sorted(tmp_path.glob(f"abc{video_name}-123-*")) |
| 91 | assert len(entries) == len(scenes) |
| 92 | |
| 93 | |
| 94 | # TODO: Add tests for `split_video_mkvmerge`. |
nothing calls this directly
no test coverage detected