From d326ff4f6033dc6e91799bdc19b4b41a73343fcd Mon Sep 17 00:00:00 2001 From: WyattBlue Date: Tue, 18 Feb 2025 15:42:15 -0500 Subject: [PATCH] Set the default bit_rate to 0 --- av/container/output.pyx | 4 ++-- tests/test_encode.py | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/av/container/output.pyx b/av/container/output.pyx index 7140c64b5..2a12c40f2 100644 --- a/av/container/output.pyx +++ b/av/container/output.pyx @@ -76,7 +76,7 @@ cdef class OutputContainer(Container): codec_context.pix_fmt = lib.AV_PIX_FMT_YUV420P codec_context.width = kwargs.pop("width", 640) codec_context.height = kwargs.pop("height", 480) - codec_context.bit_rate = kwargs.pop("bit_rate", 1024000) + codec_context.bit_rate = kwargs.pop("bit_rate", 0) codec_context.bit_rate_tolerance = kwargs.pop("bit_rate_tolerance", 128000) try: to_avrational(kwargs.pop("time_base"), &codec_context.time_base) @@ -90,7 +90,7 @@ cdef class OutputContainer(Container): # Some sane audio defaults elif codec.type == lib.AVMEDIA_TYPE_AUDIO: codec_context.sample_fmt = codec.sample_fmts[0] - codec_context.bit_rate = kwargs.pop("bit_rate", 128000) + codec_context.bit_rate = kwargs.pop("bit_rate", 0) codec_context.bit_rate_tolerance = kwargs.pop("bit_rate_tolerance", 32000) try: to_avrational(kwargs.pop("time_base"), &codec_context.time_base) diff --git a/tests/test_encode.py b/tests/test_encode.py index c107aa044..23cbdc275 100644 --- a/tests/test_encode.py +++ b/tests/test_encode.py @@ -120,7 +120,6 @@ def test_default_options(self) -> None: assert stream.time_base is None # codec context properties - assert stream.bit_rate == 1024000 assert stream.format.height == 480 assert stream.format.name == "yuv420p" assert stream.format.width == 640 @@ -176,7 +175,6 @@ def test_default_options(self) -> None: assert stream.time_base is None # codec context properties - assert stream.bit_rate == 128000 assert stream.format.name == "s16" assert stream.sample_rate == 48000