Closed KamranBinaee closed 3 years ago
The issue with quitting seems to be ffmpeg not shutting down gracefully. With Ctrl+C, at least the SIGINT seems to be propagated to the ffmpeg process but that doesn't work reliably all the time, hence the broken videos. When using another key, the ffmpeg processes aren't stopped at all.
We have two options:
The second one is probably the cleaner solution, but PyAV doesn't support encoding of the raw Bayer RGGB8 buffers that the FLIR camera produces (yet).
If we figure out a way to stop ffmpeg gracefully without Ctrl-C, we need to make sure the SIGINT is not propagated to the sub-processes. There seems to be a solution for that:
import subprocess
import signal
def preexec_function():
# Ignore the SIGINT signal by setting the handler to the standard
# signal handler SIG_IGN.
signal.signal(signal.SIGINT, signal.SIG_IGN)
my_process = subprocess.Popen(
["my_executable"],
preexec_fn = preexec_function
)
Closing this for now, but feel free to re-open if the issue persists (e.g. broken video files because the 3 second timeout before killing the ffmpeg process isn't enough).
There have been a few incidents that the ctrl+c doesn't stop the recording appropriately and either it needs a long delay or the recording streams are not terminated/saved correctly.
Test if the keypress is being registered correctly.
Test if the issue is related to the processes.