FFMPEG in suprocess and print stderr for monitoring

Hey Guy's and Gals,

Trying to launch and run FFMPEG in a subprocess and print the stderr for real time monitoring.
I can get the subprocess to launch and FFMPEG , but then Touch waits until FFMPEG finished before it will resume and print anything.

Any Ideas? I don’t mind running FFMPEG in an engine comp or another process, but I have no luck there either…
stream.bat is my FFMPEG code

import subprocess

command = “cmd /c Stream.bat”

process = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, shell=True)

for line in process.stderr:
print(line)
op(‘text2’).write(line)

This will print after FFMPEG is finished or errors out…Touch waits for FFMPEG to finish.

Any Ideas are much appreciated.

thx

1 Like

Haven’t tried directly, but I’d assume you can use the ‘process’ object to determine when the process has completed, and print the output at that point. That way you arn’t waiting for it. You’d use a delayed run script to check every X frames for a result.