【问题标题】:Errors in building ffmpeg for android为 android 构建 ffmpeg 时出错
【发布时间】:2016-03-25 04:02:14
【问题描述】:

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

【问题讨论】:

  • 请有人帮我解决这个问题,我几乎从上个月开始尝试这个

标签: android ffmpeg android-ndk ndk-build


【解决方案1】:

我将根据错误消息假设您是在 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

【讨论】:

  • 先生,我如何在我的项目@Sun Maung Oo 中使用您的库直接执行 ffmpeg 命令?
  • 你说的ffmpeg命令是什么意思?您是否正在尝试将 ffmpeg 可执行文件构建到 Android 中?
  • 是的,我想直接使用 java 的 processbuilder 运行 ffmpeg 命令
  • 如果是这样的话,我很抱歉。我误读了这个问题。我的回答只告诉如何将其移植到 Android 中,以便您可以使用 JNI 调用 ffmpeg 函数。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-10-27
  • 2018-06-25
  • 2017-06-10
  • 2018-04-03
  • 2016-03-22
  • 2019-09-12
  • 2017-03-02
相关资源
最近更新 更多