From ee823cb04f440d0d5e471fa86139e6dcac9a41c7 Mon Sep 17 00:00:00 2001 From: Joe Schiffler <41972063+JoeSchiff@users.noreply.github.com> Date: Sun, 29 Dec 2024 13:41:05 -0500 Subject: [PATCH] test svtav1 --- tests/test_encode.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test_encode.py b/tests/test_encode.py index c107aa044..ff487b2de 100644 --- a/tests/test_encode.py +++ b/tests/test_encode.py @@ -167,6 +167,30 @@ def test_encoding_with_unicode_filename(self) -> None: with av.open(path) as input: assert_rgb_rotate(self, input) + def test_libsvtav1(self) -> None: + if not "libsvtav1" in av.codecs_available: + pytest.skip() + + with av.open(self.sandboxed("output.mp4"), "w") as output: + stream = output.add_stream("libsvtav1", 24) + assert isinstance(stream, VideoStream) + + for i in range(24): + frame = av.VideoFrame(200, 100, "rgb24") + frame.pts = i * 2000 + frame.time_base = Fraction(1, 48000) + for packet in stream.encode(frame): + assert packet.time_base == Fraction(1, 24) + output.mux(packet) + + for packet in stream.encode(None): + assert packet.time_base == Fraction(1, 24) + output.mux(packet) + + assert output.streams[0].codec.name == "libsvtav1" + assert output.streams[0].codec.is_encoder is True + assert output.streams[0].frames == 24 + class TestBasicAudioEncoding(TestCase): def test_default_options(self) -> None: