I've seen some articles about how to compile and uses FFmpeg for Android.
These are 2 good examples - example1 and example2
Unfortunately, non off them, or others I found helped me. In those two examples a build_android.sh is created and configure the FFmpeg's configuraion file and call to make. Every time when I'm running the script I'm getting the following error:
c:\android\development\android-ndk-r9\sources\ffmpeg>sh build_android.sh
c:/android/development/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebu
ilt/windows-x86_64/arm-linux-androideabi/bin/bin/arm-linux-androideabi-gcc is un
able to create an executable file.
C compiler test failed.
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
[email protected] mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solving the problem.
Makefile:2: config.mak: No such file or directory
Makefile:49: /common.mak: No such file or directory
Makefile:92: /libavutil/Makefile: No such file or directory
Makefile:92: /library.mak: No such file or directory
Makefile:169: /doc/Makefile: No such file or directory
Makefile:170: /tests/Makefile: No such file or directory
make: *** No rule to make target `/tests/Makefile'. Stop.
Makefile:2: config.mak: No such file or directory
If someone encountered and solved this issue it'll be much appreciated!
After trying the suggested script I ran into a new problem that I couldn't solved, this is the output of the script:
.... Enabled components list....
In the end of the list I got the following:
Enabled indevs: dv1394 v4l2i fbdev
Enabled outdevs: fbdev v4l2
License: LGPL version 2.1 or later Creating config.mak, config.h, and doc/config.texi...
WARNING: C:/android/development/android-ndk-r9/toolchains/arm-linux-androideabi-
4.8/prebuilt/windows-x86_64/bin/arm-linux-androideabi-pkg-config not found, libr
ary detection may fail.
make: *** No rule to make target libavfilter/libavfilter.so', needed by
all-ye
s'. Stop.
make: *** No rule to make target install-libavfilter-shared', needed by
instal
l-libs-yes'. Stop.
Can you paste what's in your build_android.sh file which you've copied inside the FFmpeg directory?
I've got the same error when one of the variables defined at the start of the script where set incorrectly. Check to see if your NDK or SYSROOT or TOOLCHAIN variables are set to a valid path!
I've tried using the following steps and it worked for me:
1) Download FFmpeg
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
2) Create a file called build_android.sh inside the FFmpeg directory
cd ffmpeg; touch build_ffmpeg_for_android.sh;
3) Add the following content to the file
#!/usr/bin/env bash
NDK=$HOME/Software/Android/android-ndk-r10/
SYSROOT=$NDK/platforms/android-19/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64
function build_one
{
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-static \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-avdevice \
--disable-doc \
--disable-symver \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--target-os=linux \
--arch=arm \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
$ADDITIONAL_CONFIGURE_FLAG
make clean
make -j4
make install
}
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"
build_one
4) Make the script executable
chmod +x build_ffmpeg_for_android.sh
5) Start the build of FFmpeg for Android (ARM)
(run the script with Bash, i.e. /usr/bin/bash not /usr/bin/sh)
./build_ffmpeg_for_android.sh
I was getting the same errors as @powerX and I was able to solve the issue using a different method from @dZkF9RWJT6wN8ux.
Though I am using Ubuntu 13.10, I hope you find my answer helpful. With android NDK r9 and FFMPEG 2.2 "Muybridge" release, I was finally able to accomplish the third step entitled "Build FFMPEG" from @powerX example1 link: http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/
I finally fixed this by changing the SYSROOT variable in the build_android.sh file to point to ".../android-19/arch-arm" instead of .../android-9/arch-arm".
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With