2

I have got this error message when using ffmpeg

[Parsed_drawtext_0 @ 03bdc300] Could not load font "/Library/Fonts/DroidSansMono.ttf": cannot open resource
Fontconfig error: Cannot load default config file
[Parsed_drawtext_0 @ 03bdc300] impossible to init fontconfig
[AVFilterGraph @ 03d9b840] Error initializing filter 'drawtext' with args 'fontsize=15:fontfile=/Lib
rary/Fonts/DroidSansMono.ttf:timecode=00\:00\:00\:00:rate=25:text=TCR\::fontsize=72:fontcolor=white:
boxcolor=0x000000AA:box=1:x=860-text_w/2:y=960'
Error opening filters!

Does anyone know how can I resolve this issue?

I'm using ffmpeg on Windows 7. I've downloaded ffmpeg from ffmpeg.zeranoe.com/builds

This is what I entered and what came up:

c:\ffmpeg\bin>ffmpeg -i in.mts -vf "drawtext=fontfile=/usr/share/fonts/truetype/DroidSans.ttf: timec
ode='09\:57\:00\:00': r=25: \x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1"
-an -y out.avi
ffmpeg version N-70634-g3bedc99 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzli
b --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libblu
ray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-
libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw
b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr -
-enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --
enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enab
le-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enab
le-zlib
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 12.100 /  5. 12.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mpegts, from 'in.mts':
  Duration: 00:00:23.42, start: 1.040000, bitrate: 9937 kb/s
  Program 1
    Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p, 1440x1080 [SAR 4:3 DAR 16:
9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 256 kb/s
    Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
[Parsed_drawtext_0 @ 02ac2f20] Could not load font "/usr/share/fonts/truetype/DroidSans.ttf": cannot
 open resource
Fontconfig error: Cannot load default config file
[Parsed_drawtext_0 @ 02ac2f20] impossible to init fontconfig
[AVFilterGraph @ 03cdb840] Error initializing filter 'drawtext' with args 'fontfile=/usr/share/fonts
/truetype/DroidSans.ttf: timecode=09\:57\:00\:00: r=25: x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box
=1: boxcolor=0x00000000@1'
Error opening filters!

c:\ffmpeg\bin>
4
  • Please show the actual command and the complete console output.
    – llogan
    Commented Apr 18, 2015 at 1:26
  • I have entered my info by editing my original question. let me know if I need to include anything else @LordNeckbeard
    – Kash
    Commented Apr 18, 2015 at 16:53
  • You're on Windows, but your path to the font looks like *nix.
    – llogan
    Commented Apr 18, 2015 at 19:50
  • I see. What should the path look like for the windows?
    – Kash
    Commented Apr 19, 2015 at 0:50

2 Answers 2

4

Got it. The error is cuased by the font location in the command is of a Linux computer. The font location need to be different for windows.

The error caused by this line in the command: drawtext=fontfile=/usr/share/fonts/truetype/DroidSans.ttf

The above line does not work in Windows.

For windows change to: drawtext=fontfile=/Windows/Fonts/arial.ttf

0
2

Using this drawtext in a program I wrote to embed Created dates into images, I found that you have to escape some characters like colons and backslashes using some versions of FFmpeg with the '\' escape character as you did in the timecode sequence. Also enclose paths in single quotes for possible spaces in path or name:

drawtext=fontfile='c\\:\\\Windows\\\Fonts\\\Times.ttf'

or

ffmpeg -i in.mts -vf "drawtext=fontfile='C\\:\\\Windows\\\fonts\\\truetype\\\DroidSans.ttf': timecode='09\\:57\\:00\\:00': r=25: \\x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1" -an -y out.avi

Also some fonts contain multiple .ttf files like Times New Roman. Double clicking this shows Times New Roman Regular, Times New Roman Bold, etc. Times new Roman Regular properties shows its name is Times.ttf. Be sure to use the correct one.

Font Main Folder

Actual Fonts and Names

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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