Not sure if this is the problem, but worth a shot. You have a function named "process" in your script. I assume that somewhere within the bowels of Popen there is a function called "process," which could be overwritten by your function. Other than that, you'll probably have better luck at StackOverflow or the ffmpeg forums
HTH

Your first problem is that you're writing out movie.txt, but you're not flushing the file buffers so that when you call ffmpeg immediately after the file is written and closed, ffmpeg (as a separate process) is not able to read the content of the yet to be flushed file, so it gets an empty input file (you can see this situation if you call a dummy ffmpeg.cmd script in place of ffmpeg.exe, which tries to view the contents of movie.txt - you'll see the file is empty at this point). Add an f.flush() before the f.close().

Once that is resolved, you should be able to replace the call to POpen() with: