#11549 closed defect (invalid)

Ffmpeg fontconfig broken on windows?

Reported by: mytait Owned by:
Priority: normal Component: avfilter
Version: unspecified Keywords: drawtext
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by mytait)

Summary of the bug:

the drawtext command will not find a font on windows in V7.x unless the font file is provided. as per documentation that is only necessary "if the fontconfig support is disabled." (and if you need your own font file of course)

normally providing a high level font name (font='arial') or even not providing a font works as there is a default value. On windows v7.x it does not anymore. (tested on 7.0.1 and 7.1.1

in linux and macos it works as expected just providing the font name e.g. "Times New Roman" or "arial". Also windows V5.x works as expected.

How to reproduce:
create a text file named test.mkv and then draw a text on it

% ffmpeg -y -f lavfi -i color=c=white:s=1280x720:r=30 -f lavfi -i anullsrc=r=44100:cl=stereo -t 10 -c:v libx264 -c:a aac test.mkv

% ffmpeg -y -i test.mkv -vf "drawtext=text='test'" out.mkv
Input #0, matroska,webm, from 'test.mkv':
  Metadata:
    ENCODER         : Lavf61.7.100
  Duration: 00:00:10.02, start: -0.023000, bitrate: 16 kb/s
  Stream #0:0: Video: h264 (High), yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 1k tbn
      Metadata:
        ENCODER         : Lavc61.19.101 libx264
        DURATION        : 00:00:10.000000000
  Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp
      Metadata:
        ENCODER         : Lavc61.19.101 aac
        DURATION        : 00:00:10.023000000
Fontconfig error: Cannot load default config file: No such file: (null)

This works:

ffmpeg -y -i test.mkv -vf "drawtext=fontfile=C\\:/Windows/fonts/arial.ttf:text='test'" out.mkv

but providing a font everytime breaks the elegancy of the former command being OS independent (only providing the font name and not filename with path)

the used version have all the required options as per documentation: --enable-libfreetype --enable-libharfbuzz --enable-libfontconfig --enable-libfribidi

ffmpeg version 7.0.1-full_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 13.2.0 (Rev5, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libxevd --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxeve --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100

ffmpeg version 7.1.1-full_build-www.gyan.dev Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 14.2.0 (Rev1, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-shared --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-lcms2 --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libopenjpeg --enable-libquirc --enable-libuavs3d --enable-libxevd --enable-libzvbi --enable-libqrencode --enable-librav1e --enable-libsvtav1 --enable-libvvenc --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxeve --enable-libxvid --enable-libaom --enable-libjxl --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-liblc3 --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.101 / 61. 19.101
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100

Change History (8)

comment:1 by mytait, 19 months ago

Component: undetermined → avfilter
Keywords: drawtext added

comment:2 by mytait, 19 months ago

Description: modified (diff)

comment:3 by Cigaes, 19 months ago

What do the commands fc-list and fc-match default return on your system?

comment:4 by mytait, 19 months ago

fc-list and match are fontconfig commands. i dont have fontconfig extra installed in my system nor those commands.

Ffmpeg 5.x also works without it.

comment:5 by Cigaes, 19 months ago

Fontconfig is not just a library, it is a configuration framework. The message you quote does not come from FFmpeg, it comes from fontconfig, and it indicates the framework is improperly configured. The commands I suggested you would confirm or invalidate that hypothesis. Without that test, this ticket should probably closed as invalid.

comment:6 by mytait, 19 months ago

i know what fc is. thats why i said i dont have fontconfig installed on my system (i also didnt say it was "a library"). Never had it.

I also know that the message comes from fontconfig. thats why its in the title of this ticket.

i dont even have the rights to install it and modify the systemconfig (even though its a fresh windows install) as i am a non-admin user. I have downloaded the static and dynamic pre-compiled ffmpeg executables on my users space (with the configuration that the documentation requires see above) and i can say that v5.x works and v7.x does not work with the exact same command on the exact same system. That command works vor v7.x in linux and mac for the required configuration.

Therefore one would think its not dependent on the system configuration but on a built in code within the ffmpeg build. But since thats only my guess, thats for someone who knows the topic to decide.

Last edited 19 months ago by mytait (previous) (diff)

comment:7 by Cigaes, 19 months ago

Looks like your problem does not come from FFmpeg but from the way it was built. As a principle, this tracker is only for bugs that could be fixed in FFmpeg's source code. You need to seek support from whoever distributes the binary you use.

comment:8 by mytait, 19 months ago

Resolution: → invalid
Status: new → closed
Note: See TracTickets for help on using tickets.