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

Function test_corrupt_video

tests/test_video_stream.py:361–375  ·  view source on GitHub ↗

Test that backend handles video with corrupt frame gracefully with defaults.

(vs_type: ty.Callable[..., VideoStream], corrupt_video_file: str)

Source from the content-addressed store, hash-verified

359
360
361def test_corrupt_video(vs_type: ty.Callable[..., VideoStream], corrupt_video_file: str):
362 """Test that backend handles video with corrupt frame gracefully with defaults."""
363 if vs_type == VideoStreamMoviePy and get_moviepy_major_version() >= 2:
364 # Due to changes in MoviePy 2.0 (#461), loading this file causes an exception to be thrown.
365 # See https://github.com/Zulko/moviepy/pull/2253 for a PR that attempts to more gracefully
366 # handle this case, however even once that is fixed, we will be unable to run this test
367 # on certain versions of MoviePy.
368 pytest.skip(reason="https://github.com/Zulko/moviepy/pull/2253")
369
370 stream = vs_type(corrupt_video_file)
371
372 # OpenCV usually fails to read the video at frame 45, but the remaining frames all seem to
373 # decode just fine. Make sure all backends can get to 60 without reporting a failure.
374 for frame in range(60):
375 assert stream.read() is not False, f"Failed on frame {frame}!"

Callers

nothing calls this directly

Calls 2

readMethod · 0.45

Tested by

no test coverage detected