Drawtext given problems under .filter method
Okey so, i am doing this:
text = "Hello world"
color = "white"
fontsize = 50
x = 10
y = 50
filter = f"drawtext=fontfile='c\:/Windows/Fonts/{font}.ttf':text='{text}':fontcolor={color}:fontsize={fontsize}:x={x}:y={y}"
(
ffmpeg
.input("test.avi")
.filter('vf', filter)
.output(f'output_video.mp4', vcodec='copy', acodec='copy')
.overwrite_output()
.run()
)
And ffmpeg keeps throwing same error:
No option name near 'drawtext\\\=fontfile\\\=\\\'c\\\\\\\:/Windows/Fonts/Arial.ttf\\\'\\\:text\\\=\\\'Hello world\\\'\\\:fontcolor\\\=white\\\:fontsize\\\=50\\\:x\\\=10\\\:y\\\=50'
Error parsing a filter description around: [s0]
Error parsing filterchain '[0]vf=drawtext\\\\\\=fontfile\\\\\\=\\\\\\\'c\\\\\\\\\\\\\\:/Windows/Fonts/Arial.ttf\\\\\\\'\\\\\\:text\\\\\\=\\\\\\\'Hello world\\\\\\\'\\\\\\:fontcolor\\\\\\=white\\\\\\:fontsize\\\\\\=50\\\\\\:x\\\\\\=10\\\\\\:y\\\\\\=50[s0]' around: [s0]
Error initializing complex filters.
Invalid argument
Seems it is something parsing the filter string.
However, if i wanna call this command as pure ffmpeg, i would do this:
# ffmpeg -i test.avi -vf "drawtext=fontfile='c\:/Windows/Fonts/Arial.ttf':text='Hello':fontcolor=0xff0000:fontsize=100:x=10:y=10" output_video.mp4
Which runs successfully.
Can someone explain me what am i writting wrongly?