With the following code, I am able to pipe frames of a video to FFMPEG using Python, Numpy and the FFMPEG binaries:
from __future__ import print_function
imp
A highly probable culprit is the disgustingly stinky subprocess.Popen
line. Not only you ignore its return value - which you must never do, in order to ensure the subprocess' completion by certain point and/or check its exit code - you also make stderr
a pipe but never read it - so the process must be hanging when its buffer fills.
This should fix it:
p = subprocess.Popen(cmd_out, stdin=subprocess.PIPE)
fout = p.stdin
<...>
fout.close()
p.wait()
if p.returncode !=0: raise subprocess.CalledProcessError(p.returncode,cmd_out)