Skip to content

Commit 3dcded8

Browse files
committed
test svtav1
1 parent 892c999 commit 3dcded8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/test_decode.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,26 @@ def test_hardware_decode(self) -> None:
238238
frame_count += 1
239239

240240
assert frame_count == video_stream.frames
241+
242+
def test_libsvtav1(self) -> None:
243+
if not "libsvtav1" in av.codecs_available:
244+
pytest.skip()
245+
246+
output = av.open("output.mp4", "w")
247+
stream = output.add_stream("libsvtav1")
248+
249+
for i in range(24):
250+
frame = av.VideoFrame(200, 100, "rgb24")
251+
frame.pts = i * 2000
252+
frame.time_base = Fraction(1, 48000)
253+
for packet in stream.encode(frame):
254+
assert packet.time_base == Fraction(1, 24)
255+
output.mux(packet)
256+
257+
for packet in stream.encode(None):
258+
assert packet.time_base == Fraction(1, 24)
259+
output.mux(packet)
260+
261+
assert output.streams[0].codec.name == "libsvtav1"
262+
assert output.streams[0].codec.is_encoder is True
263+
assert output.streams[0].frames == 24

0 commit comments

Comments
 (0)