def test_is_missing(): vid = Video.from_media(TEST_SMALL_ROBOT_MP4_FILE) assert not vid.is_missing vid = Video.from_media("non-existent-filename.mp4") assert vid.is_missing vid = Video.from_numpy( Video.from_media(TEST_SMALL_ROBOT_MP4_FILE).get_frames((3, 7, 9))) assert not vid.is_missing
def test_numpy_video_backend(): vid = Video.from_numpy(np.zeros((1, 2, 3, 1))) assert vid.test_frame.shape == (2, 3, 1) vid.backend.set_video_ndarray(np.ones((2, 3, 4, 1))) assert vid.get_frame(1).shape == (3, 4, 1)
def test_numpy_frames(small_robot_mp4_vid): clip_frames = small_robot_mp4_vid.get_frames((3, 7, 9)) np_vid = Video.from_numpy(clip_frames) assert np.all(np.equal(np_vid.get_frame(1), small_robot_mp4_vid.get_frame(7)))