kevinmcurran
kevinmcurran

Reputation: 91

FFmpeg drawtext's fontfile unable to load

I have This Parisienne-type Font file and I want to write on a gif using that font but the output font is never Parisienne, it always comes out as normal Arial

the command

ffmpeg -i C:\Users\1997\www\post2\css\back2.gif -vf "drawtext=fontfile='C\:\\Windows\\Fonts\\2.ttf':text='Darbuka 70':fontcolor=#5c391685:fontsize=160::x=(w-text_w)/2:y=20" C:\Users\1997\www\post2\css\output.mp4

This is how the font file looks: enter image description here

the output: enter image description here

Upvotes: 0

Views: 1042

Answers (1)

kesh
kesh

Reputation: 5463

It's likely due to not having enough escape characters (\). You need one for FFmpeg and double them for shell. So, try

fontfile='C\\\\:/Windows/Fonts/2.ttf'

Four \'s worked when I tested in Python, but if it doesn't add/subtract a pair at a time to see which works for you.

Last, if you want to see if fontfile option is set properly or not, add -loglevel debug option and look in the log for a line like:

[Parsed_drawtext_2 @ 0000015e54962a80] Setting 'fontfile' to value 'C:/Windows/Fonts/2.ttf'

If it's not properly escaped, you'd see a log like:

[Parsed_drawtext_2 @ 000001c010782440] Setting 'fontfile' to value 'C'
[Parsed_drawtext_2 @ 000001c010782440] Setting 'text' to value '/Windows/Fonts/2.ttf'

P.S., I cheated and used / for directory separator. If you want to use \, the same rule applies. You need a several \'s for each \. See documentation

Upvotes: 2

Related Questions