繁体   English   中英

在为Android构建ffmpeg时出错

[英]Errors in building ffmpeg for android

我关注了很多关于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时都会出现此错误,如何解决它,请有人帮我

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

我只是在Facebook小组上找到了这篇文章,所以我不会为此而功劳。基本上他只是使用其他项目并对其进行了调整以使其能够正常工作。它使用Android的``Love''版本并在Windows系统中进行编译。

FFMpeg( https://www.ffmpeg.org ),这是用C编程语言编写的用于多媒体相关任务的最常用的库之一。 它具有很多功能,可以为您的应用程序添加多媒体支持,但是如果您不想使用C / C ++创建应用程序,那么麻烦是作为“ C”库,我们已经将其移植到其他语言中。 相信我将其移植到其他语言是很多工作,其中充满了错误。 幸运的是,您可以在Internet上找到教程和简单的构建脚本,但不幸的是,它们仅是在您将其移植到基于nix的OS的前提下编写的,而关于在Windows OS上移植它的一些教程不起作用(对我来说是这样。:) )但是我使用ffmpeg的主要原因是要向android添加多媒体功能,而这是标准Android API无法提供的。 我在互联网上找到了一些使用FFMpeg'Love'版本的预制android项目。 这是项目。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM