Skip to content
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions av/container/output.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ from av.stream cimport Stream
cdef class OutputContainer(Container):
cdef bint _started
cdef bint _done
cdef bint _avio_opened
cdef lib.AVPacket *packet_ptr

cpdef start_encoding(self)
3 changes: 2 additions & 1 deletion av/container/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def close_output(self: OutputContainer):
try:
self.err_check(lib.av_write_trailer(self.ptr))
finally:
if self.file is None and not (self.ptr.oformat.flags & lib.AVFMT_NOFILE):
if self._avio_opened:
lib.avio_closep(cython.address(self.ptr.pb))
self._done = True

Expand Down Expand Up @@ -458,6 +458,7 @@ def start_encoding(self):
err_check(
lib.avio_open(cython.address(self.ptr.pb), name, lib.AVIO_FLAG_WRITE)
)
self._avio_opened = True

# Copy the metadata dict.
dict_to_avdict(
Expand Down
Loading