@@ -1342,18 +1342,10 @@ def decode(self, file_path) -> torch.Tensor:
1342
1342
1343
1343
@pytest .mark .parametrize ("format" , ("mov" , "mp4" , "avi" , "mkv" , "webm" , "flv" ))
1344
1344
def test_video_encoder_test_round_trip (self , tmp_path , format ):
1345
-
1346
1345
ffmpeg_version = get_ffmpeg_major_version ()
1347
1346
if ffmpeg_version == 4 and format == "webm" :
1348
1347
pytest .skip ("Codec for webm is not available in the FFmpeg4 installation." )
1349
- # The output pixel format depends on the codecs available, and FFmpeg version.
1350
- # In the cases where YUV420P is chosen and chroma subsampling happens, we need higher tolerance.
1351
- if ffmpeg_version == 6 or format in ("avi" , "flv" ):
1352
- atol = 55
1353
- else :
1354
- atol = 2
1355
1348
asset = NASA_VIDEO
1356
-
1357
1349
# Test that decode(encode(decode(asset))) == decode(asset)
1358
1350
source_frames = self .decode (str (asset .path )).data
1359
1351
@@ -1362,6 +1354,13 @@ def test_video_encoder_test_round_trip(self, tmp_path, format):
1362
1354
encode_video_to_file (source_frames , frame_rate , encoded_path , crf = 0 )
1363
1355
round_trip_frames = self .decode (encoded_path ).data
1364
1356
1357
+ # The output pixel format depends on the codecs available, and FFmpeg version.
1358
+ # In the cases where YUV420P is chosen and chroma subsampling happens, assert_close needs higher tolerance.
1359
+ if ffmpeg_version == 6 or format in ("avi" , "flv" ):
1360
+ atol = 55
1361
+ else :
1362
+ atol = 2
1363
+ # TODO-VideoEncoder: Test with FFmpeg's testsrc2 video
1365
1364
# Check that PSNR for decode(encode(samples)) is above 30
1366
1365
for s_frame , rt_frame in zip (source_frames , round_trip_frames ):
1367
1366
res = psnr (s_frame , rt_frame )
0 commit comments