How to terminate a running ffmpegio stream forcibly? #7
-
|
Hello! Is there a way to terminate an ongoing ffmpegio stream like the one below, if it runs in its own thread: One possibility could be to kill the ffmpeg by looking at its PPID, which is of course the PID of the main Python process the code is run from. But is there a more elegant way? I need to terminate the ffmpeg process and the thread in case they hang, but I have not found any robust method for that. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
@suurj - the code snippet will terminate the FFmpeg process if it's not dead when Python process exits the context. If FFmpeg process has not been terminated (i.e., all frames were read) it calls You can inspect how the stream closes here: |
Beta Was this translation helpful? Give feedback.
@suurj - the code snippet will terminate the FFmpeg process if it's not dead when Python process exits the context. If FFmpeg process has not been terminated (i.e., all frames were read) it calls
Popen.kill()on the FFmpeg process. If it is not behaving as such, I need to investigate into in (need more info).You can inspect how the stream closes here:
python-ffmpegio/src/ffmpegio/streams/SimpleStreams.py
Line 91 in 4fd16e1