我看过很多关于 FFmpeg 以及在 Android 中使用 FFmpeg 的帖子,但我发现这些帖子大多数都是针对旧版本的 FFmpeg 或 Android NDK。我能够得到结果https://github.com/mconf/android-ffmpeg https://github.com/mconf/android-ffmpeg,其中包括文件:“libavcodec.so”、“libavformat.so”、“libavutil.so”、“libswscale.so”。然而,仅仅将这些文件添加到我的项目中似乎不足以使用 FFmpeg。 (我跟着https://stackoverflow.com/a/21773572/1877798 https://stackoverflow.com/a/21773572/1877798作为参考指南)。可能是我在项目中配置这些文件时做错了,或者是我在为 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/ 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
这是日志:
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
[email protected] /cdn-cgi/l/email-protection 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.
试试这个,这是我迄今为止用过的最好的一个:https://github.com/bbcallen/ijkplayer https://github.com/bbcallen/ijkplayer
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)