2012-10-10 78 views
4

我試圖用android ndk r8b編譯ffmpeg的最後一個版本,但我總是有錯誤,我不知道如何解決它們。我正在閱讀本教程http://www.roman10.net/how-to-build-ffmpeg-for-android/,但該腳本不適用於我的環境,我正在使用: -Ubuntu 12.04 LTS。 -Intel Core i7。 -Android ndk r8b 最新版本ffmeg(1.0)FFMPEG 1.0 ANDROID NDK R8B

基本上我想編碼從一種格式的電影到其他。

這是我使用的腳本:

NDK=../android-ndk-r8b 
PLATFORM=$NDK/platforms/android-8/arch-arm/ 
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86 
function build_r8b 
{ 
bash configure \ 
--disable-shared \ 
--enable-static \ 
--enable-gpl \ 
--enable-version3 \ 
--enable-nonfree \ 
--disable-doc \ 
--disable-ffmpeg \ 
--disable-ffplay \ 
--disable-ffprobe \ 
--disable-ffserver \ 
--disable-avdevice \ 
--disable-avfilter \ 
--disable-postproc \ 
--enable-small \ 
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \ 
--enable-cross-compile \ 
--target-os=linux \ 
--extra-cflags="-I$PLATFORM/usr/include" \ 
--extra-ldflags="-L$PLATFORM/usr/lib -nostdlib" \ 
--arch=arm \ 
--disable-symver \ 
--disable-debug \ 
--disable-stripping \ 
$ADDITIONAL_CONFIGURE_FLAG 
sed -i 's/HAVE_LRINT 0/HAVE_LRINT 1/g' config.h 
sed -i 's/HAVE_LRINTF 0/HAVE_LRINTF 1/g' config.h 
sed -i 's/HAVE_ROUND 0/HAVE_ROUND 1/g' config.h 
sed -i 's/HAVE_ROUNDF 0/HAVE_ROUNDF 1/g' config.h 
sed -i 's/HAVE_TRUNC 0/HAVE_TRUNC 1/g' config.h 
sed -i 's/HAVE_TRUNCF 0/HAVE_TRUNCF 1/g' config.h 
make clean 
make -j4 install 
$PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o 
$PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a 
} 
#arm v7vfpv3 
CPU=armv7-a 
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU " 
PREFIX=./android/$CPU 
ADDITIONAL_CONFIGURE_FLAG= 
#build_one 
build_r8b 

這是終端結果

[email protected]:~/Descargas/ffmpeg$ bash build_android.sh 
/android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc is unable to create an executable file. 
C compiler test failed. 

If you think configure made a mistake, make sure you are using the latest 
version from Git. If the latest version fails, report the problem to the 
[email protected] mailing list or IRC#ffmpeg on irc.freenode.net. 
Include the log file "config.log" produced by configure as this will help 
solving the problem. 
make: execvp: ./version.sh: Permiso denegado 
make: execvp: ./version.sh: Permiso denegado 
HOSTCC doc/print_options.o 
CC cmdutils.o 
CC libavdevice/alldevices.o 
CC libavdevice/avdevice.o 
In file included from doc/print_options.c:104:0: 
./libavcodec/options_table.h: En la función ‘show_codec_opts’: 
./libavcodec/options_table.h:85:1: aviso: ‘sub_id’ es obsoleto (declarado en ./libavcodec/avcodec.h:1505) [-Wdeprecated-declarations] 
./libavcodec/options_table.h:149:1: aviso: ‘luma_elim_threshold’ es obsoleto (declarado en ./libavcodec/avcodec.h:1740) [-Wdeprecated-declarations] 
./libavcodec/options_table.h:150:1: aviso: ‘chroma_elim_threshold’ es obsoleto (declarado en ./libavcodec/avcodec.h:1747) [-Wdeprecated-declarations] 
./libavcodec/options_table.h:284:1: aviso: ‘color_table_id’ es obsoleto (declarado en ./libavcodec/avcodec.h:1986) [-Wdeprecated-declarations] 
./libavcodec/options_table.h:307:1: aviso: ‘inter_threshold’ es obsoleto (declarado en ./libavcodec/avcodec.h:2049) [-Wdeprecated-declarations] 
./libavcodec/options_table.h:312:1: aviso: ‘quantizer_noise_shaping’ es obsoleto (declarado en ./libavcodec/avcodec.h:2056) [-Wdeprecated-declarations] 
cmdutils.c:52:21: error fatal: version.h: No existe el archivo o el directorio 
compilación terminada. 
make: *** [cmdutils.o] Error 1 
make: *** Se espera a que terminen otras tareas.... 
build_android.sh: línea 59: ../android-ndk-r8b/toolchains/arm-linux-androideabi- 4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-ar: Permiso denegado 
build_android.sh: línea 60: ../android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-ld: Permiso denegado 

回答

2

的工作,我有找到一個方法來編譯多小時後:

1)在包含android-ndk和ffmpeg的文件夾中給予權限"chmod 777 ./* -R"在我的情況下(Be確定使用'./ '而不是'/'!)
2)安裝我需要的東西在我的環境中。
3)這是我的新.sh文件

function build_r8b_test 
{ 
bash configure --target-os=linux \ 
--prefix=$PREFIX \ 
--enable-cross-compile \ 
--extra-libs="-lgcc" \ 
--arch=arm \ 
--cc=$PREBUILT/bin/arm-linux-androideabi-gcc \ 
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \ 
--nm=$PREBUILT/bin/arm-linux-androideabi-nm \ 
--sysroot=$PLATFORM \ 
--extra-cflags=" -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS " \ 
--disable-shared \ 
--enable-static \ 
--extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \ 
--disable-everything \ 
--enable-demuxer=mov \ 
--enable-demuxer=h264 \ 
--disable-ffplay \ 
--enable-protocol=file \ 
--enable-avformat \ 
--enable-avcodec \ 
--enable-decoder=rawvideo \ 
--enable-decoder=mjpeg \ 
--enable-decoder=h263 \ 
--enable-decoder=mpeg4 \ 
--enable-decoder=h264 \ 
--enable-parser=h264 \ 
--enable-encoder=mpeg4 \ 
--enable-encoder=mpeg \ 
--disable-network \ 
--enable-zlib \ 
--disable-avfilter \ 
--disable-avdevice \ 
$ADDITIONAL_CONFIGURE_FLAG 
sed -i 's/HAVE_LRINT 0/HAVE_LRINT 1/g' config.h 
sed -i 's/HAVE_LRINTF 0/HAVE_LRINTF 1/g' config.h 
sed -i 's/HAVE_ROUND 0/HAVE_ROUND 1/g' config.h 
sed -i 's/HAVE_ROUNDF 0/HAVE_ROUNDF 1/g' config.h 
sed -i 's/HAVE_TRUNC 0/HAVE_TRUNC 1/g' config.h 
sed -i 's/HAVE_TRUNCF 0/HAVE_TRUNCF 1/g' config.h 
make clean 
make -j4 install 
$PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o 
$PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a 
} 

#arm v7vfpv3 
CPU=armv7-a 
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU " 
PREFIX=./android/$CPU 
ADDITIONAL_CONFIGURE_FLAG= 
build_r8b_test