gpt4 book ai didi

android - 为 android 构建 ffmpeg 时出错

转载 作者:行者123 更新时间:2023-12-04 23:28:07 27 4
gpt4 key购买 nike

我已经关注了很多关于 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), one of the most used libary written in C programming language for multimedia related task. It has a lot of feature to add multimedia support for your application but the trouble being a 'C' library we have port it into other language if you don't want to create your application in C/C++. Trust me porting it into different language is a lot of work which are filled with error. Luckily you can find tutorial and easy build script in the internet but unfountenly , they are only written by assumption that you are porting it into nix based OS and the few tutorial on porting it on Windows OS does not work (atleast for me. :) ) But the main reason I am using ffmpeg is to add a multimedia feature to the android which are not provided by standard Android API. I found some pre-made android project on an internet which use FFMpeg 'Love' version. Here is the project.


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

关于android - 为 android 构建 ffmpeg 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34355711/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com