簡體   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