I have seen a lot of posts about FFmpeg and using FFmpeg in Android, but I am finding that a majority of these posts are for older versions of either FFmpeg or Android NDK. I was able to get a result from https://github.com/mconf/android-ffmpeg, which includes the files: "libavcodec.so", "libavformat.so", "libavutil.so", "libswscale.so". However, simply adding these files to my project does not seem to be enough to use FFmpeg. (I followed https://stackoverflow.com/a/21773572/1877798 as a reference guide). It's possible that either I've done something wrong in configuring these files in my project, or I've done something wrong in building FFmpeg for Android. (Should there be more files?)
I was wondering if there are any recent guides for building or integrating FFmpeg in an Android project. I am using FFmpeg (as of 2/27/14) and Android NDK 9c. If not, does anyone have other recommendations for other libraries? I am trying to take a set of image files and create a video/animated gif programatically.
Thanks! :-)
~~ EDIT ~~
I have found http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/comment-page-4/ and a couple others found on GitHub. However, they all seem to struggle in building FFmpeg. I am using Mac OS X
Here is my script:
#!/bin/bash
NDK=/Downloads/android-ndk-r9c
SYSROOT=$NDK/platforms/android-18/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64
# Note: Change the TOOLCHAIN to match that available for your host system.
# darwin-x86_64 is for Mac OS X, but you knew that.
function build_one
{
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-static \
--disable-doc \
--disable-programs \
--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
make install
}
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"
build_one
Here is the log:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include- dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
/Downloads/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc is unable 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
ffmpeg-user@ffmpeg.org 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:48: /common.mak: No such file or directory
Makefile:91: /libavutil/Makefile: No such file or directory
Makefile:91: /library.mak: No such file or directory
Makefile:168: /doc/Makefile: No such file or directory
Makefile:169: /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
Makefile:48: /common.mak: No such file or directory
Makefile:91: /libavutil/Makefile: No such file or directory
Makefile:91: /library.mak: No such file or directory
Makefile:168: /doc/Makefile: No such file or directory
Makefile:169: /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
Makefile:48: /common.mak: No such file or directory
Makefile:91: /libavutil/Makefile: No such file or directory
Makefile:91: /library.mak: No such file or directory
Makefile:168: /doc/Makefile: No such file or directory
Makefile:169: /tests/Makefile: No such file or directory
make: *** No rule to make target `/tests/Makefile'. Stop.
You need to fix your NDK path its not correct. It may be : NDK=/user//Downloads/android-ndk-r9c
And you wanna check in browser as :
file:///user/xyz/Downloads/android-ndk-r9c
if valid then open "android-ndk-r9c" folder. When you success then put it on your NDK path and build.
I am using android ndk r10e with ffmpeg 2.7.1 and yasm 1.2.0 (all in downloads folder) in mac os x
I had that same error.
"Makefile:2: config.mak: No such file or directory Makefile:48: /common.mak: No such file or directory Makefile:91: /libavutil/Makefile: No such file or directory Makefile:91: /library.mak: No such file or directory Makefile:168: /doc/Makefile: No such file or directory Makefile:169: /tests/Makefile: No such file or directory make: *** No rule to make target `/tests/Makefile'. Stop."
Please check your directory paths inside of your script are correct. i.e.:'/Downloads/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/"
I think it actually is "$HOME/Downloads"
Also make sure you are running the script in the ".../android-ndk-r9c/sources/FFMPEG/" directory.
Try this one which is best I have used so far: https://github.com/bbcallen/ijkplayer