@@ -1384,19 +1384,20 @@ def decode(self, file_path) -> torch.Tensor:
13841384 frames , * _ = get_frames_in_range (decoder , start = 0 , stop = 60 )
13851385 return frames
13861386
1387- @pytest .mark .parametrize ("format" , ("mov" , "mp4" , "avi" , " mkv" , "webm" , "flv " ))
1387+ @pytest .mark .parametrize ("format" , ("mov" , "mp4" , "mkv" , "webm" ))
13881388 def test_video_encoder_round_trip (self , tmp_path , format ):
13891389 # Test that decode(encode(decode(asset))) == decode(asset)
13901390 ffmpeg_version = get_ffmpeg_major_version ()
1391- if format == "webm" :
1392- if ffmpeg_version == 4 :
1393- pytest .skip (
1394- "Codec for webm is not available in the FFmpeg4 installation."
1395- )
1396- if IS_WINDOWS and ffmpeg_version in (6 , 7 ):
1397- pytest .skip (
1398- "Codec for webm is not available in the FFmpeg6/7 installation on Windows."
1399- )
1391+ # In FFmpeg6, the default codec's best pixel format is lossy for all container formats but webm.
1392+ # As a result, we skip the round trip test.
1393+ if ffmpeg_version == 6 and format != "webm" :
1394+ pytest .skip (
1395+ f"FFmpeg6 defaults to lossy encoding for { format } , skipping round-trip test."
1396+ )
1397+ if format == "webm" and (
1398+ ffmpeg_version == 4 or (IS_WINDOWS and ffmpeg_version in (6 , 7 ))
1399+ ):
1400+ pytest .skip ("Codec for webm is not available in this FFmpeg installation." )
14001401 asset = TEST_SRC_2_720P
14011402 source_frames = self .decode (str (asset .path )).data
14021403
@@ -1448,9 +1449,8 @@ def test_video_encoder_against_ffmpeg_cli(self, tmp_path, format):
14481449 ffmpeg_encoded_path = str (tmp_path / f"ffmpeg_output.{ format } " )
14491450 crf = 0
14501451 quality_params = ["-crf" , str (crf )]
1451- # Some codecs (ex. MPEG4) do not support CRF, qscale is used for lossless encoding.
1452- # Flags not supported by the selected codec will be ignored, so we set both crf and qscale.
1453- quality_params += ["-q:v" , str (crf )]
1452+ # Some codecs (ex. MPEG4) do not support CRF.
1453+ # Flags not supported by the selected codec will be ignored.
14541454 ffmpeg_cmd = [
14551455 "ffmpeg" ,
14561456 "-y" ,
@@ -1486,7 +1486,7 @@ def test_video_encoder_against_ffmpeg_cli(self, tmp_path, format):
14861486 # If FFmpeg selects a codec or pixel format that uses qscale (not crf),
14871487 # the VideoEncoder outputs *slightly* different frames.
14881488 # There may be additional subtle differences in the encoder.
1489- percentage = 97 if ffmpeg_version == 6 or format in ("avi" ) else 99
1489+ percentage = 95 if ffmpeg_version == 6 or format in ("avi" ) else 99
14901490
14911491 # Check that PSNR between both encoded versions is high
14921492 for ff_frame , enc_frame in zip (ffmpeg_frames , encoder_frames ):
0 commit comments