Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic test for svtav1 encoder #1698

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions tests/test_encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading