From 4218358109bcd0ce17b2db18d302a2f27d7562a9 Mon Sep 17 00:00:00 2001 From: Joe Schiffler <41972063+JoeSchiff@users.noreply.github.com> Date: Sun, 29 Dec 2024 13:00:04 -0500 Subject: [PATCH] test svtav1 --- tests/test_decode.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/test_decode.py b/tests/test_decode.py index c1846af69..9dd18028c 100644 --- a/tests/test_decode.py +++ b/tests/test_decode.py @@ -238,3 +238,26 @@ def test_hardware_decode(self) -> None: frame_count += 1 assert frame_count == video_stream.frames + + def test_libsvtav1(self) -> None: + if not "libsvtav1" in av.codecs_available: + pytest.skip() + + output = av.open("output.mp4", "w") + stream = output.add_stream("libsvtav1") + + 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