-
-
Notifications
You must be signed in to change notification settings - Fork 896
Building ffmpeg executable on Android
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.
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-programsline to--disable-ffplay
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-programsline to--disable-ffplay -
Change
--disable-staticline to--enable-static -
Change
--enable-sharedline 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.
Copyright (c) 2018-2021 MobileFFmpeg