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

Function test_vfr_csv_accuracy

tests/test_vfr.py:274–296  ·  view source on GitHub ↗

CSV timecodes for VFR video should match known ground truth for both backends.

(test_vfr_video: str, backend: str, tmp_path)

Source from the content-addressed store, hash-verified

272
273@pytest.mark.parametrize("backend", ["pyav", "opencv"])
274def test_vfr_csv_accuracy(test_vfr_video: str, backend: str, tmp_path):
275 """CSV timecodes for VFR video should match known ground truth for both backends."""
276 video = open_video(test_vfr_video, backend=backend)
277 sm = SceneManager()
278 sm.add_detector(ContentDetector())
279 sm.detect_scenes(video=video, end_time=10.0)
280 scene_list = sm.get_scene_list()
281 assert len(scene_list) >= len(EXPECTED_SCENES_VFR)
282
283 csv_path = tmp_path / "scenes.csv"
284 with open(csv_path, "w", newline="") as f:
285 write_scene_list(f, scene_list, include_cut_list=False)
286
287 with open(csv_path) as f:
288 rows = list(csv.DictReader(f))
289
290 for i, (row, (exp_start, exp_end)) in enumerate(zip(rows, EXPECTED_SCENES_VFR, strict=False)):
291 assert row["Start Timecode"] == exp_start, (
292 f"[{backend}] Scene {i + 1} start: expected {exp_start!r}, got {row['Start Timecode']!r}"
293 )
294 assert row["End Timecode"] == exp_end, (
295 f"[{backend}] Scene {i + 1} end: expected {exp_end!r}, got {row['End Timecode']!r}"
296 )
297
298
299@pytest.mark.parametrize("backend", ["pyav", "opencv"])

Callers

nothing calls this directly

Calls 7

add_detectorMethod · 0.95
detect_scenesMethod · 0.95
get_scene_listMethod · 0.95
open_videoFunction · 0.90
SceneManagerClass · 0.90
ContentDetectorClass · 0.90
write_scene_listFunction · 0.90

Tested by

no test coverage detected