Scene detection on VFR video should produce timestamps matching known ground truth. Both PyAV (native PTS) and OpenCV (CAP_PROP_POS_MSEC) should agree on scene cuts since both expose accurate PTS-derived timestamps.
(test_vfr_video: str, backend: str)
| 97 | |
| 98 | @pytest.mark.parametrize("backend", ["pyav", "opencv"]) |
| 99 | def test_vfr_scene_detection(test_vfr_video: str, backend: str): |
| 100 | """Scene detection on VFR video should produce timestamps matching known ground truth. |
| 101 | |
| 102 | Both PyAV (native PTS) and OpenCV (CAP_PROP_POS_MSEC) should agree on scene cuts since |
| 103 | both expose accurate PTS-derived timestamps. |
| 104 | """ |
| 105 | video = open_video(test_vfr_video, backend=backend) |
| 106 | sm = SceneManager() |
| 107 | sm.add_detector(ContentDetector()) |
| 108 | sm.detect_scenes(video=video, end_time=10.0) |
| 109 | scene_list = sm.get_scene_list() |
| 110 | |
| 111 | # The last scene ends at the clip boundary which may vary by backend; only check known cuts. |
| 112 | assert len(scene_list) >= len(EXPECTED_SCENES_VFR), ( |
| 113 | f"[{backend}] Expected at least {len(EXPECTED_SCENES_VFR)} scenes, got {len(scene_list)}" |
| 114 | ) |
| 115 | for i, ((start, end), (exp_start_tc, exp_end_tc)) in enumerate( |
| 116 | zip(scene_list, EXPECTED_SCENES_VFR, strict=False) |
| 117 | ): |
| 118 | assert start.get_timecode() == exp_start_tc, ( |
| 119 | f"[{backend}] Scene {i + 1} start: expected {exp_start_tc!r}, got {start.get_timecode()!r}" |
| 120 | ) |
| 121 | assert end.get_timecode() == exp_end_tc, ( |
| 122 | f"[{backend}] Scene {i + 1} end: expected {exp_end_tc!r}, got {end.get_timecode()!r}" |
| 123 | ) |
| 124 | |
| 125 | |
| 126 | def test_vfr_seek_pyav(test_vfr_video: str): |
nothing calls this directly
no test coverage detected