[Python] Graceful stop FFMPEG recording process on Windows
Problem
When we want to stop ffmpeg
stream recording on Windows programmatically, these sollution will not work:
# asume p is the subprocess.Popen command call ffmpeg
os.kill(p.pid, signal.CTRL_C_EVENT) # parent process get kill too, recording file is not playable
# or
p.terminate() # not good, recording file is not playable
# or
p.send_signal(signal.CTRL_C_EVENT) # parent process get kill too, recording file is not playable