I've been trying to add text to an avi with ffmpeg and I can't seem to get it right.
Please help:
import subprocess
ffmpeg = "C:\\ffmpeg_10_6_11.exe"
inVid = "C:\\test_in.avi"
outVid = "C:\\test_out.avi"
proc = subprocess.Popen(ffmpeg + " -i " + inVid + " -vf drawtext=fontfile='arial.ttf'|text='test' -y " + outVid , shell=True, stderr=subprocess.PIPE)
proc.wait()
print proc.stderr.read()
A colon ":" and a backslash "\" have special meaning when specifying the parameters for drawtext. So what you can do is to escape them by converting ":" to "\:" and "\" to "\\". Also you can enclose the path to your font file in single quotes incase the path contains spaces.
So you will have
HA
Turns out the double colon ":" in C:\Windows\Fonts etc was acting as a split so when i was inputting the font's full path ffmpeg was reading my command as follows
original command
ffmpeg's interpretation
So to fix it you need to elinate the : in the font file path.
My final working code: