Skip to content

Commit 5ee6007

Browse files
committed
test svtav1
1 parent 892c999 commit 5ee6007

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

tests/test_encode.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def test_encoding_with_pts(self) -> None:
141141

142142
with av.open(path, "w") as output:
143143
stream = output.add_stream("h264", 24)
144-
assert stream in output.streams.video
144+
print(11111111111, dir(stream))
145145
stream.width = WIDTH
146146
stream.height = HEIGHT
147147
stream.pix_fmt = "yuv420p"
@@ -167,6 +167,30 @@ def test_encoding_with_unicode_filename(self) -> None:
167167
with av.open(path) as input:
168168
assert_rgb_rotate(self, input)
169169

170+
def test_libsvtav1(self) -> None:
171+
if not "libsvtav1" in av.codecs_available:
172+
pytest.skip()
173+
174+
with av.open(self.sandboxed("output.mp4"), "w") as output:
175+
stream = output.add_stream("libsvtav1", 24)
176+
assert isinstance(stream, VideoStream)
177+
178+
for i in range(24):
179+
frame = av.VideoFrame(200, 100, "rgb24")
180+
frame.pts = i * 2000
181+
frame.time_base = Fraction(1, 48000)
182+
for packet in stream.encode(frame):
183+
assert packet.time_base == Fraction(1, 24)
184+
output.mux(packet)
185+
186+
for packet in stream.encode(None):
187+
assert packet.time_base == Fraction(1, 24)
188+
output.mux(packet)
189+
190+
assert output.streams[0].codec.name == "libsvtav1"
191+
assert output.streams[0].codec.is_encoder is True
192+
assert output.streams[0].frames == 24
193+
170194

171195
class TestBasicAudioEncoding(TestCase):
172196
def test_default_options(self) -> None:

0 commit comments

Comments
 (0)