@@ -1310,18 +1310,10 @@ def decode(self, file_path) -> torch.Tensor:
13101310
13111311 @pytest .mark .parametrize ("format" , ("mov" , "mp4" , "avi" , "mkv" , "webm" , "flv" ))
13121312 def test_video_encoder_test_round_trip (self , tmp_path , format ):
1313-
13141313 ffmpeg_version = get_ffmpeg_major_version ()
13151314 if ffmpeg_version == 4 and format == "webm" :
13161315 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
13231316 asset = NASA_VIDEO
1324-
13251317 # Test that decode(encode(decode(asset))) == decode(asset)
13261318 source_frames = self .decode (str (asset .path )).data
13271319
@@ -1330,6 +1322,13 @@ def test_video_encoder_test_round_trip(self, tmp_path, format):
13301322 encode_video_to_file (source_frames , frame_rate , encoded_path , crf = 0 )
13311323 round_trip_frames = self .decode (encoded_path ).data
13321324
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
13331332 # Check that PSNR for decode(encode(samples)) is above 30
13341333 for s_frame , rt_frame in zip (source_frames , round_trip_frames ):
13351334 res = psnr (s_frame , rt_frame )
0 commit comments