@@ -1276,19 +1276,10 @@ def decode(self, file_path) -> torch.Tensor:
12761276
12771277 @pytest .mark .parametrize ("format" , ("mov" , "mp4" , "avi" , "mkv" , "webm" , "flv" ))
12781278 def test_video_encoder_test_round_trip (self , tmp_path , format ):
1279-
12801279 ffmpeg_version = get_ffmpeg_major_version ()
12811280 if ffmpeg_version == 4 and format == "webm" :
12821281 pytest .skip ("Codec for webm is not available in the FFmpeg4 installation." )
1283- # The output pixel format depends on the codecs available, and FFmpeg version.
1284- # In the cases where YUV420P is chosen and chroma subsampling happens, we need higher tolerance.
1285- if ffmpeg_version == 6 or format in ("avi" , "flv" ):
1286- atol = 55
1287- else :
1288- atol = 2
1289- # TODO-VideoEncoder: Test with FFmpeg's testsrc2 video
12901282 asset = NASA_VIDEO
1291-
12921283 # Test that decode(encode(decode(asset))) == decode(asset)
12931284 source_frames = self .decode (str (asset .path )).data
12941285
@@ -1297,6 +1288,13 @@ def test_video_encoder_test_round_trip(self, tmp_path, format):
12971288 encode_video_to_file (source_frames , frame_rate , encoded_path , crf = 0 )
12981289 round_trip_frames = self .decode (encoded_path ).data
12991290
1291+ # The output pixel format depends on the codecs available, and FFmpeg version.
1292+ # In the cases where YUV420P is chosen and chroma subsampling happens, assert_close needs higher tolerance.
1293+ if ffmpeg_version == 6 or format in ("avi" , "flv" ):
1294+ atol = 55
1295+ else :
1296+ atol = 2
1297+ # TODO-VideoEncoder: Test with FFmpeg's testsrc2 video
13001298 # Check that PSNR for decode(encode(samples)) is above 30
13011299 for s_frame , rt_frame in zip (source_frames , round_trip_frames ):
13021300 res = psnr (s_frame , rt_frame )
0 commit comments