From 541b028588c1e660ed08865c578bc521c1587ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeremy=20Lain=C3=A9?= Date: Sun, 17 Apr 2022 18:40:24 +0200 Subject: [PATCH] [tests] use "h264" instead of "libx264" for tests (fixes: #951) This allows running the test suite against FFmpeg builds which do not have libx264 enabled. --- tests/test_codec_context.py | 8 ++------ tests/test_encode.py | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/test_codec_context.py b/tests/test_codec_context.py index ca9433678..27fcda5c9 100644 --- a/tests/test_codec_context.py +++ b/tests/test_codec_context.py @@ -204,7 +204,7 @@ def image_sequence_encode(self, codec_name): self.assertEqual(frame.format.name, pix_fmt) def test_encoding_h264(self): - self.video_encoding("libx264", {"crf": "19"}) + self.video_encoding("h264", {"crf": "19"}) def test_encoding_mpeg4(self): self.video_encoding("mpeg4") @@ -282,11 +282,7 @@ def video_encoding(self, codec_name, options={}, codec_tag=None): packet_sizes.append(packet.size) f.write(packet) - dec_codec_name = codec_name - if codec_name == "libx264": - dec_codec_name = "h264" - - ctx = av.Codec(dec_codec_name, "r").create() + ctx = av.Codec(codec_name, "r").create() ctx.open() decoded_frame_count = 0 diff --git a/tests/test_encode.py b/tests/test_encode.py index 018c6ac31..4ad5b203e 100644 --- a/tests/test_encode.py +++ b/tests/test_encode.py @@ -120,7 +120,7 @@ def test_encoding_with_pts(self): path = self.sandboxed("video_with_pts.mov") with av.open(path, "w") as output: - stream = output.add_stream("libx264", 24) + stream = output.add_stream("h264", 24) stream.width = WIDTH stream.height = HEIGHT stream.pix_fmt = "yuv420p"