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

Function test_split_video_ffmpeg_formatter

tests/test_output.py:66–91  ·  view source on GitHub ↗
(tmp_path, test_movie_clip)

Source from the content-addressed store, hash-verified

64
65@pytest.mark.skipif(condition=not is_ffmpeg_available(), reason="ffmpeg is not available")
66def 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`.

Callers

nothing calls this directly

Calls 2

open_videoFunction · 0.90
split_video_ffmpegFunction · 0.90

Tested by

no test coverage detected