@@ -1384,19 +1384,20 @@ def decode(self, file_path) -> torch.Tensor:
1384
1384
frames , * _ = get_frames_in_range (decoder , start = 0 , stop = 60 )
1385
1385
return frames
1386
1386
1387
- @pytest .mark .parametrize ("format" , ("mov" , "mp4" , "avi" , " mkv" , "webm" , "flv " ))
1387
+ @pytest .mark .parametrize ("format" , ("mov" , "mp4" , "mkv" , "webm" ))
1388
1388
def test_video_encoder_round_trip (self , tmp_path , format ):
1389
1389
# Test that decode(encode(decode(asset))) == decode(asset)
1390
1390
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." )
1400
1401
asset = TEST_SRC_2_720P
1401
1402
source_frames = self .decode (str (asset .path )).data
1402
1403
@@ -1448,9 +1449,8 @@ def test_video_encoder_against_ffmpeg_cli(self, tmp_path, format):
1448
1449
ffmpeg_encoded_path = str (tmp_path / f"ffmpeg_output.{ format } " )
1449
1450
crf = 0
1450
1451
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.
1454
1454
ffmpeg_cmd = [
1455
1455
"ffmpeg" ,
1456
1456
"-y" ,
@@ -1486,7 +1486,7 @@ def test_video_encoder_against_ffmpeg_cli(self, tmp_path, format):
1486
1486
# If FFmpeg selects a codec or pixel format that uses qscale (not crf),
1487
1487
# the VideoEncoder outputs *slightly* different frames.
1488
1488
# 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
1490
1490
1491
1491
# Check that PSNR between both encoded versions is high
1492
1492
for ff_frame , enc_frame in zip (ffmpeg_frames , encoder_frames ):
0 commit comments