Android - 集成ffmpeg和android-ndk-r9c

lgd*_*d57 7 macos video android ffmpeg android-ndk

我已经看过很多关于FFmpeg和在Android中使用FFmpeg的帖子,但我发现这些帖子中的大多数都是针对FFmpeg或Android NDK的旧版本.我能够从https://github.com/mconf/android-ffmpeg获得结果,其中包括以下文件:"libavcodec.so","libavformat.so","libavutil.so","libswscale.so" .但是,仅仅将这些文件添加到我的项目中似乎不足以使用FFmpeg.(我按照/sf/answers/1524150071/作为参考指南).我可能在项目中配置这些文件时做错了,或者我在为Android构建FFmpeg时做错了.(应该有更多文件吗?)

我想知道是否有最近的指南在Android项目中构建或集成FFmpeg.我正在使用FFmpeg(截至2014年2月27日)和Android NDK 9c.如果没有,是否有人对其他图书馆有其他建议?我正在尝试采用一组图像文件并以编程方式创建视频/动画gif.

谢谢!:-)


~~编辑~~

我找到了http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/comment-page-4/以及在GitHub上发现的其他几个人.然而,他们似乎都在努力建造FFmpeg.我使用的是Mac OS X.

这是我的脚本:

#!/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
Run Code Online (Sandbox Code Playgroud)

这是日志:

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.
Run Code Online (Sandbox Code Playgroud)

And*_*rew 0

尝试这个迄今为止我用过的最好的一个:https ://github.com/bbcallen/ijkplayer