Python Subprocesses (ffmpeg) Only Start Once I Ctrl-c The Program?
Solution 1:
This is only a guess, but ffmpeg
usually produces a lot of status messages and output on stderr or stdout. You're using subprocess.PIPE
to redirect stdout and stderr to a pipe, but you never read from those, so if the pipe buffer is full, the ffmpeg process will block when trying to write data to it.
When you kill the parent process the pipe is closed on its end, and probably (i haven't checked) ffmpeg handles the error by just not writing to the pipe anymore and is therefore unblocked and starts working.
So eiter consume the process.stdout
and process.stderr
pipes in your parent process, or redirect the output to os.devnull
if you don't care about it.
Solution 2:
In addition to what @mata says, ffmpeg may also be asking you if you want to overwrite output.avi and waiting on you to type "y". To force-overwrite, use the "-y" command-line option (ffmpeg -i $input -y $output
).
Post a Comment for "Python Subprocesses (ffmpeg) Only Start Once I Ctrl-c The Program?"