Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.
Taner Şener edited this page Jul 26, 2020 · 12 revisions

1. Using Space Character In Command String

1.1 MobileFFmpeg >= 4.3

Since v4.3, overloaded execute method with delimiter parameter is deprecated and default execute method is enhanced to support single and double quotes. You can safely use the default execute method.

1.2 MobileFFmpeg < 4.3

execute method in MobileFFmpeg API is overloaded and has an optional delimiter parameter. Delimiter defines how the command string will be split into arguments. When delimiter is not specified the space character is used as the default delimiter. In that case, if one or more of your command arguments include a space character, in filename path or in -filter_complex block, then your command string will be split into invalid arguments and execution will fail.

Unfortunately, quotation marks are not supported by MobileFFmpeg. You can not use them to define arguments, so they won't help you on fixing this.

You have two options:

  1. You can split your command string into array yourself and call appropriate execute method:

    Android: int execute(String[] arguments)

    iOS / tvOS: (int)executeWithArguments: (NSArray*)arguments

  2. Or use a different delimiter character in your command string and call execute by specifying it.

    Android: FFmpeg.execute("-i~file1.mp4~-c:v~mpeg4~file2.mp4", "~");

    iOS / tvOS: [MobileFFmpeg execute: @"-i~file1.mp4~-c:v~mpeg4~file2.mp4", @"~"];


2. Depending Another Android Library Containing libc++_shared.so

MobileFFmpeg packages specified in Android c++ dependency guide include libc++_shared.so library. If a second library which also includes libc++_shared.so is added as a dependency, gradle fails with More than one file was found with OS independent path 'lib/x86/libc++_shared.so' error message.

You can fix this error by adding the following block into your build.gradle.

android {
    packagingOptions {
        pickFirst 'lib/x86/libc++_shared.so'
        pickFirst 'lib/x86_64/libc++_shared.so'
        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
        pickFirst 'lib/arm64-v8a/libc++_shared.so'
    }
}

3. Burning Subtitles on Android

ffmpeg requires a valid fontconfig configuration to render subtitles. Unfortunately, Android does not include a default fontconfig configuration. Therefore, if you do not register a font or specify a fontconfig configuration under Android, then burning process will not produce any errors but subtitles won't be burned into your file.

You can overcome this behaviour by registering a font using Config.setFontDirectory method or specifying your own fontconfig configuration using Config.setFontconfigConfigurationPath method.

4. drawtext filter on Android

ffmpeg requires a valid fontconfig configuration to render text while using drawtext filter. As described in #3, Android does not include a default fontconfig configuration. So, if you do not register a font or specify a fontconfig configuration under Android, then drawtext filter will fail with the following error.

Cannot find a valid font for the family Sans
Error initializing filter 'drawtext'
Error reinitializing filters!
Failed to inject frame into filter network: No such file or directory

You can resolve this error by registering a font using Config.setFontDirectory method or specifying your own fontconfig configuration using Config.setFontconfigConfigurationPath method.

Clone this wiki locally