Opened 10 years ago

Last modified 5 years ago

#4399 open defect

Fontconfig 2.11.91 breaks proper font selection in ffmpeg

Reported by: volman Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: drawtext
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

After upgrading from earlier version (built on Nov 25, 2014), ffmpeg stopped finding fonts for drawtext filter.

How to reproduce:

% ffmpeg -i Test.mov -vf drawtext="fontfile=Myriad\ Pro:fontsize=45:text=test" -f mp4  -y -v verbose NUL
ffmpeg version N-71102-g1f5d1ee Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --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 --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 20.101 / 54. 20.101
  libavcodec     56. 30.100 / 56. 30.100
  libavformat    56. 26.101 / 56. 26.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 13.101 /  5. 13.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Test.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2012-12-03 14:13:35
  Duration: 01:26:29.48, start: 0.000000, bitrate: 167502 kb/s
    Stream #0:0(eng): Video: prores, 1 reference frame (apch / 0x68637061), yuv422p10le(bt709), 1920x1080, 165935 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 23976 tbn, 23976 tbc (default)
    Metadata:
      creation_time   : 2012-12-03 14:13:35
      handler_name    : Apple Alias Data Handler
      encoder         : Apple ProRes 422 (HQ)
      timecode        : 00:59:59:00
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, 2 channels, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2012-12-03 14:13:35
      handler_name    : Apple Alias Data Handler
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2012-12-03 14:51:59
      handler_name    : Apple Alias Data Handler
      timecode        : 00:59:59:00
[Parsed_drawtext_0 @ 0000000000369980] Could not load font "Myriad Pro": cannot open resource
[Parsed_drawtext_0 @ 0000000000369980] impossible to find font informationError initializing filter 'drawtext' with args 'fontfile=Myriad Pro:fontsize=45:text=test'
Error opening filters!

Same command and same system setup works for ffmpeg buit before Dec 28, 2014. The font is found and used.

Zeranoe always uses newest libraries and since FFmpeg version 2014-12-28 git-750b10f they have been compiling with Fontconfig 2.11.91 (before that it was 2.11.1).

I spent only so much time to pinpoint the problem, so I'm not sure, but I suppose the cause might be the change of type of FC_SIZE property in Fontconfig (from double to range).

Please refer to following sources:

https://github.com/FFmpeg/FFmpeg/blob/master/libavfilter/vf_drawtext.c

 if (
   FcPatternGetInteger(best, FC_INDEX, 0, &index ) != FcResultMatch ||
   FcPatternGetDouble (best, FC_SIZE, 0, &size ) != FcResultMatch) {
   av_log(ctx, AV_LOG_ERROR, "impossible to find font information");
   return AVERROR(EINVAL);
 }

In Fontconfig, FC_SIZE is now a range:

http://cgit.freedesktop.org/fontconfig/diff/src/fcobjs.h?id=3cd573fc1fb67db75cd356cad3e901d24af1ce8a

Hope that helps.

Change History (2)

comment:1 by Carl Eugen Hoyos, 8 years ago

Keywords: drawtext added

comment:2 by Elon Musk, 5 years ago

Status: newopen

Font selection still works for me.

Note: See TracTickets for help on using tickets.