├── .gitattributes ├── .gitignore ├── images └── output_structure.png ├── scripts ├── mbedtls │ ├── android.cmake │ ├── download.sh │ └── build.sh ├── libopus │ ├── download.sh │ └── build.sh ├── libaom │ ├── download.sh │ ├── build.sh │ └── android.cmake ├── libmp3lame │ ├── download.sh │ └── build.sh ├── libspeex │ ├── download.sh │ └── build.sh ├── libx265 │ ├── download.sh │ └── build.sh ├── libvpx │ ├── download.sh │ └── build.sh ├── libtwolame │ ├── download.sh │ └── build.sh ├── libxml2 │ ├── download.sh │ └── build.sh ├── libdav1d │ ├── download.sh │ └── build.sh ├── libfreetype │ ├── download.sh │ └── build.sh ├── libwebp │ ├── download.sh │ └── build.sh ├── libfribidi │ ├── download.sh │ └── build.sh ├── libbluray │ ├── download.sh │ └── build.sh ├── libx264 │ ├── download.sh │ └── build.sh ├── check-host-machine.sh ├── common-functions.sh ├── export-host-variables.sh ├── ffmpeg │ ├── build.sh │ └── download.sh ├── export-build-variables.sh └── parse-arguments.sh ├── .github └── workflows │ └── compilability_check.yml ├── LICENSE.txt ├── tools └── docker │ └── Dockerfile ├── ffmpeg-android-maker.sh └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set always lf for shell file 2 | *.sh text eol=lf 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | output 3 | sources 4 | stats 5 | .DS_Store 6 | .idea 7 | *.iml -------------------------------------------------------------------------------- /images/output_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Javernaut/ffmpeg-android-maker/HEAD/images/output_structure.png -------------------------------------------------------------------------------- /scripts/mbedtls/android.cmake: -------------------------------------------------------------------------------- 1 | include("$ENV{ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake") 2 | 3 | if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686") 4 | set(CMAKE_C_FLAGS "-mpclmul -msse2 -maes") 5 | endif() 6 | -------------------------------------------------------------------------------- /scripts/libopus/download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ${SCRIPTS_DIR}/common-functions.sh 4 | 5 | OPUS_VERSION=1.5.2 6 | 7 | downloadTarArchive \ 8 | "libopus" \ 9 | "https://downloads.xiph.org/releases/opus/opus-${OPUS_VERSION}.tar.gz" 10 | -------------------------------------------------------------------------------- /scripts/libaom/download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ${SCRIPTS_DIR}/common-functions.sh 4 | 5 | AOM_VERSION=v3.13.1 6 | 7 | downloadTarArchive \ 8 | "libaom" \ 9 | "https://aomedia.googlesource.com/aom/+archive/${AOM_VERSION}.tar.gz" \ 10 | true 11 | -------------------------------------------------------------------------------- /scripts/libmp3lame/download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ${SCRIPTS_DIR}/common-functions.sh 4 | 5 | LAME_VERSION=3.100 6 | 7 | downloadTarArchive \ 8 | "libmp3lame" \ 9 | "http://downloads.videolan.org/pub/contrib/lame/lame-${LAME_VERSION}.tar.gz" 10 | -------------------------------------------------------------------------------- /scripts/libspeex/download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ${SCRIPTS_DIR}/common-functions.sh 4 | 5 | SPEEX_VERSION=1.2.1 6 | 7 | downloadTarArchive \ 8 | "libspeex" \ 9 | "https://ftp.osuosl.org/pub/xiph/releases/speex/speex-${SPEEX_VERSION}.tar.gz" 10 | -------------------------------------------------------------------------------- /scripts/libx265/download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ${SCRIPTS_DIR}/common-functions.sh 4 | 5 | LIBX265_VERSION=4.1 6 | 7 | downloadTarArchive \ 8 | "libx265" \ 9 | "https://bitbucket.org/multicoreware/x265_git/downloads/x265_${LIBX265_VERSION}.tar.gz" 10 | -------------------------------------------------------------------------------- /scripts/libvpx/download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ${SCRIPTS_DIR}/common-functions.sh 4 | 5 | VPX_VERSION=v1.15.2 6 | 7 | downloadTarArchive \ 8 | "libvpx" \ 9 | "https://chromium.googlesource.com/webm/libvpx/+archive/${VPX_VERSION}.tar.gz" \ 10 | true 11 | -------------------------------------------------------------------------------- /scripts/libtwolame/download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ${SCRIPTS_DIR}/common-functions.sh 4 | 5 | TWOLAME_VERSION=0.4.0 6 | 7 | downloadTarArchive \ 8 | "libtwolame" \ 9 | "https://downloads.videolan.org/pub/contrib/twolame/twolame-${TWOLAME_VERSION}.tar.gz" 10 | -------------------------------------------------------------------------------- /scripts/libxml2/download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ${SCRIPTS_DIR}/common-functions.sh 4 | 5 | XML_VERSION=2.13.6 6 | 7 | downloadTarArchive \ 8 | "libxml2" \ 9 | "https://gitlab.gnome.org/GNOME/libxml2/-/archive/v${XML_VERSION}/libxml2-v${XML_VERSION}.tar.gz" 10 | -------------------------------------------------------------------------------- /scripts/libdav1d/download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ${SCRIPTS_DIR}/common-functions.sh 4 | 5 | DAV1D_VERSION=1.5.1 6 | 7 | downloadTarArchive \ 8 | "libdav1d" \ 9 | "https://code.videolan.org/videolan/dav1d/-/archive/${DAV1D_VERSION}/dav1d-${DAV1D_VERSION}.tar.gz" 10 | -------------------------------------------------------------------------------- /scripts/libfreetype/download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ${SCRIPTS_DIR}/common-functions.sh 4 | 5 | FREETYPE_VERSION=2.14.1 6 | 7 | downloadTarArchive \ 8 | "libfreetype" \ 9 | "https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz" 10 | -------------------------------------------------------------------------------- /scripts/libwebp/download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ${SCRIPTS_DIR}/common-functions.sh 4 | 5 | WEBP_VERSION=1.6.0 6 | 7 | downloadTarArchive \ 8 | "libwebp" \ 9 | "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz" 10 | -------------------------------------------------------------------------------- /scripts/libfribidi/download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ${SCRIPTS_DIR}/common-functions.sh 4 | 5 | FRIBIDI_VERSION=1.0.16 6 | 7 | downloadTarArchive \ 8 | "libfribidi" \ 9 | "https://github.com/fribidi/fribidi/releases/download/v${FRIBIDI_VERSION}/fribidi-${FRIBIDI_VERSION}.tar.xz" 10 | -------------------------------------------------------------------------------- /scripts/libbluray/download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ${SCRIPTS_DIR}/common-functions.sh 4 | 5 | LIBBLURAY_VERSION=1.3.4 6 | 7 | downloadTarArchive \ 8 | "libbluray" \ 9 | "https://download.videolan.org/pub/videolan/libbluray/${LIBBLURAY_VERSION}/libbluray-${LIBBLURAY_VERSION}.tar.bz2" 10 | 11 | -------------------------------------------------------------------------------- /scripts/mbedtls/download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | MBEDTLS_VERSION=v3.6.3 4 | 5 | git clone \ 6 | --depth 1 \ 7 | --branch $MBEDTLS_VERSION \ 8 | --recursive \ 9 | https://github.com/Mbed-TLS/mbedtls.git \ 10 | $MBEDTLS_VERSION 11 | 12 | LIBRARY_NAME=mbedtls 13 | export SOURCES_DIR_${LIBRARY_NAME}=$(pwd)/${MBEDTLS_VERSION} 14 | -------------------------------------------------------------------------------- /scripts/libx264/download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ${SCRIPTS_DIR}/common-functions.sh 4 | 5 | # Libx264 doesn't have any versioning system. Currently it has 2 branches: master and stable. 6 | # Latest commit in stable branch 7 | # 2 April 2025 at 09:40:08 CEST 8 | LIBX264_VERSION=b35605ace3ddf7c1a5d67a2eb553f034aef41d55 9 | 10 | downloadTarArchive \ 11 | "libx264" \ 12 | "https://code.videolan.org/videolan/x264/-/archive/${LIBX264_VERSION}/x264-${LIBX264_VERSION}.tar.gz" 13 | -------------------------------------------------------------------------------- /scripts/check-host-machine.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function checkVariablePresence() { 4 | VARIABLE_NAME=$1 5 | if [[ -z "${!VARIABLE_NAME}" ]]; then 6 | echo "The ${VARIABLE_NAME} environment variable isn't defined" 7 | echo $2 8 | exit 1 9 | fi 10 | } 11 | 12 | checkVariablePresence "ANDROID_SDK_HOME" \ 13 | "The variable should be set to the actual Android SDK path" || exit 1 14 | 15 | checkVariablePresence "ANDROID_NDK_HOME" \ 16 | "The variable should be set to the actual Android NDK path" || exit 1 17 | -------------------------------------------------------------------------------- /scripts/libwebp/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ./configure \ 4 | --prefix=${INSTALL_DIR} \ 5 | --host=${TARGET} \ 6 | --with-sysroot=${SYSROOT_PATH} \ 7 | --disable-shared \ 8 | --enable-static \ 9 | --with-pic \ 10 | CC=${FAM_CC} \ 11 | AR=${FAM_AR} \ 12 | RANLIB=${FAM_RANLIB} || exit 1 13 | 14 | # libsharpyuv.a is available alongside the libwebp.a 15 | export FFMPEG_EXTRA_LD_FLAGS="${FFMPEG_EXTRA_LD_FLAGS} -lm -lsharpyuv" 16 | 17 | ${MAKE_EXECUTABLE} clean 18 | ${MAKE_EXECUTABLE} -j${HOST_NPROC} 19 | ${MAKE_EXECUTABLE} install 20 | -------------------------------------------------------------------------------- /scripts/libbluray/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | CC=${FAM_CC} \ 4 | AR=${FAM_AR} \ 5 | AS=${FAM_AS} \ 6 | RANLIB=${FAM_RANLIB} \ 7 | ./configure \ 8 | --prefix=${INSTALL_DIR} \ 9 | --host=${TARGET} \ 10 | --with-sysroot=${SYSROOT_PATH} \ 11 | --disable-shared \ 12 | --enable-static \ 13 | --disable-examples \ 14 | --with-pic \ 15 | --without-libxml2 \ 16 | --without-freetype \ 17 | --without-fontconfig \ 18 | --disable-bdjava-jar || exit 1 19 | 20 | ${MAKE_EXECUTABLE} clean 21 | ${MAKE_EXECUTABLE} -j${HOST_NPROC} 22 | ${MAKE_EXECUTABLE} install 23 | -------------------------------------------------------------------------------- /scripts/libtwolame/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # TODO Consider adding a dependency - libsndfile 4 | 5 | ./configure \ 6 | --prefix=${INSTALL_DIR} \ 7 | --host=${TARGET} \ 8 | --with-sysroot=${SYSROOT_PATH} \ 9 | --disable-shared \ 10 | --enable-static \ 11 | --with-pic \ 12 | --disable-sndfile \ 13 | CC=${FAM_CC} \ 14 | AR=${FAM_AR} \ 15 | RANLIB=${FAM_RANLIB} || exit 1 16 | 17 | export FFMPEG_EXTRA_LD_FLAGS="${FFMPEG_EXTRA_LD_FLAGS} -lm" 18 | 19 | ${MAKE_EXECUTABLE} clean 20 | ${MAKE_EXECUTABLE} -j${HOST_NPROC} 21 | ${MAKE_EXECUTABLE} install 22 | -------------------------------------------------------------------------------- /scripts/libxml2/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ./autogen.sh \ 4 | --prefix=${INSTALL_DIR} \ 5 | --host=${TARGET} \ 6 | --with-sysroot=${SYSROOT_PATH} \ 7 | --disable-shared \ 8 | --disable-fast-install \ 9 | --enable-static \ 10 | --with-zlib \ 11 | --with-pic \ 12 | --without-python \ 13 | --without-debug \ 14 | --without-lzma \ 15 | CC=${FAM_CC} \ 16 | AR=${FAM_AR} \ 17 | RANLIB=${FAM_RANLIB} || exit 1 18 | 19 | export FFMPEG_EXTRA_LD_FLAGS="${FFMPEG_EXTRA_LD_FLAGS} -lm -lz" 20 | 21 | ${MAKE_EXECUTABLE} clean 22 | ${MAKE_EXECUTABLE} -j${HOST_NPROC} 23 | ${MAKE_EXECUTABLE} install 24 | -------------------------------------------------------------------------------- /scripts/libspeex/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ADDITIONAL_FLAGS= 4 | if [[ $ANDROID_ABI = "x86" ]] || [[ $ANDROID_ABI = "x86_64" ]]; then 5 | ADDITIONAL_FLAGS=--enable-sse 6 | fi 7 | 8 | ./configure \ 9 | --prefix=${INSTALL_DIR} \ 10 | --host=${TARGET} \ 11 | --with-sysroot=${SYSROOT_PATH} \ 12 | --disable-shared \ 13 | --enable-static \ 14 | --with-pic \ 15 | CC=${FAM_CC} \ 16 | AR=${FAM_AR} \ 17 | RANLIB=${FAM_RANLIB} \ 18 | ${ADDITIONAL_FLAGS} || exit 1 19 | 20 | export FFMPEG_EXTRA_LD_FLAGS="${FFMPEG_EXTRA_LD_FLAGS} -lm" 21 | 22 | ${MAKE_EXECUTABLE} clean 23 | ${MAKE_EXECUTABLE} -j${HOST_NPROC} 24 | ${MAKE_EXECUTABLE} install 25 | -------------------------------------------------------------------------------- /scripts/libopus/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ./configure \ 4 | --prefix=${INSTALL_DIR} \ 5 | --host=${TARGET} \ 6 | --disable-shared \ 7 | --enable-static \ 8 | --disable-fast-install \ 9 | --with-pic \ 10 | --with-sysroot=${SYSROOT_PATH} \ 11 | --enable-asm \ 12 | --enable-check-asm \ 13 | --disable-rtcd \ 14 | --disable-doc \ 15 | --disable-extra-programs \ 16 | CC=${FAM_CC} \ 17 | CCLD=${FAM_LD} \ 18 | RANLIB=${FAM_RANLIB} \ 19 | AR=${FAM_AR} 20 | 21 | export FFMPEG_EXTRA_LD_FLAGS="${FFMPEG_EXTRA_LD_FLAGS} -lm" 22 | 23 | ${MAKE_EXECUTABLE} clean 24 | ${MAKE_EXECUTABLE} -j${HOST_NPROC} 25 | ${MAKE_EXECUTABLE} install 26 | -------------------------------------------------------------------------------- /.github/workflows/compilability_check.yml: -------------------------------------------------------------------------------- 1 | name: Compilability check 2 | on: [ push, pull_request ] 3 | jobs: 4 | build: 5 | runs-on: ubuntu-24.04 6 | strategy: 7 | matrix: 8 | abi: [ "armeabi-v7a", "arm64-v8a", "x86", "x86_64" ] 9 | fail-fast: false 10 | steps: 11 | - uses: actions/checkout@v4 12 | 13 | - name: Setup the environment 14 | run: | 15 | sudo apt install meson nasm ninja-build 16 | 17 | - name: Executing the script 18 | run: | 19 | export ANDROID_SDK_HOME=$ANDROID_HOME 20 | export ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME 21 | ./ffmpeg-android-maker.sh -all-free -all-gpl -android=24 -abis=${{ matrix.abi }} 22 | -------------------------------------------------------------------------------- /scripts/libaom/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # libaom doesn't support building while being in its root directory 4 | CMAKE_BUILD_DIR=aom_build_${ANDROID_ABI} 5 | rm -rf ${CMAKE_BUILD_DIR} 6 | mkdir ${CMAKE_BUILD_DIR} 7 | cd ${CMAKE_BUILD_DIR} 8 | 9 | ${CMAKE_EXECUTABLE} .. \ 10 | -DANDROID_PLATFORM=${ANDROID_PLATFORM} \ 11 | -DANDROID_ABI=${ANDROID_ABI} \ 12 | -DCMAKE_TOOLCHAIN_FILE=${SCRIPTS_DIR}/libaom/android.cmake \ 13 | -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \ 14 | -DCONFIG_PIC=1 \ 15 | -DCONFIG_RUNTIME_CPU_DETECT=0 \ 16 | -DENABLE_TESTS=0 \ 17 | -DENABLE_DOCS=0 \ 18 | -DENABLE_TESTDATA=0 \ 19 | -DENABLE_EXAMPLES=0 \ 20 | -DENABLE_TOOLS=0 21 | 22 | ${MAKE_EXECUTABLE} -j${HOST_NPROC} 23 | ${MAKE_EXECUTABLE} install 24 | -------------------------------------------------------------------------------- /scripts/libfribidi/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ./configure \ 4 | --prefix=${INSTALL_DIR} \ 5 | --host=${TARGET} \ 6 | --with-sysroot=${SYSROOT_PATH} \ 7 | --disable-shared \ 8 | --enable-static \ 9 | --disable-dependency-tracking \ 10 | --disable-fast-install \ 11 | --disable-debug \ 12 | --disable-deprecated \ 13 | --with-pic \ 14 | CC=${FAM_CC} \ 15 | AR=${FAM_AR} \ 16 | RANLIB=${FAM_RANLIB} || exit 1 17 | 18 | ${MAKE_EXECUTABLE} clean 19 | # Compiling only the static library. Just 'make' will build an executable and docs as well. 20 | ${MAKE_EXECUTABLE} -j${HOST_NPROC} -C lib 21 | ${MAKE_EXECUTABLE} install -C lib 22 | # Installing the .pc file 23 | ${MAKE_EXECUTABLE} install-data-am 24 | -------------------------------------------------------------------------------- /scripts/mbedtls/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | CMAKE_BUILD_DIR=mbedtls_build_${ANDROID_ABI} 4 | # mbedtls authors park their source in a directory named mbedtls-${MBEDTLS_VERSION} 5 | # instead of root directory 6 | cd mbedtls-${MBEDTLS_VERSION} 7 | rm -rf ${CMAKE_BUILD_DIR} 8 | mkdir ${CMAKE_BUILD_DIR} 9 | cd ${CMAKE_BUILD_DIR} 10 | 11 | ${CMAKE_EXECUTABLE} .. \ 12 | -DANDROID_PLATFORM=${ANDROID_PLATFORM} \ 13 | -DANDROID_ABI=${ANDROID_ABI} \ 14 | -DCMAKE_TOOLCHAIN_FILE=${SCRIPTS_DIR}/mbedtls/android.cmake \ 15 | -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \ 16 | -DENABLE_TESTING=0 17 | 18 | ${MAKE_EXECUTABLE} -j${HOST_NPROC} 19 | ${MAKE_EXECUTABLE} install 20 | 21 | export EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --enable-protocol=https --enable-version3" -------------------------------------------------------------------------------- /scripts/libfreetype/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ./configure \ 4 | --prefix=${INSTALL_DIR} \ 5 | --host=${TARGET} \ 6 | --with-sysroot=${SYSROOT_PATH} \ 7 | --disable-shared \ 8 | --enable-static \ 9 | --with-pic \ 10 | --with-zlib \ 11 | --without-bzip2 \ 12 | --without-png \ 13 | --without-harfbuzz \ 14 | --without-brotli \ 15 | --without-old-mac-fonts \ 16 | --without-fsspec \ 17 | --without-fsref \ 18 | --without-quickdraw-toolbox \ 19 | --without-quickdraw-carbon \ 20 | --without-ats \ 21 | CC=${FAM_CC} \ 22 | AR=${FAM_AR} \ 23 | RANLIB=${FAM_RANLIB} || exit 1 24 | 25 | export FFMPEG_EXTRA_LD_FLAGS="${FFMPEG_EXTRA_LD_FLAGS} -lz" 26 | 27 | ${MAKE_EXECUTABLE} clean 28 | ${MAKE_EXECUTABLE} -j${HOST_NPROC} 29 | ${MAKE_EXECUTABLE} install 30 | -------------------------------------------------------------------------------- /scripts/libmp3lame/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | CFLAGS= 4 | if [ "$ANDROID_ABI" = "x86" ] ; then 5 | # mp3lame's configure script sets -mtune=native for i686, 6 | # which leads to compilation errors on Mac with arm processors, 7 | # because 'native' is recognized as apple-m1 processor. 8 | # Passing an empty mtune resets the value to default 9 | CFLAGS="-mtune=" 10 | fi 11 | 12 | ./configure \ 13 | --prefix=${INSTALL_DIR} \ 14 | --host=${TARGET} \ 15 | --with-sysroot=${SYSROOT_PATH} \ 16 | --disable-shared \ 17 | --enable-static \ 18 | --with-pic \ 19 | --disable-fast-install \ 20 | --disable-analyzer-hooks \ 21 | --disable-gtktest \ 22 | --disable-frontend \ 23 | CFLAGS=$CFLAGS \ 24 | CC=${FAM_CC} \ 25 | AR=${FAM_AR} \ 26 | RANLIB=${FAM_RANLIB} || exit 1 27 | 28 | ${MAKE_EXECUTABLE} clean 29 | ${MAKE_EXECUTABLE} -j${HOST_NPROC} 30 | ${MAKE_EXECUTABLE} install 31 | -------------------------------------------------------------------------------- /scripts/libx264/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | X264_AS=${FAM_CC} 4 | 5 | X264_ADDITIONAL_FLAGS= 6 | 7 | case $ANDROID_ABI in 8 | x86) 9 | # Disabling assembler optimizations due to text relocations 10 | X264_ADDITIONAL_FLAGS=--disable-asm 11 | ;; 12 | x86_64) 13 | X264_AS=${NASM_EXECUTABLE} 14 | ;; 15 | esac 16 | 17 | CC=${FAM_CC} \ 18 | AR=${FAM_AR} \ 19 | AS=${X264_AS} \ 20 | RANLIB=${FAM_RANLIB} \ 21 | STRIP=${FAM_STRIP} \ 22 | ./configure \ 23 | --prefix=${INSTALL_DIR} \ 24 | --host=${TARGET} \ 25 | --sysroot=${SYSROOT_PATH} \ 26 | --enable-pic \ 27 | --enable-static \ 28 | --disable-cli \ 29 | --disable-avs \ 30 | --disable-lavf \ 31 | --disable-cli \ 32 | --disable-ffms \ 33 | --disable-opencl \ 34 | --chroma-format=all \ 35 | --bit-depth=all \ 36 | ${X264_ADDITIONAL_FLAGS} || exit 1 37 | 38 | ${MAKE_EXECUTABLE} clean 39 | ${MAKE_EXECUTABLE} -j${HOST_NPROC} 40 | ${MAKE_EXECUTABLE} install 41 | -------------------------------------------------------------------------------- /scripts/libdav1d/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | CROSS_FILE_NAME=crossfile-${ANDROID_ABI}.meson 4 | 5 | rm ${CROSS_FILE_NAME} 6 | 7 | cat > "${CROSS_FILE_NAME}" << EOF 8 | [binaries] 9 | c = '${FAM_CC}' 10 | ar = '${FAM_AR}' 11 | strip = '${FAM_STRIP}' 12 | nasm = '${NASM_EXECUTABLE}' 13 | pkgconfig = '${PKG_CONFIG_EXECUTABLE}' 14 | 15 | [properties] 16 | needs_exe_wrapper = true 17 | sys_root = '${SYSROOT_PATH}' 18 | 19 | [host_machine] 20 | system = 'linux' 21 | cpu_family = '${CPU_FAMILY}' 22 | cpu = '${TARGET_TRIPLE_MACHINE_ARCH}' 23 | endian = 'little' 24 | 25 | [built-in options] 26 | prefix = '${INSTALL_DIR}' 27 | EOF 28 | 29 | BUILD_DIRECTORY=build/${ANDROID_ABI} 30 | 31 | rm -rf ${BUILD_DIRECTORY} 32 | 33 | ${MESON_EXECUTABLE} . ${BUILD_DIRECTORY} \ 34 | --cross-file ${CROSS_FILE_NAME} \ 35 | --default-library=static \ 36 | -Denable_asm=true \ 37 | -Denable_tools=false \ 38 | -Denable_tests=false \ 39 | -Denable_examples=false \ 40 | -Dtestdata_tests=false 41 | 42 | cd ${BUILD_DIRECTORY} 43 | 44 | ${NINJA_EXECUTABLE} -j ${HOST_NPROC} 45 | ${NINJA_EXECUTABLE} install 46 | -------------------------------------------------------------------------------- /scripts/common-functions.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Function that downloads an archive with the source code by the given url, 4 | # extracts its files and exports a variable SOURCES_DIR_${LIBRARY_NAME} 5 | function downloadTarArchive() { 6 | # The full name of the library 7 | LIBRARY_NAME=$1 8 | # The url of the source code archive 9 | DOWNLOAD_URL=$2 10 | # Optional. If 'true' then the function creates an extra directory for archive extraction. 11 | NEED_EXTRA_DIRECTORY=$3 12 | 13 | ARCHIVE_NAME=${DOWNLOAD_URL##*/} 14 | # File name without extension 15 | LIBRARY_SOURCES="${ARCHIVE_NAME%.tar.*}" 16 | 17 | echo "Ensuring sources of ${LIBRARY_NAME} in ${LIBRARY_SOURCES}" 18 | 19 | if [[ ! -d "$LIBRARY_SOURCES" ]]; then 20 | curl -LO ${DOWNLOAD_URL} 21 | 22 | EXTRACTION_DIR="." 23 | if [ "$NEED_EXTRA_DIRECTORY" = true ] ; then 24 | EXTRACTION_DIR=${LIBRARY_SOURCES} 25 | mkdir ${EXTRACTION_DIR} 26 | fi 27 | 28 | tar xf ${ARCHIVE_NAME} -C ${EXTRACTION_DIR} 29 | rm ${ARCHIVE_NAME} 30 | fi 31 | 32 | export SOURCES_DIR_${LIBRARY_NAME}=$(pwd)/${LIBRARY_SOURCES} 33 | } 34 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Oleksandr Berezhnyi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /scripts/libx265/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # libaom doesn't support building while being in its root directory 4 | CMAKE_BUILD_DIR=libx265_build_${ANDROID_ABI} 5 | rm -rf ${CMAKE_BUILD_DIR} 6 | mkdir ${CMAKE_BUILD_DIR} 7 | cd ${CMAKE_BUILD_DIR} 8 | 9 | EXTRA_CMAKE_ARG="" 10 | case $ANDROID_ABI in 11 | arm64-v8a|x86) 12 | # Disabling assembler optimizations for certain ABIs. Not a good solution, but it at least works 13 | EXTRA_CMAKE_ARG="-DENABLE_ASSEMBLY=OFF" 14 | ;; 15 | esac 16 | 17 | ${CMAKE_EXECUTABLE} ../source \ 18 | -DANDROID_PLATFORM=${ANDROID_PLATFORM} \ 19 | -DANDROID_ABI=${ANDROID_ABI} \ 20 | -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \ 21 | -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \ 22 | -DENABLE_PIC=ON \ 23 | -DENABLE_SHARED=OFF \ 24 | -DENABLE_CLI=OFF \ 25 | $EXTRA_CMAKE_ARG 26 | 27 | EXTRA_SED_ARG="" 28 | if [[ "$OSTYPE" == "darwin"* ]]; then 29 | EXTRA_SED_ARG="''" 30 | fi 31 | sed -i $EXTRA_SED_ARG 's/-lpthread/-pthread/' CMakeFiles/cli.dir/link.txt 32 | sed -i $EXTRA_SED_ARG 's/-lpthread/-pthread/' CMakeFiles/x265-shared.dir/link.txt 33 | sed -i $EXTRA_SED_ARG 's/-lpthread/-pthread/' CMakeFiles/x265-static.dir/link.txt 34 | 35 | export FFMPEG_EXTRA_LD_FLAGS="${FFMPEG_EXTRA_LD_FLAGS} -lm -lc++" 36 | 37 | ${MAKE_EXECUTABLE} -j${HOST_NPROC} 38 | ${MAKE_EXECUTABLE} install 39 | -------------------------------------------------------------------------------- /scripts/libaom/android.cmake: -------------------------------------------------------------------------------- 1 | # Enable NEON for all ARM processors 2 | set(ANDROID_ARM_NEON TRUE) 3 | 4 | # By including this file all necessary variables that point to compiler, linker, etc. 5 | # will be setup. Well, almost all. 6 | # Two variables have to be set before this line though: 7 | # ANDROID_PLATOFORM - the API level to compile against (number) 8 | # ANDROID_ABI - the ABI of the target platform 9 | include("$ENV{ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake") 10 | 11 | # AS_EXECUTABLE (AV1 Codec Library's variable) should point to an assembler 12 | # For x86 and x86_64 ABIs it needs yasm 13 | # For armeabi-v7a and arm64-v8a it is ok to use GNU assembler 14 | # When ANDROID_ABI is x86 or x86_64, 15 | # then CMAKE_ASM_NASM_COMPILER variable will point to the yasm compiler (it is set by android.toolchain.cmake) 16 | if(DEFINED CMAKE_ASM_NASM_COMPILER) 17 | set(AS_EXECUTABLE ${CMAKE_ASM_NASM_COMPILER}) 18 | else() 19 | set(AS_EXECUTABLE ${ANDROID_ASM_COMPILER}) 20 | endif() 21 | 22 | # AV1 Codec Library doesn't recognise 'i686' as CMAKE_SYSTEM_PROCESSOR 23 | # We have to specify x86 in AOM_TARGET_CPU variable instead 24 | if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686") 25 | set(AOM_TARGET_CPU x86) 26 | endif() 27 | 28 | # AV1 Codec Library doesn't recognise 'Android' as CMAKE_SYSTEM_NAME 29 | # We should set it to Linux instead 30 | set(CMAKE_SYSTEM_NAME "Linux") 31 | -------------------------------------------------------------------------------- /scripts/export-host-variables.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Defining a toolchain directory's name according to the current OS. 4 | # Assume that proper version of NDK is installed 5 | # and is referenced by ANDROID_NDK_HOME environment variable 6 | case "$OSTYPE" in 7 | darwin*) HOST_TAG="darwin-x86_64" ;; 8 | linux*) HOST_TAG="linux-x86_64" ;; 9 | msys) 10 | case "$(uname -m)" in 11 | x86_64) HOST_TAG="windows-x86_64" ;; 12 | i686) HOST_TAG="windows" ;; 13 | esac 14 | ;; 15 | esac 16 | 17 | if [[ $OSTYPE == "darwin"* ]]; then 18 | HOST_NPROC=$(sysctl -n hw.physicalcpu) 19 | else 20 | HOST_NPROC=$(nproc) 21 | fi 22 | 23 | # The variable is used as a path segment of the toolchain path 24 | export HOST_TAG=$HOST_TAG 25 | # Number of physical cores in the system to facilitate parallel assembling 26 | export HOST_NPROC=$HOST_NPROC 27 | 28 | # Using CMake from the Android SDK 29 | export CMAKE_EXECUTABLE=$(which cmake) 30 | # Using Make from the Android SDK 31 | export MAKE_EXECUTABLE=${ANDROID_NDK_HOME}/prebuilt/${HOST_TAG}/bin/make 32 | # Using Build machine's Ninja. It is used for libdav1d building. Needs to be installed 33 | export NINJA_EXECUTABLE=$(which ninja) 34 | # Meson is used for libdav1d building. Needs to be installed 35 | export MESON_EXECUTABLE=$(which meson) 36 | # Nasm is used for libdav1d and libx264 building. Needs to be installed 37 | export NASM_EXECUTABLE=$(which nasm) 38 | # A utility to properly pick shared libraries by FFmpeg's configure script. Needs to be installed 39 | export PKG_CONFIG_EXECUTABLE=$(which pkg-config) 40 | -------------------------------------------------------------------------------- /scripts/libvpx/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | VPX_AS=${FAM_AS} 4 | 5 | case $ANDROID_ABI in 6 | x86) 7 | EXTRA_BUILD_FLAGS="--target=x86-android-gcc --disable-sse4_1 --disable-avx --disable-avx2 --disable-avx512" 8 | VPX_AS=${FAM_YASM} 9 | ;; 10 | x86_64) 11 | EXTRA_BUILD_FLAGS="--target=x86_64-android-gcc --disable-avx --disable-avx2 --disable-avx512" 12 | VPX_AS=${FAM_YASM} 13 | ;; 14 | armeabi-v7a) 15 | EXTRA_BUILD_FLAGS="--target=armv7-android-gcc --enable-thumb --disable-neon" 16 | ;; 17 | arm64-v8a) 18 | EXTRA_BUILD_FLAGS="--target=arm64-android-gcc --enable-thumb" 19 | ;; 20 | esac 21 | 22 | CC=${FAM_CC} \ 23 | CXX=${FAM_CXX} \ 24 | AR=${FAM_AR} \ 25 | LD=${FAM_LD} \ 26 | AS=${VPX_AS} \ 27 | STRIP=${FAM_STRIP} \ 28 | NM=${FAM_NM} \ 29 | ./configure \ 30 | ${EXTRA_BUILD_FLAGS} \ 31 | --prefix=${INSTALL_DIR} \ 32 | --libc=${SYSROOT_PATH} \ 33 | --enable-pic \ 34 | --enable-realtime-only \ 35 | --enable-install-libs \ 36 | --enable-multithread \ 37 | --enable-webm-io \ 38 | --enable-libyuv \ 39 | --enable-small \ 40 | --enable-better-hw-compatibility \ 41 | --enable-vp8 \ 42 | --enable-vp9 \ 43 | --enable-static \ 44 | --disable-shared \ 45 | --disable-ccache \ 46 | --disable-debug \ 47 | --disable-gprof \ 48 | --disable-gcov \ 49 | --disable-dependency-tracking \ 50 | --disable-install-docs \ 51 | --disable-install-bins \ 52 | --disable-install-srcs \ 53 | --disable-examples \ 54 | --disable-tools \ 55 | --disable-docs \ 56 | --disable-unit-tests \ 57 | --disable-decode-perf-tests \ 58 | --disable-encode-perf-tests \ 59 | --disable-runtime-cpu-detect || exit 1 60 | 61 | ${MAKE_EXECUTABLE} clean 62 | ${MAKE_EXECUTABLE} -j${HOST_NPROC} 63 | ${MAKE_EXECUTABLE} install 64 | -------------------------------------------------------------------------------- /tools/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM --platform=linux/amd64 ubuntu:24.04 2 | 3 | # Arguments that can be overridden in 'docker build' command: 4 | # Versions of Android SDK and NDK. 5 | ARG VERSION_SDK=13114758 6 | ARG VERSION_NDK=28.2.13676358 7 | 8 | # The HOME variable isn't available for ENV directive (during building an image). 9 | # So we define one manually. For alpine and ubuntu it should be '/root' 10 | ARG HOME_TWIN=/root 11 | 12 | # Creating mandatory environment variables 13 | ENV ANDROID_SDK_HOME=${HOME_TWIN}/android-sdk 14 | ENV ANDROID_NDK_HOME=${ANDROID_SDK_HOME}/ndk/${VERSION_NDK} 15 | 16 | # Installing basic software 17 | RUN apt-get --allow-releaseinfo-change update && apt-get install -y --no-install-recommends \ 18 | ninja-build \ 19 | build-essential \ 20 | openjdk-17-jdk-headless \ 21 | curl \ 22 | unzip \ 23 | cmake \ 24 | meson \ 25 | bash \ 26 | nasm \ 27 | pkg-config \ 28 | make \ 29 | git \ 30 | autoconf \ 31 | automake \ 32 | libtool \ 33 | && apt-get clean \ 34 | && rm -rf /var/lib/apt/lists/* 35 | 36 | # Download the Android SDK 37 | RUN curl https://dl.google.com/android/repository/commandlinetools-linux-${VERSION_SDK}_latest.zip --output ${HOME_TWIN}/android-sdk.zip 38 | # Unzip it and remove the archive 39 | RUN mkdir -p ${HOME_TWIN}/android-sdk && \ 40 | unzip -qq ${HOME_TWIN}/android-sdk.zip -d ${HOME_TWIN}/android-sdk && \ 41 | rm ${HOME_TWIN}/android-sdk.zip 42 | 43 | # Installing components through the Android SDK 44 | RUN installAndroidComponent() { yes | ${ANDROID_SDK_HOME}/cmdline-tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_HOME} "$1" > /dev/null; } && \ 45 | installAndroidComponent "ndk;${VERSION_NDK}" 46 | 47 | # The command to be executed when a container is running 48 | # Passing additional arguments to the script is done via FAM_ARGS environment variable 49 | CMD cd /mnt/ffmpeg-android-maker && ./ffmpeg-android-maker.sh ${FAM_ARGS} 50 | -------------------------------------------------------------------------------- /scripts/ffmpeg/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | case $ANDROID_ABI in 4 | x86) 5 | # Disabling assembler optimizations, because they have text relocations 6 | EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --disable-asm" 7 | ;; 8 | x86_64) 9 | EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --x86asmexe=${FAM_YASM}" 10 | ;; 11 | esac 12 | 13 | if [ "$FFMPEG_GPL_ENABLED" = true ] ; then 14 | EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --enable-gpl" 15 | fi 16 | 17 | # Preparing flags for enabling requested libraries 18 | ADDITIONAL_COMPONENTS= 19 | for LIBARY_NAME in ${FFMPEG_EXTERNAL_LIBRARIES[@]} 20 | do 21 | ADDITIONAL_COMPONENTS+=" --enable-$LIBARY_NAME" 22 | done 23 | 24 | # Referencing dependencies without pkgconfig 25 | DEP_CFLAGS="-I${BUILD_DIR_EXTERNAL}/${ANDROID_ABI}/include" 26 | DEP_LD_FLAGS="-L${BUILD_DIR_EXTERNAL}/${ANDROID_ABI}/lib $FFMPEG_EXTRA_LD_FLAGS" 27 | 28 | # Android 15 with 16 kb page size support 29 | # https://developer.android.com/guide/practices/page-sizes#compile-r27 30 | EXTRA_LDFLAGS="-Wl,-z,max-page-size=16384 $DEP_LD_FLAGS" 31 | 32 | ./configure \ 33 | --prefix=${BUILD_DIR_FFMPEG}/${ANDROID_ABI} \ 34 | --enable-cross-compile \ 35 | --target-os=android \ 36 | --arch=${TARGET_TRIPLE_MACHINE_ARCH} \ 37 | --sysroot=${SYSROOT_PATH} \ 38 | --cc=${FAM_CC} \ 39 | --cxx=${FAM_CXX} \ 40 | --ld=${FAM_LD} \ 41 | --ar=${FAM_AR} \ 42 | --as=${FAM_CC} \ 43 | --nm=${FAM_NM} \ 44 | --ranlib=${FAM_RANLIB} \ 45 | --strip=${FAM_STRIP} \ 46 | --extra-cflags="-O3 -fPIC $DEP_CFLAGS" \ 47 | --extra-ldflags="$EXTRA_LDFLAGS" \ 48 | --enable-shared \ 49 | --disable-static \ 50 | --disable-vulkan \ 51 | --pkg-config=${PKG_CONFIG_EXECUTABLE} \ 52 | ${EXTRA_BUILD_CONFIGURATION_FLAGS} \ 53 | $ADDITIONAL_COMPONENTS || exit 1 54 | 55 | ${MAKE_EXECUTABLE} clean 56 | ${MAKE_EXECUTABLE} -j${HOST_NPROC} 57 | ${MAKE_EXECUTABLE} install 58 | -------------------------------------------------------------------------------- /scripts/ffmpeg/download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Script to download FFmpeg's source code 4 | # Relies on FFMPEG_SOURCE_TYPE and FFMPEG_SOURCE_VALUE variables 5 | # to choose the valid origin and version 6 | 7 | # Exports SOURCES_DIR_ffmpeg - path where actual sources are stored 8 | 9 | # Getting sources of a particular FFmpeg release. 10 | # Same argument (FFmpeg version) produces the same source set. 11 | function ensureSourcesTar() { 12 | source ${SCRIPTS_DIR}/common-functions.sh 13 | 14 | downloadTarArchive \ 15 | "ffmpeg" \ 16 | "https://www.ffmpeg.org/releases/ffmpeg-${FFMPEG_SOURCE_VALUE}.tar.bz2" 17 | } 18 | 19 | # Getting sources of a particular branch or a tag of FFmpeg's git repository. 20 | # Same branch name may produce different source set, 21 | # as the branch in origin repository may be updated in future. 22 | # Git tags lead to stable states of the source code. 23 | function ensureSourcesGit() { 24 | NAME_TO_CHECKOUT=${FFMPEG_SOURCE_VALUE} 25 | 26 | GIT_DIRECTORY=ffmpeg-git 27 | 28 | FFMPEG_SOURCES=$(pwd)/${GIT_DIRECTORY} 29 | 30 | if [[ ! -d "$FFMPEG_SOURCES" ]]; then 31 | git clone https://git.ffmpeg.org/ffmpeg.git ${GIT_DIRECTORY} 32 | fi 33 | 34 | cd ${GIT_DIRECTORY} 35 | git reset --hard 36 | 37 | git checkout $NAME_TO_CHECKOUT 38 | if [ ${FFMPEG_SOURCE_TYPE} = "GIT_BRANCH" ]; then 39 | # Forcing the update of a branch 40 | git pull origin $BRANCH 41 | fi 42 | 43 | # Additional logging to keep track of an exact commit to build 44 | echo "Commit to build:" 45 | git rev-parse HEAD 46 | 47 | export SOURCES_DIR_ffmpeg=${FFMPEG_SOURCES} 48 | } 49 | 50 | # Actual code 51 | case ${FFMPEG_SOURCE_TYPE} in 52 | GIT_TAG) 53 | echo "Using FFmpeg git tag: ${FFMPEG_SOURCE_VALUE}" 54 | ensureSourcesGit 55 | ;; 56 | GIT_BRANCH) 57 | echo "Using FFmpeg git repository and its branch: ${FFMPEG_SOURCE_VALUE}" 58 | ensureSourcesGit 59 | ;; 60 | TAR) 61 | echo "Using FFmpeg source archive: ${FFMPEG_SOURCE_VALUE}" 62 | ensureSourcesTar 63 | ;; 64 | esac 65 | -------------------------------------------------------------------------------- /scripts/export-build-variables.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function max() { 4 | [ $1 -ge $2 ] && echo "$1" || echo "$2" 5 | } 6 | 7 | export ANDROID_ABI=$1 8 | 9 | if [ $ANDROID_ABI = "arm64-v8a" ] || [ $ANDROID_ABI = "x86_64" ] ; then 10 | # For 64bit we use value not less than 21 11 | export ANDROID_PLATFORM=$(max ${DESIRED_ANDROID_API_LEVEL} 21) 12 | else 13 | export ANDROID_PLATFORM=${DESIRED_ANDROID_API_LEVEL} 14 | fi 15 | 16 | export TOOLCHAIN_PATH=${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/${HOST_TAG} 17 | export SYSROOT_PATH=${TOOLCHAIN_PATH}/sysroot 18 | 19 | TARGET_TRIPLE_MACHINE_CC= 20 | CPU_FAMILY= 21 | export TARGET_TRIPLE_OS="android" 22 | 23 | case $ANDROID_ABI in 24 | armeabi-v7a) 25 | #cc armv7a-linux-androideabi16-clang 26 | export TARGET_TRIPLE_MACHINE_ARCH=arm 27 | TARGET_TRIPLE_MACHINE_CC=armv7a 28 | export TARGET_TRIPLE_OS=androideabi 29 | ;; 30 | arm64-v8a) 31 | #cc aarch64-linux-android21-clang 32 | export TARGET_TRIPLE_MACHINE_ARCH=aarch64 33 | ;; 34 | x86) 35 | #cc i686-linux-android16-clang 36 | export TARGET_TRIPLE_MACHINE_ARCH=i686 37 | CPU_FAMILY=x86 38 | ;; 39 | x86_64) 40 | #cc x86_64-linux-android21-clang 41 | export TARGET_TRIPLE_MACHINE_ARCH=x86_64 42 | ;; 43 | esac 44 | 45 | # If the cc-specific variable isn't set, we fallback to binutils version 46 | [ -z "${TARGET_TRIPLE_MACHINE_CC}" ] && TARGET_TRIPLE_MACHINE_CC=${TARGET_TRIPLE_MACHINE_ARCH} 47 | 48 | [ -z "${CPU_FAMILY}" ] && CPU_FAMILY=${TARGET_TRIPLE_MACHINE_ARCH} 49 | export CPU_FAMILY=$CPU_FAMILY 50 | 51 | # Common prefix for ld, as, etc. 52 | export CROSS_PREFIX_WITH_PATH=${TOOLCHAIN_PATH}/bin/llvm- 53 | 54 | # Exporting Binutils paths, if passing just CROSS_PREFIX_WITH_PATH is not enough 55 | # The FAM_ prefix is used to eliminate passing those values implicitly to build systems 56 | export FAM_ADDR2LINE=${CROSS_PREFIX_WITH_PATH}addr2line 57 | export FAM_AR=${CROSS_PREFIX_WITH_PATH}ar 58 | export FAM_AS=${CROSS_PREFIX_WITH_PATH}as 59 | export FAM_NM=${CROSS_PREFIX_WITH_PATH}nm 60 | export FAM_OBJCOPY=${CROSS_PREFIX_WITH_PATH}objcopy 61 | export FAM_OBJDUMP=${CROSS_PREFIX_WITH_PATH}objdump 62 | export FAM_RANLIB=${CROSS_PREFIX_WITH_PATH}ranlib 63 | export FAM_READELF=${CROSS_PREFIX_WITH_PATH}readelf 64 | export FAM_SIZE=${CROSS_PREFIX_WITH_PATH}size 65 | export FAM_STRINGS=${CROSS_PREFIX_WITH_PATH}strings 66 | export FAM_STRIP=${CROSS_PREFIX_WITH_PATH}strip 67 | 68 | export TARGET=${TARGET_TRIPLE_MACHINE_CC}-linux-${TARGET_TRIPLE_OS}${ANDROID_PLATFORM} 69 | # The name for compiler is slightly different, so it is defined separately. 70 | export FAM_CC=${TOOLCHAIN_PATH}/bin/${TARGET}-clang 71 | export FAM_CXX=${FAM_CC}++ 72 | export FAM_LD=${FAM_CC} 73 | 74 | # TODO consider abondaning this strategy of defining the name of the clang wrapper 75 | # in favour of just passing -mstackrealign and -fno-addrsig depending on 76 | # ANDROID_ABI, ANDROID_PLATFORM and NDK's version 77 | 78 | # Special variable for the yasm assembler 79 | export FAM_YASM=${TOOLCHAIN_PATH}/bin/yasm 80 | 81 | # A variable to which certain dependencies can add -l arguments during build.sh 82 | export FFMPEG_EXTRA_LD_FLAGS= 83 | 84 | # A variable to which certain dependencies can add addtional arguments during ffmpeg build.sh 85 | export EXTRA_BUILD_CONFIGURATION_FLAGS= 86 | 87 | export INSTALL_DIR=${BUILD_DIR_EXTERNAL}/${ANDROID_ABI} 88 | 89 | # Forcing FFmpeg and its dependencies to look for dependencies 90 | # in a specific directory when pkg-config is used 91 | export PKG_CONFIG_LIBDIR=${INSTALL_DIR}/lib/pkgconfig 92 | -------------------------------------------------------------------------------- /ffmpeg-android-maker.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Defining essential directories 4 | 5 | # The root of the project 6 | export BASE_DIR="$( cd "$( dirname "$0" )" && pwd )" 7 | # Directory that contains source code for FFmpeg and its dependencies 8 | # Each library has its own subdirectory 9 | # Multiple versions of the same library can be stored inside librarie's directory 10 | export SOURCES_DIR=${BASE_DIR}/sources 11 | # Directory to place some statistics about the build. 12 | # Currently - the info about Text Relocations 13 | export STATS_DIR=${BASE_DIR}/stats 14 | # Directory that contains helper scripts and 15 | # scripts to download and build FFmpeg and each dependency separated by subdirectories 16 | export SCRIPTS_DIR=${BASE_DIR}/scripts 17 | # The directory to use by Android project 18 | # All FFmpeg's libraries and headers are copied there 19 | export OUTPUT_DIR=${BASE_DIR}/output 20 | 21 | # Check the host machine for proper setup and fail fast otherwise 22 | ${SCRIPTS_DIR}/check-host-machine.sh || exit 1 23 | 24 | # Directory to use as a place to build/install FFmpeg and its dependencies 25 | BUILD_DIR=${BASE_DIR}/build 26 | # Separate directory to build FFmpeg to 27 | export BUILD_DIR_FFMPEG=$BUILD_DIR/ffmpeg 28 | # All external libraries are installed to a single root 29 | # to make easier referencing them when FFmpeg is being built. 30 | export BUILD_DIR_EXTERNAL=$BUILD_DIR/external 31 | 32 | # Function that copies *.so files and headers of the current ANDROID_ABI 33 | # to the proper place inside OUTPUT_DIR 34 | function prepareOutput() { 35 | OUTPUT_LIB=${OUTPUT_DIR}/lib/${ANDROID_ABI} 36 | mkdir -p ${OUTPUT_LIB} 37 | cp ${BUILD_DIR_FFMPEG}/${ANDROID_ABI}/lib/*.so ${OUTPUT_LIB} 38 | 39 | OUTPUT_HEADERS=${OUTPUT_DIR}/include/${ANDROID_ABI} 40 | mkdir -p ${OUTPUT_HEADERS} 41 | cp -r ${BUILD_DIR_FFMPEG}/${ANDROID_ABI}/include/* ${OUTPUT_HEADERS} 42 | } 43 | 44 | # Saving stats about text relocation presence. 45 | # If the result file doesn't have 'TEXTREL' at all, then we are good. 46 | # Otherwise the whole script is interrupted 47 | function checkTextRelocations() { 48 | TEXT_REL_STATS_FILE=${STATS_DIR}/text-relocations.txt 49 | ${FAM_READELF} --dynamic ${BUILD_DIR_FFMPEG}/${ANDROID_ABI}/lib/*.so | grep 'TEXTREL\|File' >> ${TEXT_REL_STATS_FILE} 50 | 51 | if grep -q TEXTREL ${TEXT_REL_STATS_FILE}; then 52 | echo "There are text relocations in output files:" 53 | cat ${TEXT_REL_STATS_FILE} 54 | exit 1 55 | fi 56 | } 57 | 58 | # Actual work of the script 59 | 60 | # Clearing previously created binaries 61 | rm -rf ${BUILD_DIR} 62 | rm -rf ${STATS_DIR} 63 | rm -rf ${OUTPUT_DIR} 64 | mkdir -p ${STATS_DIR} 65 | mkdir -p ${OUTPUT_DIR} 66 | 67 | # Exporting more necessary variabls 68 | source ${SCRIPTS_DIR}/export-host-variables.sh 69 | source ${SCRIPTS_DIR}/parse-arguments.sh 70 | 71 | # Treating FFmpeg as just a module to build after its dependencies 72 | COMPONENTS_TO_BUILD=${EXTERNAL_LIBRARIES[@]} 73 | COMPONENTS_TO_BUILD+=( "ffmpeg" ) 74 | 75 | # Get the source code of component to build 76 | for COMPONENT in ${COMPONENTS_TO_BUILD[@]} 77 | do 78 | echo "Getting source code of the component: ${COMPONENT}" 79 | SOURCE_DIR_FOR_COMPONENT=${SOURCES_DIR}/${COMPONENT} 80 | 81 | mkdir -p ${SOURCE_DIR_FOR_COMPONENT} 82 | cd ${SOURCE_DIR_FOR_COMPONENT} 83 | 84 | # Executing the component-specific script for downloading the source code 85 | source ${SCRIPTS_DIR}/${COMPONENT}/download.sh 86 | 87 | # The download.sh script has to export SOURCES_DIR_$COMPONENT variable 88 | # with actual path of the source code. This is done for possiblity to switch 89 | # between different verions of a component. 90 | # If it isn't set, consider SOURCE_DIR_FOR_COMPONENT as the proper value 91 | COMPONENT_SOURCES_DIR_VARIABLE=SOURCES_DIR_${COMPONENT} 92 | if [[ -z "${!COMPONENT_SOURCES_DIR_VARIABLE}" ]]; then 93 | export SOURCES_DIR_${COMPONENT}=${SOURCE_DIR_FOR_COMPONENT} 94 | fi 95 | 96 | # Returning to the rood directory. Just in case. 97 | cd ${BASE_DIR} 98 | done 99 | 100 | # Main build loop 101 | for ABI in ${FFMPEG_ABIS_TO_BUILD[@]} 102 | do 103 | # Exporting variables for the current ABI 104 | source ${SCRIPTS_DIR}/export-build-variables.sh ${ABI} 105 | 106 | for COMPONENT in ${COMPONENTS_TO_BUILD[@]} 107 | do 108 | echo "Building the component: ${COMPONENT}" 109 | COMPONENT_SOURCES_DIR_VARIABLE=SOURCES_DIR_${COMPONENT} 110 | 111 | # Going to the actual source code directory of the current component 112 | cd ${!COMPONENT_SOURCES_DIR_VARIABLE} 113 | 114 | # and executing the component-specific build script 115 | source ${SCRIPTS_DIR}/${COMPONENT}/build.sh || exit 1 116 | 117 | # Returning to the root directory. Just in case. 118 | cd ${BASE_DIR} 119 | done 120 | 121 | checkTextRelocations || exit 1 122 | 123 | prepareOutput 124 | done 125 | -------------------------------------------------------------------------------- /scripts/parse-arguments.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script parses arguments that were passed to ffmpeg-android-maker.sh 4 | # and exports a bunch of varables that are used elsewhere. 5 | 6 | # Local variables with default values (except ABIS_TO_BUILD). 7 | # Can be overridden with specific arguments. 8 | # See the end of this file for more description. 9 | ABIS_TO_BUILD=() 10 | API_LEVEL=21 11 | SOURCE_TYPE=TAR 12 | SOURCE_VALUE=7.1.2 13 | EXTERNAL_LIBRARIES=() 14 | FFMPEG_GPL_ENABLED=false 15 | 16 | # All FREE libraries that are supported 17 | SUPPORTED_LIBRARIES_FREE=( 18 | "libaom" 19 | "libdav1d" 20 | "libmp3lame" 21 | "libopus" 22 | "libtwolame" 23 | "libspeex" 24 | "libvpx" 25 | "libwebp" 26 | "libfreetype" 27 | "libfribidi" 28 | "mbedtls" 29 | "libbluray" 30 | "libxml2" 31 | ) 32 | 33 | # All GPL libraries that are supported 34 | SUPPORTED_LIBRARIES_GPL=( 35 | "libx264" 36 | "libx265" 37 | ) 38 | 39 | for argument in "$@"; do 40 | case $argument in 41 | # Build for only specified ABIs (separated by comma) 42 | --target-abis=* | -abis=*) 43 | IFS=',' read -ra ABIS <<<"${argument#*=}" 44 | for abi in "${ABIS[@]}"; do 45 | case $abi in 46 | x86 | x86_64 | armeabi-v7a | arm64-v8a) 47 | ABIS_TO_BUILD+=("$abi") 48 | ;; 49 | arm) 50 | ABIS_TO_BUILD+=("armeabi-v7a") 51 | ;; 52 | arm64) 53 | ABIS_TO_BUILD+=("arm64-v8a") 54 | ;; 55 | *) 56 | echo "Unknown ABI: $abi" 57 | ;; 58 | esac 59 | done 60 | ;; 61 | # Use this value as Android platform version during compilation. 62 | --android-api-level=* | -android=*) 63 | API_LEVEL="${argument#*=}" 64 | ;; 65 | # Checkout the particular tag in the FFmpeg's git repository 66 | --source-git-tag=*) 67 | SOURCE_TYPE=GIT_TAG 68 | SOURCE_VALUE="${argument#*=}" 69 | ;; 70 | # Checkout the particular branch in the FFmpeg's git repository 71 | --source-git-branch=*) 72 | SOURCE_TYPE=GIT_BRANCH 73 | SOURCE_VALUE="${argument#*=}" 74 | ;; 75 | # Download the particular tar archive by its version 76 | --source-tar=*) 77 | SOURCE_TYPE=TAR 78 | SOURCE_VALUE="${argument#*=}" 79 | ;; 80 | # Arguments below enable certain external libraries to build into FFmpeg 81 | --enable-libaom | -aom) 82 | EXTERNAL_LIBRARIES+=("libaom") 83 | ;; 84 | --enable-libdav1d | -dav1d) 85 | EXTERNAL_LIBRARIES+=("libdav1d") 86 | ;; 87 | --enable-libmp3lame | -mp3lame | -lame) 88 | EXTERNAL_LIBRARIES+=("libmp3lame") 89 | ;; 90 | --enable-libopus | -opus) 91 | EXTERNAL_LIBRARIES+=("libopus") 92 | ;; 93 | --enable-libwebp | -webp) 94 | EXTERNAL_LIBRARIES+=("libwebp") 95 | ;; 96 | --enable-libtwolame | -twolame) 97 | EXTERNAL_LIBRARIES+=("libtwolame") 98 | ;; 99 | --enable-libspeex | -speex) 100 | EXTERNAL_LIBRARIES+=("libspeex") 101 | ;; 102 | --enable-libvpx | -vpx) 103 | EXTERNAL_LIBRARIES+=("libvpx") 104 | ;; 105 | --enable-libfreetype | -freetype) 106 | EXTERNAL_LIBRARIES+=("libfreetype") 107 | ;; 108 | --enable-libfribidi | -fribidi) 109 | EXTERNAL_LIBRARIES+=("libfribidi") 110 | ;; 111 | --enable-libx264 | -x264) 112 | EXTERNAL_LIBRARIES+=("libx264") 113 | FFMPEG_GPL_ENABLED=true 114 | ;; 115 | --enable-libx265 | -x265) 116 | EXTERNAL_LIBRARIES+=("libx265") 117 | FFMPEG_GPL_ENABLED=true 118 | ;; 119 | --enable-mbedtls | -mbedtls) 120 | EXTERNAL_LIBRARIES+=("mbedtls") 121 | ;; 122 | --enable-libbluray | -bluray) 123 | EXTERNAL_LIBRARIES+=("libbluray") 124 | ;; 125 | --enable-libxml2 | -xml2) 126 | EXTERNAL_LIBRARIES+=("libxml2") 127 | ;; 128 | --enable-all-free | -all-free) 129 | EXTERNAL_LIBRARIES+=" ${SUPPORTED_LIBRARIES_FREE[@]}" 130 | ;; 131 | --enable-all-gpl | -all-gpl) 132 | EXTERNAL_LIBRARIES+=" ${SUPPORTED_LIBRARIES_GPL[@]}" 133 | FFMPEG_GPL_ENABLED=true 134 | ;; 135 | *) 136 | echo "Unknown argument $argument" 137 | ;; 138 | esac 139 | shift 140 | done 141 | 142 | # if ABIS_TO_BUILD list is empty, then fill it with all supported ABIs 143 | # The x86 is the first, because it is more likely to have Text Relocations. 144 | # In this case the rest ABIs will not be assembled at all. 145 | if [ ${#ABIS_TO_BUILD[@]} -eq 0 ]; then 146 | ABIS_TO_BUILD=("x86" "x86_64" "armeabi-v7a" "arm64-v8a") 147 | fi 148 | # The FFmpeg will be build for ABIs in this list 149 | export FFMPEG_ABIS_TO_BUILD=${ABIS_TO_BUILD[@]} 150 | 151 | # Saving the information FFmpeg's source code downloading 152 | export FFMPEG_SOURCE_TYPE=$SOURCE_TYPE 153 | export FFMPEG_SOURCE_VALUE=$SOURCE_VALUE 154 | 155 | # A list of external libraries to build into the FFmpeg 156 | # Elements from this list are used for strings substitution 157 | export FFMPEG_EXTERNAL_LIBRARIES=${EXTERNAL_LIBRARIES[@]} 158 | 159 | # Desired Android API level to use during compilation 160 | # Will be replaced with 21 for 64bit ABIs if the value is less than 21 161 | export DESIRED_ANDROID_API_LEVEL=${API_LEVEL} 162 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ffmpeg-android-maker 2 | 3 | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/6b9a9fe4c6874e65a5e2a3f9beb15605)](https://app.codacy.com/manual/Javernaut/ffmpeg-android-maker) 4 | [![Compilability check](https://github.com/Javernaut/ffmpeg-android-maker/actions/workflows/compilability_check.yml/badge.svg?branch=master)](https://github.com/Javernaut/ffmpeg-android-maker/actions/workflows/compilability_check.yml) 5 | [![Android Weekly #378](https://androidweekly.net/issues/issue-378/badge)](https://androidweekly.net/issues/issue-378) 6 | [![Android Weekly #396](https://androidweekly.net/issues/issue-396/badge)](https://androidweekly.net/issues/issue-396) 7 | 8 | 9 | 10 | Here is a script that downloads the source code of [FFmpeg](https://www.ffmpeg.org) library and assembles it for Android. The script produces shared libraries (\*.so files) as well as header files (\*.h files). The output structure is represented in the image. 11 | 12 | The script also produces `ffmpeg` and `ffprobe` executables that can be used in Android's terminal directly or can even be embedded into an Android app. They can be found in `build` directory after the successful build. 13 | 14 | The main focus of ffmpeg-android-maker is to prepare shared libraries for seamless integration into an Android project. The script prepares the `output` directory that is meant to be used. And it's not the only thing this project does. 15 | 16 | By default this script downloads and builds the FFmpeg **7.1.2**, but the version can be overridden. 17 | 18 | The details of how this script is implemented are described in this series of posts: 19 | * [Part 1](https://proandroiddev.com/a-story-about-ffmpeg-in-android-part-i-compilation-898e4a249422) 20 | * [Part 2](https://proandroiddev.com/a-story-about-ffmpeg-in-android-part-ii-integration-55fb217251f0) 21 | * [Part 3](https://proandroiddev.com/a-story-about-ffmpeg-on-android-part-iii-extension-71025444896e) 22 | 23 | The [WIKI](https://github.com/Javernaut/ffmpeg-android-maker/wiki) contains a lot of useful information. 24 | 25 | ## Customization 26 | 27 | The actual content of `output` directory depends on how the FFmpeg was configured before assembling. The [master](https://github.com/Javernaut/ffmpeg-android-maker) branch of ffmpeg-android-maker builds 'vanilla' version of FFmpeg. This means all default components and shared libraries are built (according to the image). 28 | 29 | The [media-file](https://github.com/Javernaut/ffmpeg-android-maker/tree/media-file) branch contains certain customizations in build scripts of FFmpeg and certain external libraries. These customizations are meant to be an example of how this project can be tuned to obtain the only functionality that is actually needed. What is actually customized can be seen [here](https://github.com/Javernaut/ffmpeg-android-maker/commit/734a4e98c41576b8b9fcf032e0754315b5b77a82). 30 | 31 | The [MediaFile](https://github.com/Javernaut/MediaFile) Android library uses only a subset of FFmpeg's functionality, so the redundant parts are not even compiled. This gives much smaller output binaries. 32 | 33 | Also there are a lot of arguments that you can pass to the `ffmpeg-android-maker.sh` script for tuning certain features. Check this [WIKI page](https://github.com/Javernaut/ffmpeg-android-maker/wiki/Available-script-arguments) out for more info. 34 | 35 | ## Supported Android ABIs 36 | 37 | * armeabi-v7a (with NEON) 38 | * arm64-v8a 39 | * x86 40 | * x86_64 41 | 42 | If you need to build only some of these ABIs, you can do so by specifying a [flag](https://github.com/Javernaut/ffmpeg-android-maker/wiki/Available-script-arguments#desired-abis-to-build). 43 | 44 | The default Android API version used to compile these binaries is **19**, as the minimum supported by the Android NDK r24. However, with NDK r23 it is still possible to have it **16**. Some external libraries (like libvpx) require to use higher API - **21**. This is explained at this [WIKI page](https://github.com/Javernaut/ffmpeg-android-maker/wiki/Available-script-arguments#android-platform-version) in more details. 45 | 46 | ## Supported host OS 47 | 48 | Regardless of the OS you use, you need to setup it before executing the script. Please follow the instructions in [Requirements](#Requirements) section. 49 | 50 | On **macOS** and **Linux** the script is supported natively. Just execute it script in the terminal. 51 | 52 | On **Windows 10** you can use [WSL](https://docs.microsoft.com/en-us/windows/wsl/about) technology to install [Ubuntu 20.04 LTS](https://www.microsoft.com/en-us/p/ubuntu-2004-lts/9n6svws3rx71?activetab=pivot:overviewtab) app. Then follow the Linux way of executing the script. Note that you will need to manually install exactly Linux versions of Android SDK and NDK into your Linux subsystem. The [Dockerfile](https://github.com/Javernaut/ffmpeg-android-maker/blob/master/tools/docker/Dockerfile) may help to understand how to do the setup. 53 | 54 | Also on **any OS** you can use [Docker](https://www.docker.com) tool to execute the script. 55 | Check [this WIKI page](https://github.com/Javernaut/ffmpeg-android-maker/wiki/Docker-support) out to understand benefits of this approach. 56 | 57 | ## Requirements 58 | 59 | The script assumes you have Android SDK and NDK already installed. In order to tell the script their locations you have to define 2 environment variables: 60 | * `ANDROID_SDK_HOME` - absolute path to your Android SDK 61 | * `ANDROID_NDK_HOME` - absolute path to your Android NDK 62 | 63 | The script expects to use **at least** Android NDK **r23**. It doesn't matter if you use other version of NDK for you actual Android project. 64 | 65 | Certain external libraries require additional software to be installed. Check this [WIKI page](https://github.com/Javernaut/ffmpeg-android-maker/wiki/Supported-external-libraries) out for more info. Note that if you don't need these external libraries then you also don't need to install the additional software. These external libraries are not built by default. 66 | 67 | ## Features 68 | 69 | **Add an arbitrary external library that FFMpeg supports to the building process**. Just specify how the source code needs to be downloaded and how to perform the build operation. More about this is [here](https://github.com/Javernaut/ffmpeg-android-maker/wiki/External-libraries-integration). 70 | 71 | **Setting your own FFmpeg version and origin**. You can actually override the version of FFmpeg used by the script. See details [here](https://github.com/Javernaut/ffmpeg-android-maker/wiki/Setting-the-FFmpeg-version). 72 | 73 | **Test your script in a cloud**. This repository has CI integration and you can use it too for your own configurations. See details [here](https://github.com/Javernaut/ffmpeg-android-maker/wiki/Build-automation). 74 | 75 | **Text relocations monitoring**. After an assembling is finished you can look into stats/text-relocations.txt file. This file lists all \*.so files that were built and reports if any of them has text relocations. If you don't see any mentioning of 'TEXTREL' in the file, you are good. Otherwise, you will see exact binaries that have this problem. The Github Actions' Compilability check build will automatically fail if text relocations occur. 76 | 77 | ## License 78 | 79 | The ffmpeg-android-maker's source code is available under the MIT license. See the `LICENSE.txt` file for more details. 80 | 81 | However, the binaries that are produced have different license. The FFmpeg itself is under [LGPL 2.1](http://ffmpeg.org/legal.html). Enabling certain external libraries (like libx264) changes the license to be GPL 2 or later. 82 | --------------------------------------------------------------------------------