You need to reassign input (or use an intermediate variable). What's happening in each loop is you are taking the fresh input and drawing the text over that.
You could do something like
Copy...
input = input.drawtext(
...
I believe, though I haven't worked with videos much. Like, you might need to do more to make sure the text doesn't all just layer over itself.
Answer from jojo on Stack OverflowA 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
ffmpeg -i C:\Test\rec\vid_1321909320.avi -vf drawtext=fontfile='C\:\\Windows\\Fonts\\arial.ttf':text=test vid_1321909320.flv
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
" -vf drawtext=fontfile='C:\\Windows\\fonts\\arial.ttf'|text='test' "
ffmpeg's interpretation
-vf drawtext= # command
fontfile='C # C is the font file because the : comes after it signalling the next key
arial.ttf' # is the next key after fontfile = C (because the C is followed by a : signalling the next key)
:text # is the value the key "arial.tff" is pointing to
='test' # is some arb piece of information put in by that silly user
So to fix it you need to elinate the : in the font file path.
My final working code:
import subprocess
ffmpeg = "C:\\ffmpeg_10_6_11.exe"
inVid = "C:\\test_in.avi"
outVid = "C:\\test_out.avi"
subprocess.Popen(ffmpeg + " -i " + inVid + ''' -vf drawtext=fontfile=/Windows/Fonts/arial.ttf:text=test ''' + outVid , shell=True)
Use drawbox for the box, and drawtext for the text.

ffmpeg -i input.mp4 -vf \
"format=yuv444p, \
drawbox=y=ih/PHI:[email protected]:width=iw:height=48:t=fill, \
drawtext=fontfile=OpenSans-Regular.ttf:text='Title of this Video':fontcolor=white:fontsize=24:x=(w-tw)/2:y=(h/PHI)+th, \
format=yuv420p" \
-c:v libx264 -c:a copy -movflags +faststart output.mp4
drawtexthas aboxoption, but as far as I can tell it can't be an arbitrary width and is relative to the text size, so that is whydrawboxis used instead.The
formatfilter is used to improve the color of thedrawboxarea; otherwise, depending on your input and output formats, the area could look de-saturated or monochrome. Theformatfilter is then used again to ensure that the pixel format of the output file is compatible with all players.The audio is being stream copied in this example because you may not want to needlessly re-encode it.
Old
ffmpegusers will have to uset=maxinstead oft=fill.
ffmpeg -i C:\Users\Developer_2\Videos\2.mkv -vf drawtext="fontfile=C\:/Regular.ttf: text='apcis.tmou.org': fontcolor=white: fontsize=24: box=1: [email protected]: x=w-tw:y=h-th" C:\inetpub\wwwroot\videos\1.mp4