Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Building ffmpeg executable on Android

Taner Şener edited this page Jul 2, 2020 · 10 revisions

Current versions of the build scripts do not create ffmpeg and ffprobe binaries. But it is possible to generate them by applying the changes listed under one of the following two options. Please note that ffplay can not be built.

1. Generating dynamically linked ffmpeg executable

Both ffmpeg executable and dynamic/shared ffmpeg libraries will be built. ffmpeg will depend on dynamic/shared libraries created under the lib directory.

In build/android-ffmpeg.sh

  • Change --disable-programs line to --disable-ffplay

2. Generating statically linked ffmpeg executable

Only ffmpeg executable will be built. ffmpeg will not depend any other library unless one of the openh264, rubberband, snappy, tesseract or x265 libraries is enabled. If at least one of them is enabled, then ffmpeg executable will depend on libc++_shared.so.

In build/android-ffmpeg.sh

  • Change --disable-programs line to --disable-ffplay

  • Change --disable-static line to --enable-static

  • Change --enable-shared line to --disable-shared

After applying the changes listed for one of the methods above, android.sh will create ffmpeg and ffprobe binaries under the prebuilt/android-<arch>/ffmpeg/bin path. If the first option is used, dynamic/shared libraries will also be created under the prebuilt/android-<arch>/ffmpeg/lib directory.

Furthermore, android.sh will fail while building mobile-ffmpeg using the second option. But ignore this error, mobile-ffmpeg can't use ffmpeg and ffprobe, that's why the build fails.

Building arm-v7a-neon platform on API level 24

ffmpeg: ok

Building arm64-v8a platform on API level 24

ffmpeg: ok

Building x86 platform on API level 24

ffmpeg: ok

Building x86-64 platform on API level 24

ffmpeg: ok

mobile-ffmpeg: failed

Note that openh264, rubberband, snappy, tesseract and x265 libraries need to be linked with a c++ library and scripts are configured to use libc++_shared.so. So, if you enable them, you need to add libc++_shared.so into your application as well.

libc++_shared.so can be found under the ${ANDROID_NDK_ROOT}/sources/cxx-stl/llvm-libc++/libs/<arch> folder.

Clone this wiki locally