This works but, ffmpeg's status doesn't show.
("ValueError: Couldn't call FFMPEG with these parameters") Command line one-liners are great for quick and one off FFMPEG experiences but sooner or later you’re going to want to start building custom applications for ef. Self.ffmpeg = subprocess.Popen(ffmpegString, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) I figured I could do this by accessing the process's stdout like so:Ĭalling subprocess.Popen() # Convert - Calls FFMPEG with current settings. def runpytestsubprocess(self, args, timeoutNone): '''Run pytest as a subprocess with given arguments.
This works fine, but I'd also like a way to get the progress of the conversion, whether it failed or not etc. I'm using pythons subprocess to create a ffmpeg process for every conversion I want. ).Īt this point I am playing with an alternative, which is to replace p.I'm trying to write a gui for FFMPEG. Now, on second thought, that may not be necessary, considering that imageio is already reading from the pipe (see e.g. Some languages might even have libraries of their own to extend FFMPEG natively. FFMPEG can be used with almost any programming language with a couple of simple tricks. Taking a step back: my reason for using the communicate() to send b'q' was that I wanted to play safe, taking into account the warning from the subprocess docs against using stdin.write with pipes. Command line one-liners are great for quick and one off FFMPEG experiences but sooner or later you’re going to want to start building custom applications for efficiency.
#Subprocess python ffmpeg communicate code#
Looking at the source for communicate(), there is quite a lot going on there, including some additional threading. The code is below: import subprocess process subprocess.Popen ('plink.exe hello10.120.139.170 -pw 123456'.split (), shellFalse, stdoutsubprocess.PIPE, stderrsubprocess.PIPE) print municate () block here I know the block is because plink.exe it still running but I need to read the output before the subprocess terminates. I haven't seen the issue with some other webcams. This seems to occur only with some usb-webcams, such as my laptop's builtin cam. Any plugins added to the :py:attr:plugins list will be added using the -p command line option. In my case I don't see any indefinite blocking, but on occasion the communicate(b'q') call will block for several seconds (up to approx. def runpytestsubprocess(self, args, timeoutNone): '''Run pytest as a subprocess with given arguments. However, since that time, I have also encountered blocking issues related to communicate that appear to be random.
I have been having some second thoughts about the communicate(b'q') call myself.Īt the time, the communicate(b'q') approach seemed to fix my immediate problem ( imageio/imageio#343), and on my side it does work, in principle.