jrottenberg/ffmpeg

Fontconfig error: Cannot load default config file

dimabory opened this issue · 2 comments

$ ffmpeg -i <input> -vf subtitles=<srt> <output>

ffmpeg cannot apply subtitles due to the following error

[Parsed_subtitles_0 @ 0x1ffd380] Shaper: FriBidi 0.19.7 (SIMPLE)
Fontconfig error: Cannot load default config file
[Parsed_subtitles_0 @ 0x1ffd380] No usable fontconfig configuration file found, using fallback.

I have already tried jrottenberg/ffmpeg:4.2-alpine, jrottenberg/ffmpeg:4.4-alpine and jrottenberg/ffmpeg:4.4-centos8.

Partially found how to make subtitles work using the following command in Dockerfile

RUN apk --update add fontconfig ttf-dejavu

however, the actual issue still happens:

bits/s dup=5 drop=0 speed=9.65[Parsed_subtitles_0 @ 0x7f82b15cf400] Shaper: FriBidi 0.19.7 (SIMPLE)
Fontconfig error: Cannot load default config file
[Parsed_subtitles_0 @ 0x7f82b15cf400] No usable fontconfig configuration file found, using fallback.
Fontconfig error: Cannot load default config file
[Parsed_subtitles_0 @ 0x7f82b15cf400] Using font provider fontconfig
[Parsed_subtitles_0 @ 0x7f82b15cf400] fontselect: (Arial, 400, 0) -> /usr/share/fonts/ttf-dejavu/DejaVuLGCSans.ttf, 0, DejaVuLGCSans

@dimabory It's easy to fix. I am not sure about default fonts location on alpine but on ubuntu this fixed issue: add after COPY --from=build ... in Dockerfile:

COPY --from=build /opt/ffmpeg/etc /etc/
COPY --from=build /usr/share/fonts /usr/share/fonts/
ENV FONTCONFIG_PATH=/etc/fonts

/usr/share/fonts line is needed only if you have installed your custom fonts.