You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code works correctly on the main thread:
frames_ = np.ones((60, 720, 1280, 3), dtype=np.uint8)
container = av.open(dst_path, mode="w")
stream = container.add_stream("mpeg4", rate=fps)
stream.width = 1280
stream.height = 720
stream.pix_fmt = "yuv420p"
stream.thread_count = 0
stream.thread_type = 'AUTO'
for frame_i in frames_:
frame = av.VideoFrame.from_ndarray(frame_i, format="rgb24")
for packet in stream.encode(frame):
container.mux(packet)
for packet in stream.encode(None):
container.mux(packet)
container.close()
But if I execute the code in the child process (multiprocessing.Process), the main process hangs on exit (the child process itself terminates normally):
Exception ignored in atexit callback: <function _exit_function at 0x798dedbbec20>
Traceback (most recent call last):
File "/usr/lib/python3.10/multiprocessing/util.py", line 360, in _exit_function
_run_finalizers()
File "/usr/lib/python3.10/multiprocessing/util.py", line 300, in _run_finalizers
finalizer()
File "/usr/lib/python3.10/multiprocessing/util.py", line 224, in __call__
res = self._callback(*self._args, **self._kwargs)
File "/usr/lib/python3.10/multiprocessing/queues.py", line 199, in _finalize_join
thread.join()
File "/usr/lib/python3.10/threading.py", line 1096, in join
self._wait_for_tstate_lock()
File "/usr/lib/python3.10/threading.py", line 1116, in _wait_for_tstate_lock
if lock.acquire(block, timeout):
KeyboardInterrupt:
This discussion was converted from issue #1788 on February 20, 2025 19:15.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The following code works correctly on the main thread:
But if I execute the code in the child process (multiprocessing.Process), the main process hangs on exit (the child process itself terminates normally):
I already tried:
but it has no effect.
My environment:
Beta Was this translation helpful? Give feedback.
All reactions