Building FFmpegKit with Custom Libraries - tanersener/ffmpeg-kit GitHub Wiki

ffmpeg-kit comes with a list of external libraries that can be enabled while building ffmpeg out of the box.

However, ffmpeg-kit is not limited to those built-in libraries only. You can build ffmpeg with other libraries as well. You just to tell build scripts how they can be compiled. And they will do that for you.

Top level build scripts (android.sh, ios.sh, macos.sh and tvos.sh) support optional flags to pass that information.

  1. First, the following flags must be provided to build a custom library. All of them are mandatory except repo-commit and repo-tag. Those two are interchangeable. Providing only one of them is sufficient. You can build more than one custom library as well.
--enable-custom-library-[n]-name=value				name of the custom library []
--enable-custom-library-[n]-repo=value				git repository of the source code []
--enable-custom-library-[n]-repo-commit=value			git commit to download the source code from []
--enable-custom-library-[n]-repo-tag=value			git tag to download the source code from []
--enable-custom-library-[n]-package-config-file-name=value	package config file installed by the build script []
--enable-custom-library-[n]-ffmpeg-enable-flag=value	        library name used in ffmpeg configure script to enable the library []
--enable-custom-library-[n]-license-file=value			licence file path relative to the library source folder []

The following Android only flag is also optional. It must be provided if the custom library uses libc++. Loading ffmpeg will fail with linking errors if the custom library uses it but the flag is not specified.

--enable-custom-library-[n]-uses-cpp				flag to specify that the library uses libc++ []

Examples:

./macos.sh \
 --enable-custom-library-1-name=chromaprint \
 --enable-custom-library-1-repo=https://github.com/tanersener/chromaprint \
 --enable-custom-library-1-repo-tag=v1.5.0 \
 --enable-custom-library-1-package-config-file-name=libchromaprint \
 --enable-custom-library-1-ffmpeg-enable-flag=chromaprint \
 --enable-custom-library-1-license-file=LICENSE.md

./android.sh \     
 --enable-custom-library-1-name=x265 \
 --enable-custom-library-1-repo=https://github.com/tanersener/x265 \
 --enable-custom-library-1-repo-tag=3.4 \
 --enable-custom-library-1-package-config-file-name=x265 \
 --enable-custom-library-1-ffmpeg-enable-flag=libx265 \
 --enable-custom-library-1-license-file=COPYING \
 --enable-custom-library-1-uses-cpp \
 --enable-gpl
  1. The second step is to provide the compile script. It must be created under scripts/android for Android and under scripts/apple for Apple platforms. It's name must be in the form of name.sh. Where the name is the same name given in the --enable-custom-library-[n]-name option passed. That's it.

You can look and copy the compile scripts we have for the built-in libraries under the scripts/android and scripts/apple folders. They will show you the general syntax and environment variables we're using in each platform.