1

I am using Windows 8.1 Pro with ffmpeg 64 bit static build, trying to run the following cmd

"C:\ffmpeg\bin\ffmpeg.exe" -i "C:\ffmpeg\v.mp4" -preset veryslow -crf 22 
-vf "drawtext=fontfile=C:/Windows/Fonts/Arial/ariblk.ttf: text='%
{localtime}': x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1" 
"o.mp4"

Which is returning the error

[Parsed_drawtext_0 @ 0000000004c5cf20] Could not load font "C": cannot open resource

It seems the problem is around this part of the code which is caused by the semi colon : terminating the string.

fontfile=C:/Windows/Fonts/Arial/ariblk.ttf:

However, I have tried to escape it with backslahses in the following ecerpts but the error still exists

fontfile=C\:/Windows/Fonts/Arial/ariblk.ttf:

error

[Parsed_drawtext_0 @ 0000000004c5cf20] Could not load font "C": cannot open resource

And

fontfile=C/:/Windows/Fonts/Arial/ariblk.ttf

error

[Parsed_drawtext_0 @ 0000000004c5cf20] Could not load font "C/": cannot open resource

Lastly

fontfile='C:'/Windows/Fonts/Arial/ariblk.ttf

error

[Parsed_drawtext_0 @ 0000000004c5cf20] Could not load font "C": cannot open resource

How can I get around this?

Thanks

6

try:

fontfile=C\\:\\\\Windows\\\\Fonts\\\\ariblk.ttf

There are several problems to address:

You will need to escape : with \\: as well as escape \ with \\\\

The second part is how Windows appears to handle the location of the fonts. You might would think that the fonts are under a folder named Arial but they are actually just grouped to look that way in Explorer. The actual path for Arial Black in the root of Fonts. c:\Windows\Fonts\ariblk.tff

1
  • +1 perfect. Same concept trying to enter time duration as a parameter => -vf 'fade=in:st=0:d=2,fade=out:st=30\\:24:d=2' – StevoInco Nov 12 '18 at 1:39
0

You likely need to escape the escape...

fontfile=C\\:/Windows/...

Credit goes to here: https://superuser.com/questions/589214/ffmpeg-drawtext-initialization-error

Which in turn gives credit to: https://trac.ffmpeg.org/ticket/2166

0
"drawtext=fontfile='c\:/Windows/fonts/ariblk.ttf': ...

or

"drawtext=fontfile='c\:\\Windows\\fonts\\ariblk.ttf': ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.