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

Function test_vfr_csv_backend_conformance

tests/test_vfr.py:409–426  ·  view source on GitHub ↗

PyAV and OpenCV should produce identical scene timecodes for VFR video. Only the known interior scenes are compared; the last scene's end time may vary slightly between backends since it reflects the clip boundary rather than a detected cut.

(test_vfr_video: str)

Source from the content-addressed store, hash-verified

407
408
409def test_vfr_csv_backend_conformance(test_vfr_video: str):
410 """PyAV and OpenCV should produce identical scene timecodes for VFR video.
411
412 Only the known interior scenes are compared; the last scene's end time may vary slightly
413 between backends since it reflects the clip boundary rather than a detected cut.
414 """
415 timecodes: dict[str, list[tuple[str, str]]] = {}
416 for backend in ("pyav", "opencv"):
417 video = open_video(test_vfr_video, backend=backend)
418 sm = SceneManager()
419 sm.add_detector(ContentDetector())
420 sm.detect_scenes(video=video, end_time=10.0)
421 timecodes[backend] = [(s.get_timecode(), e.get_timecode()) for s, e in sm.get_scene_list()]
422 # Compare only the known scenes (last scene's end varies by backend at the clip boundary).
423 n = len(EXPECTED_SCENES_VFR)
424 assert timecodes["pyav"][:n] == timecodes["opencv"][:n], (
425 f"Backend timecode mismatch:\n pyav: {timecodes['pyav']}\n opencv: {timecodes['opencv']}"
426 )

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
get_timecodeMethod · 0.80

Tested by

no test coverage detected