Skip to content

Commit f7565ed

Browse files
ANDYwyLEEWyattBlue
authored andcommitted
Pass output options to avio_open2()
1 parent e15e4b3 commit f7565ed

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎CHANGELOG.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ v19.1.0 (Unreleased)
3535
Fixes:
3636

3737
- Audio encoding now correctly passes the codec's ``thread_count`` to its internal :class:`.AudioResampler`, which takes a new ``threads`` argument, as video encoding does for its reformatter. Audio codecs without threading (e.g. MP3) resolve ``thread_count`` to ``1``, but the resampler ignored it and started an idle thread per CPU. By :gh-user:`tonyay163`.
38+
- Output containers now pass their options to ``avio_open2()`` before ``avformat_write_header()``, as the ``ffmpeg`` program does, so protocol options (``rtmp_flush_interval``, ``rw_timeout``, ``tcp_nodelay``, SRT's ``latency``, HTTP ``headers``, ...) reach the protocol instead of being reported as unused. By :gh-user:`ANDYwyLEE`.
3839

3940

4041
v19.0.1

‎av/container/output.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,9 @@ def start_encoding(self):
630630
self.start_timeout()
631631
self._blocking_depth += 1
632632
try:
633+
all_options = Dictionary(self.options, self.container_options)
634+
options = all_options.copy()
635+
options_ptr = cython.address(options.ptr)
633636
if (
634637
self.ptr.pb == cython.NULL
635638
and not self.ptr.oformat.flags & lib.AVFMT_NOFILE
@@ -642,17 +645,14 @@ def start_encoding(self):
642645
name,
643646
lib.AVIO_FLAG_WRITE,
644647
cython.address(self.ptr.interrupt_callback),
645-
cython.NULL,
648+
options_ptr,
646649
)
647650
err_check(ret)
648651
opened_pb = True
649652

650653
# Copy the metadata dict.
651654
dict_to_avdict(cython.address(self.ptr.metadata), self.metadata)
652655

653-
all_options = Dictionary(self.options, self.container_options)
654-
options = all_options.copy()
655-
options_ptr = cython.address(options.ptr)
656656
with cython.nogil:
657657
ret = lib.avformat_write_header(self.ptr, options_ptr)
658658
try:

0 commit comments

Comments
 (0)