From 9470ced2a15e8f824f8d5d929f7503f45e9b2e81 Mon Sep 17 00:00:00 2001 From: Prabhat Roy Date: Fri, 11 Jun 2021 15:52:14 +0100 Subject: [PATCH] Removed test_audio_video_sync as it doesn't work as expected --- test/test_video_reader.py | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/test/test_video_reader.py b/test/test_video_reader.py index e13aeb537f2..e9a1adedb83 100644 --- a/test/test_video_reader.py +++ b/test/test_video_reader.py @@ -1235,45 +1235,6 @@ def test_read_video_from_memory_scripted(self): ) # FUTURE: check value of video / audio frames - def test_audio_video_sync(self): - """Test if audio/video are synchronised with pyav output.""" - for test_video, config in test_videos.items(): - full_path = os.path.join(VIDEO_DIR, test_video) - container = av.open(full_path) - if not container.streams.audio: - # Skip if no audio stream - continue - start_pts_val, cutoff = 0, 1 - if container.streams.video: - video = container.streams.video[0] - arr = [] - for index, frame in enumerate(container.decode(video)): - if index == cutoff: - start_pts_val = frame.pts - if index >= cutoff: - arr.append(frame.to_rgb().to_ndarray()) - visual, _, info = io.read_video(full_path, start_pts=start_pts_val, pts_unit='pts') - self.assertAlmostEqual( - config.video_fps, info['video_fps'], delta=0.0001 - ) - arr = torch.Tensor(arr) - if arr.shape == visual.shape: - self.assertGreaterEqual( - torch.mean(torch.isclose(visual.float(), arr, atol=1e-5).float()), 0.99) - - container = av.open(full_path) - if container.streams.audio: - audio = container.streams.audio[0] - arr = [] - for index, frame in enumerate(container.decode(audio)): - if index >= cutoff: - arr.append(frame.to_ndarray()) - _, audio, _ = io.read_video(full_path, start_pts=start_pts_val, pts_unit='pts') - arr = torch.as_tensor(np.concatenate(arr, axis=1)) - if arr.shape == audio.shape: - self.assertGreaterEqual( - torch.mean(torch.isclose(audio.float(), arr).float()), 0.99) - def test_invalid_file(self): set_video_backend('video_reader') with self.assertRaises(RuntimeError):