

I ended up using os.system() instead of subprocess and got the results I wanted before returning to see answers on this question. n(shlex.split('ffmpeg -y -i head1.png -i hdmiSpitting.mov -filter_complex " overlay=0:0" -pix_fmt yuv420p -c:a copy output3.mov -report'))

The log file may tell us what went wrong when we can't see the console. In some development environments we can't see FFmpeg messages, which are printed to the console (written to stderr).Īdding -report argument creates a log file with name like ffmpeg-20220624-114156.log. Note: n supposes to replace subprocess.call.Ĭreating log file by adding -report argument: The default is False, so we may use subprocess.call(command). Using shell=True is not recommended and considered "unsafe". In Linux, the default path is /usr/bin/ffmpeg. There are cases when ffmpeg executable is not in the execution path.Įxample for Windows (assuming ffmpeg.exe is in c:\FFmpeg\bin): command = shlex.split('c:\\FFmpeg\\bin\\ffmpeg.exe -y -i head1.png -i hdmiSpitting.mov -filter_complex " overlay=0:0" -pix_fmt yuv420p -c:a copy output3.mov') In some development environments we can't see the message.Īdd -y for overwriting the output if already exists (without asking): command = shlex.split('ffmpeg -y -i head1.png -i hdmiSpitting.mov -filter_complex " overlay=0:0" -pix_fmt yuv420p -c:a copy output3.mov') If the output file output3.mov already exists, FFmpeg prints a message:įile 'output3.mov' already exists. We may also use shlex.split: import shlexĬommand = shlex.split('ffmpeg -i head1.png -i hdmiSpitting.mov -filter_complex " overlay=0:0" -pix_fmt yuv420p -c:a copy output3.mov') We can build the command as a list: command = overlay=0:0', '-pix_fmt', 'yuv420p', '-c:a', 'copy', 'output3.mov'] In Windows one line with spaces should work, but in Linux we have to pass the arguments as list.
