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)
| 407 | |
| 408 | |
| 409 | def 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 | ) |
nothing calls this directly
no test coverage detected