构建ffmpeg for android

时间:2015-12-18 12:27:36

标签: android ffmpeg android-ndk ndk-build

我已经为buildinf ffmpeg.so文件提供了很多教程,比如

http://enoent.fr/blog/2014/06/20/compile-ffmpeg-for-android/

http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/

以及更多教程,但最后我每次都不知道如何解决这个错误,请任何人知道如何解决它然后帮助我

我的build.sh文件看起来像这样

  NDK=C:/Users/Benzatine/Downloads/android-ndk-r10e
  SYSROOT=$NDK/platforms/android-19/arch-arm/
  TOOLCHAIN=$NDK/toolchains//arm-linux-androideabi-4.8/prebuilt/windows-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
make install
}
CPU=arm
PREFIX=$(pwd)/android/$CPU 
ADDI_CFLAGS="-marm"
build_one

但是当它执行make命令时会出现以下错误

 LD      libswscale/libswscale-3.so
    c:/users/benzatine/downloads/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error:     libavutil/libavutil.so:1:1: syntax error, unexpected '!', expecting $end
c:/users/benzatine/downloads/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: libavutil/libavutil.so: not an object or archive
collect2.exe: error: ld returned 1 exit status
library.mak:111: recipe for target 'libswscale/libswscale-3.so' failed
make: *** [libswscale/libswscale-3.so] Error 1

每次我尝试构建ffmpeg这个错误都会出现如何解决它请有人帮助我

1 个答案:

答案 0 :(得分:0)

我将假设您正在基于错误消息在Windows系统上构建它。

我刚在Facebook上找到了这个帖子,所以我不会对它有所帮助。通常他只是使用其他项目并进行调整以使其有效运作。它使用Android' Love'版本并在Windows系统中编译它。

  

FFMpeg(https://www.ffmpeg.org),用于多媒体相关任务的C编程语言中最常用的库之一。   它有很多功能可以为您的应用程序添加多媒体支持,但问题是“C'我们有图书馆   如果您不想用C / C ++创建应用程序,请将其移植到其他语言中。相信我把它移植到   不同的语言是很多充满错误的工作。幸运的是,你可以找到教程和轻松构建   在互联网上的脚本,但不可能,它们只是假设你正在移植它   进入基于nix的操作系统和在Windows操作系统上移植它的一些教程不起作用(至少对我来说。:))   但我使用ffmpeg的主要原因是为android添加了一个多媒体功能   由标准Android API提供。我在互联网上找到了一些预制的android项目   使用FFMpeg' Love'版。这是项目。

In case you are wondering how to use it in your Android project , here are the step

1) Add a native support to the Android Project by right-clicking the Android Tools>Add Native Support...
2) Copy 'armeabi' folder to 'libs' folder of your project
3) Replace 'obj' folder with the 'obj' of ffmpeg project in the attached file
4) Add 'ffmpeg' folder to the 'jni' folder
5) Replace 'Androd.mk' folder  with the 'Android.mk' of the ffmpeg project in the attached file
6) Write your code in C/C++ and enjoy

As always if you have any trouble or question you can comment them and I will answer them as soon as possible

附件:http://robot-mitya.googlecode.com/files/MyFfmpegTest.zip

来源:http://dmitrydzz-hobby.blogspot.com/2012/04/how-to-build-ffmpeg-and-use-it-in.html