Skip to content

Commit

Permalink
test svtav1
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeSchiff committed Dec 29, 2024
1 parent 3ce8c84 commit 9cb310f
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions tests/test_encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def test_encoding_with_pts(self) -> None:

with av.open(path, "w") as output:
stream = output.add_stream("h264", 24)
assert stream in output.streams.video
print(11111111111, dir(stream))
stream.width = WIDTH
stream.height = HEIGHT
stream.pix_fmt = "yuv420p"
Expand Down Expand Up @@ -171,24 +171,26 @@ 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")
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):
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)

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

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:
Expand Down

0 comments on commit 9cb310f

Please sign in to comment.