Skip to content

Commit 8b48e18

Browse files
committed
skip vp9 on windows, update error message to suggest calling ffmpeg cli
1 parent 6c15e76 commit 8b48e18

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

src/torchcodec/_core/Encoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ void VideoEncoder::initializeEncoder(
706706
avCodec != nullptr,
707707
"Video codec ",
708708
codec,
709-
" not found. Provide a codec name ('libx264', 'libx265') or a codec descriptor ('h264', 'hevc'), or do not specify a codec to use the default codec.");
709+
" not found. To see available codecs, run: ffmpeg -encoders");
710710
} else {
711711
avCodec = avcodec_find_encoder(avFormatContext_->oformat->video_codec);
712712
TORCH_CHECK(avCodec != nullptr, "Video codec not found");

test/test_encoders.py

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -690,24 +690,6 @@ def test_bad_input(self, tmp_path):
690690
):
691691
encoder.to_tensor(format="bad_format")
692692

693-
# @pytest.mark.parametrize("method", ["to_file", "to_tensor", "to_file_like"])
694-
# @pytest.mark.parametrize("codec", ["h264", "hevc", "av1", "libx264", None])
695-
# def test_codec_valid_values(self, method, codec, tmp_path):
696-
# if method == "to_file":
697-
# valid_params = {"dest": str(tmp_path / "test.mp4")}
698-
# elif method == "to_tensor":
699-
# valid_params = {"format": "mp4"}
700-
# elif method == "to_file_like":
701-
# valid_params = dict(file_like=io.BytesIO(), format="mp4")
702-
# else:
703-
# raise ValueError(f"Unknown method: {method}")
704-
705-
# encoder = VideoEncoder(
706-
# frames=torch.zeros((5, 3, 128, 128), dtype=torch.uint8),
707-
# frame_rate=30,
708-
# )
709-
# getattr(encoder, method)(**valid_params, codec=codec)
710-
711693
@pytest.mark.parametrize("method", ("to_file", "to_tensor", "to_file_like"))
712694
def test_pixel_format_errors(self, method, tmp_path):
713695
frames = torch.zeros((5, 3, 64, 64), dtype=torch.uint8)
@@ -1022,7 +1004,13 @@ def write(self, data):
10221004
("mp4", "hevc"),
10231005
("mkv", "av1"),
10241006
("avi", "mpeg4"),
1025-
("webm", "vp9"),
1007+
pytest.param(
1008+
"webm",
1009+
"vp9",
1010+
marks=pytest.mark.skipif(
1011+
IS_WINDOWS, reason="vp9 codec not available on Windows"
1012+
),
1013+
),
10261014
],
10271015
)
10281016
def test_codec_parameter_utilized(self, tmp_path, format, codec_spec):
@@ -1043,7 +1031,13 @@ def test_codec_parameter_utilized(self, tmp_path, format, codec_spec):
10431031
[
10441032
("h264", "libx264"),
10451033
("av1", "libaom-av1"),
1046-
("vp9", "libvpx-vp9"),
1034+
pytest.param(
1035+
"vp9",
1036+
"libvpx-vp9",
1037+
marks=pytest.mark.skipif(
1038+
IS_WINDOWS, reason="vp9 codec not available on Windows"
1039+
),
1040+
),
10471041
],
10481042
)
10491043
def test_codec_spec_vs_impl_equivalence(self, tmp_path, codec_spec, codec_impl):

0 commit comments

Comments
 (0)