Skip to content

Commit 2ad5ba8

Browse files
NicolasHugfacebook-github-bot
authored andcommitted
[fbsync] Removed test_audio_video_sync as it doesn't work as expected (#4050)
Reviewed By: fmassa Differential Revision: D29097708 fbshipit-source-id: accd0d11c1240c07fd3fd5483238eeec6c8b4a8d
1 parent 9d94c22 commit 2ad5ba8

File tree

1 file changed

+0
-39
lines changed

1 file changed

+0
-39
lines changed

test/test_video_reader.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,45 +1235,6 @@ def test_read_video_from_memory_scripted(self):
12351235
)
12361236
# FUTURE: check value of video / audio frames
12371237

1238-
def test_audio_video_sync(self):
1239-
"""Test if audio/video are synchronised with pyav output."""
1240-
for test_video, config in test_videos.items():
1241-
full_path = os.path.join(VIDEO_DIR, test_video)
1242-
container = av.open(full_path)
1243-
if not container.streams.audio:
1244-
# Skip if no audio stream
1245-
continue
1246-
start_pts_val, cutoff = 0, 1
1247-
if container.streams.video:
1248-
video = container.streams.video[0]
1249-
arr = []
1250-
for index, frame in enumerate(container.decode(video)):
1251-
if index == cutoff:
1252-
start_pts_val = frame.pts
1253-
if index >= cutoff:
1254-
arr.append(frame.to_rgb().to_ndarray())
1255-
visual, _, info = io.read_video(full_path, start_pts=start_pts_val, pts_unit='pts')
1256-
self.assertAlmostEqual(
1257-
config.video_fps, info['video_fps'], delta=0.0001
1258-
)
1259-
arr = torch.Tensor(arr)
1260-
if arr.shape == visual.shape:
1261-
self.assertGreaterEqual(
1262-
torch.mean(torch.isclose(visual.float(), arr, atol=1e-5).float()), 0.99)
1263-
1264-
container = av.open(full_path)
1265-
if container.streams.audio:
1266-
audio = container.streams.audio[0]
1267-
arr = []
1268-
for index, frame in enumerate(container.decode(audio)):
1269-
if index >= cutoff:
1270-
arr.append(frame.to_ndarray())
1271-
_, audio, _ = io.read_video(full_path, start_pts=start_pts_val, pts_unit='pts')
1272-
arr = torch.as_tensor(np.concatenate(arr, axis=1))
1273-
if arr.shape == audio.shape:
1274-
self.assertGreaterEqual(
1275-
torch.mean(torch.isclose(audio.float(), arr).float()), 0.99)
1276-
12771238
def test_invalid_file(self):
12781239
set_video_backend('video_reader')
12791240
with self.assertRaises(RuntimeError):

0 commit comments

Comments
 (0)