@@ -1310,18 +1310,10 @@ def decode(self, file_path) -> torch.Tensor:
1310
1310
1311
1311
@pytest .mark .parametrize ("format" , ("mov" , "mp4" , "avi" , "mkv" , "webm" , "flv" ))
1312
1312
def test_video_encoder_test_round_trip (self , tmp_path , format ):
1313
-
1314
1313
ffmpeg_version = get_ffmpeg_major_version ()
1315
1314
if ffmpeg_version == 4 and format == "webm" :
1316
1315
pytest .skip ("Codec for webm is not available in the FFmpeg4 installation." )
1317
- # The output pixel format depends on the codecs available, and FFmpeg version.
1318
- # In the cases where YUV420P is chosen and chroma subsampling happens, we need higher tolerance.
1319
- if ffmpeg_version == 6 or format in ("avi" , "flv" ):
1320
- atol = 55
1321
- else :
1322
- atol = 2
1323
1316
asset = NASA_VIDEO
1324
-
1325
1317
# Test that decode(encode(decode(asset))) == decode(asset)
1326
1318
source_frames = self .decode (str (asset .path )).data
1327
1319
@@ -1330,6 +1322,13 @@ def test_video_encoder_test_round_trip(self, tmp_path, format):
1330
1322
encode_video_to_file (source_frames , frame_rate , encoded_path , crf = 0 )
1331
1323
round_trip_frames = self .decode (encoded_path ).data
1332
1324
1325
+ # The output pixel format depends on the codecs available, and FFmpeg version.
1326
+ # In the cases where YUV420P is chosen and chroma subsampling happens, assert_close needs higher tolerance.
1327
+ if ffmpeg_version == 6 or format in ("avi" , "flv" ):
1328
+ atol = 55
1329
+ else :
1330
+ atol = 2
1331
+ # TODO-VideoEncoder: Test with FFmpeg's testsrc2 video
1333
1332
# Check that PSNR for decode(encode(samples)) is above 30
1334
1333
for s_frame , rt_frame in zip (source_frames , round_trip_frames ):
1335
1334
res = psnr (s_frame , rt_frame )
0 commit comments