'Android - how to register a new FontConfig using FFmpegKitConfig.setFontDirectory

I am using ffmpeg-kit to burn a subtitle into a mp4 file , based on their tips here, I need to register a font or specify a fontconfig configuration under Android , but I dont know how to do that.

in the tips , they suggest to use FFmpegKitConfig.setFontDirectory to register a new FontConfig, so I tried to write the below code :

String cmd = "-i " + videoPath + " -vf subtitles=\"" + subtitlePAth + ":force_style='Alignment=10,Fontsize=18\" " + 
   outputVideoPath;

Map<String, String> mapping= new HashMap<String, String>();
    mapping.put("fontName.ttf", "fontName");

FFmpegKitConfig.setFontDirectory(getApplicationContext(),fontDirectoyPath,mapping);

FFmpegKit.executeAsync(cmd, new FFmpegSessionCompleteCallback() {

     @Override
     public void apply(FFmpegSession session) {

     }
 }, new LogCallback() {

     @Override
     public void apply(com.arthenica.ffmpegkit.Log log) {


     }
 }, new StatisticsCallback() {

     @Override
     public void apply(Statistics statistics) {              

     }
 });`

but still I am getting this log when run this code

[Parsed_subtitles_0 @ 0xe4bc04c0] Using font provider fontconfig[Parsed_subtitles_0 @ 0xe4bc04c0] 
[Parsed_subtitles_0 @ 0xe4bc04c0] fontselect: failed to find any fallback with glyph 0x0 for font: (Arial, 400, 0)[Parsed_subtitles_0 @ 0xe4bc04c0] 

any idea please ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source