Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fontconfig error: Cannot load default config file: No such file: (null)) #533

Open
lorenzoappetito-archimediasistemi opened this issue Jul 17, 2024 · 0 comments

Comments

@lorenzoappetito-archimediasistemi
Copy link

lorenzoappetito-archimediasistemi commented Jul 17, 2024

Code:

private static async Task AddTextToVideo(string inputVideoPath, string outputVideoPath, string text, 
                                         Guid accountId, int textFrequency, int textDuration)
{
    FFMpegArguments.FromFileInput(inputVideoPath)
        .OutputToFile(outputVideoPath, true, options => options
            .WithVideoFilters(filterOptions => filterOptions
                .DrawText(drawTextOptions[0])
            )
        )
        .NotifyOnProgress(ProgressHandler)
        .ProcessSynchronously();
}

private static DrawTextOptions[] CreaCroce(string text, int textFrequency, int textDuration, int width, int height)
{
    var drawTextOptionsArray = new DrawTextOptions[5];

    drawTextOptionsArray[0] = DrawTextOptions.Create(text, FontName)
        .WithParameter("fontfile", @"C:\home\site\wwwroot\arial.ttf")
        .WithParameter("fontsize", FontSize.ToString(CultureInfo.InvariantCulture))
        .WithParameter("fontcolor", "white")
        .WithParameter("box", "1")
        .WithParameter("boxcolor", "black@0.5")
        .WithParameter("boxborderw", "5")
        .WithParameter("x", @"if(eq(mod(n\\,200)\\,0)\\,rand(0\\,(w-text_w))\\,x)")
        .WithParameter("y", @"if(eq(mod(n\\,200)\\,0)\\,rand(0\\,(h-text_h))\\,y)")
        .WithParameter("enable", $@"lt(mod(t\\,{textFrequency})\\,{textDuration})");
}

Error:

ffmpeg exited with non-zero exit-code (-1073741819 - ffmpeg version 6.1-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --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-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --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-ffnvcodec --enable-nvdec --enable-nvenc --enable-dxva2 --enable-d3d11va --enable-libvpl --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      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\home\site\wwwroot\input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.19.102
  Duration: 00:00:05.53, start: 0.000000, bitrate: 2141 kb/s
  Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 2022 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
Fontconfig error: Cannot load default config file: No such file: (null))

The TTF file exists but there is no way to make this code work. Some idea?

Everything works locally, but not on an Azure Function.

I tried this command from the console on Azure and it works.

ffmpeg.exe -i input.mp4 -vf "drawtext=fontfile=arial.ttf:fontsize=24:fontcolor=green:text=HelloWorld" output.mp4

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant