I made reference to others compile tutorial
configure
Modify the content:
SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
LIB_INSTALL_EXTRA_CMD='$$(RANLIB)"$(LIBDIR)/$(LIBNAME)"'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR)$(SLIBNAME)'
Replace:
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
LIB_INSTALL_EXTRA_CMD='$$(RANLIB)"$(LIBDIR)/$(LIBNAME)"'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
SLIB_INSTALL_LINKS='$(SLIBNAME)'
build result:
libavdevice-55.so …
build_android.sh
NDK=/home/dennis/android-ndk-r9d
SYSROOT=$NDK/platforms/android-9/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64
enter code here
function build_one
{
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-static \
--disable-doc \
--disable-ffserver \
--enable-cross-compile \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--target-os=linux \
--arch=arm \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
$ADDITIONAL_CONFIGURE_FLAG
}
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"
build_one
I want to remove the version number
result:
libavdevice.so …
No need to change config.mak
Just change
--target-os=linux
with
--target-os=android
My example:
NDK=${HOME}/android-sdk-linux/ndk-bundle
ABI=arm
./configure \
--arch=$ABI \
--target-os=android \
--disable-everything \
--disable-symver \
--enable-runtime-cpudetect \
--enable-pic \
--enable-shared \
--disable-static \
--prefix=../build/$ABI \
--cross-prefix=$NDK/toolchains/$ABI-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/$ABI-linux-androideabi- \
--sysroot=$NDK/platforms/android-26/arch-$ABI \
--extra-cflags="-march=armv7-a -mfloat-abi=softfp -fPIC -DANDROID" \
--extra-ldflags="" \
|| exit 1
make clean
make -j4 || exit 1
make install || exit 1
in ./configure:
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
in ./library.mak: change line
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
with
$(SUBDIR)$(SLIBNAME).qqq: $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
Related
Now, I have got libffmpeg.so on Android, but its size is only 4.96 kB, so obviously something went wrong, but I have no idea...
Here is my config.sh:
#!/bin/bash
export TMPDIR="C:/temp"
export NDKROOT="G:/android-ndk-r9b"
PREBUILT=$NDKROOT/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64
PLATFORM=$NDKROOT/platforms/android-18/arch-arm
./configure --target-os=linux \
--arch=arm \
--enable-version3 \
--enable-gpl \
--enable-nonfree \
--disable-stripping \
--disable-ffserver \
--enable-decoder=h264 \
--disable-ffprobe \
--disable-encoders \
--disable-muxers \
--disable-devices \
--disable-protocols \
--enable-protocol=file \
--enable-avfilter \
--disable-network \
--disable-avdevice \
--enable-cross-compile \
--cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
--nm=$PREBUILT/bin/arm-linux-androideabi-nm \
--extra-cflags="-fPIC -DANDROID" \
--disable-asm \
--enable-neon \
--enable-armv5te \
--extra-ldflags="-Wl,-T,$PREBUILT/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=$PLATFORM/usr/lib
-L$PLATFORM/usr/lib -nostdlib $PREBUILT/lib/gcc/arm-linux-androideabi/4.6/crtbegin.o
$PREBUILT/lib/gcc/arm-linux-androideabi/4.6/crtend.o -lc -lm -ldl"
What could the problem be?
What I also don't understand: we already have a makefile - why should we make android.mk once again?
I have tried to compile the last version of ffmpeg with the android ndk r8b, but i always have errors and i dont know how to solve them. I am reading this tutorial http://www.roman10.net/how-to-build-ffmpeg-for-android/ but the script doesnt work with my environment, i am using this:
-Ubuntu 12.04 LTS.
-Intel Core i7.
-Android ndk r8b
-Last version ffmeg (1.0)
Basically i want to encode films from one format to other.
And that is the script that i am using:
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
And that is the terminal result
jllarraz#ubuntu:~/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
ffmpeg-user#ffmpeg.org 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
After many hour of work i have find one way to compile it:
1) give permissions "chmod 777 ./* -R" in the folder that contains android-ndk and ffmpeg in my case (Be sure to use './' and not '/'!)
2) install things that i need in my environment.
3) this is my new .sh file
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
I am using ffmpeg library in one of my app.While compiling it,i am getting following error:
$ ./build_android.sh
./build_android.sh: line 113: syntax error near unexpected token `$'\r''
'/build_android.sh: line 113: `function build_one
This is the script i am using for it:
#!/bin/bash
######################################################
# Usage:
# put this script in top of FFmpeg source tree
# ./build_android
# It generates binary for following architectures:
# ARMv6
# ARMv6+VFP
# ARMv7+VFPv3-d16 (Tegra2)
# ARMv7+Neon (Cortex-A8)
# Customizing:
# 1. Feel free to change ./configure parameters for more features
# 2. To adapt other ARM variants
# set $CPU and $OPTIMIZE_CFLAGS
# call build_one
######################################################
NDK=~/C:/android-ndk-r8b
PLATFORM=$NDK/platforms/android-15/arch-arm/
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86
function build_one
{
./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 \
--disable-network \
--enable-zlib \
--disable-avfilter \
--disable-avdevice \
$ADDITIONAL_CONFIGURE_FLAG
}
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 v6
#CPU=armv6
#OPTIMIZE_CFLAGS="-marm -march=$CPU"
#PREFIX=./android/$CPU
#ADDITIONAL_CONFIGURE_FLAG=
#build_one
#arm v7vfpv3
CPU=armv7-a
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU "
PREFIX=./android/$CPU
ADDITIONAL_CONFIGURE_FLAG=
build_one
#arm v7vfp
#CPU=armv7-a
#OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfp -marm -march=$CPU "
#PREFIX=./android/$CPU-vfp
#ADDITIONAL_CONFIGURE_FLAG=
#build_one
#arm v7n
#CPU=armv7-a
#OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -march=$CPU -mtune=cortex-a8"
#PREFIX=./android/$CPU
#ADDITIONAL_CONFIGURE_FLAG=--enable-neon
#build_one
#arm v6+vfp
#CPU=armv6
#OPTIMIZE_CFLAGS="-DCMP_HAVE_VFP -mfloat-abi=softfp -mfpu=vfp -marm -march=$CPU"
#PREFIX=./android/${CPU}_vfp
#ADDITIONAL_CONFIGURE_FLAG=
#build_one
Please tell me what is the problem with it? I have tried many solutions but nothing is working.
Do you simply have a unix / dos file (lr/lf) issue? Maybe a dos2unix on the file will help?
I have a bunch of jpeg images representing a video.
I need to encode the images in H264 format so I can stream it to a server (from android device).
I understand this can be done using ffmpeg library. I compiled ffmpeg to a .so file and now I'm trying to find out what methods to use and how...
Anyone know how can I convert jpeg into H264 stream on Android using ffmpeg?
Any sample code will be appreciated :)
Thanks!
PB
https://github.com/jhotovy/android-ffmpeg
ProjectTest in this project has android code that creates mp4 from collection of jpg's (video) and an mp3 (audio)
This project is forked from another project on git ..
you can build it on linux following the instructions
I use the modified script to compile ffmpeg with android NDK r8 and ffmpeg 0.1.11.
#!/bin/bash
######################################################
# FFmpeg builds script for Android+ARM platform
#
# This script is released under term of
# CDDL (http://www.opensource.org/licenses/cddl1)
# Wrote by pinxue (~#gmail.com) from RockPlayer.com
# 2010-8 ~ 2011-4
# Modified by Jacx Wang jacxwang(#)gmail.com 2012-07
######################################################
NDK=/Users/jacxwang/app/android-ndk-r8
PLATFORM=/Users/jacxwang/app/android-ndk-r8/platforms/android-8/arch-arm
PREBUILT=/Users/jacxwang/app/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86
function build_one
{
./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" \
--enable-parsers \
--enable-encoders \
--enable-decoders \
--enable-muxers \
--enable-demuxers \
--enable-swscale \
--disable-ffplay \
--enable-ffprobe \
--enable-ffserver \
--enable-network \
--enable-indevs \
--disable-bsfs \
--disable-filters \
--enable-protocols \
--enable-asm \
--enable-gpl \
$ADDITIONAL_CONFIGURE_FLAG
#make clean
make -j3 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 v6
CPU=armv6
OPTIMIZE_CFLAGS="-marm -march=$CPU"
PREFIX=./android/$CPU
ADDITIONAL_CONFIGURE_FLAG=
#build_one
#arm v7vfpv3
CPU=armv7-a
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU "
PREFIX=./android/$CPU
ADDITIONAL_CONFIGURE_FLAG=
build_one
#arm v7vfp
CPU=armv7-a
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfp -marm -march=$CPU "
PREFIX=./android/$CPU-vfp
ADDITIONAL_CONFIGURE_FLAG=
build_one
#arm v6+vfp
CPU=armv6
OPTIMIZE_CFLAGS="-DCMP_HAVE_VFP -mfloat-abi=softfp -mfpu=vfp -marm -march=$CPU"
PREFIX=./android/${CPU}-vfp
ADDITIONAL_CONFIGURE_FLAG=
build_one
I am decoding an h.264 video file on android using ffmpeg. The performace is very low. I would like to enable neon optimzation in ffmpeg to improve the performace. Inspite of adding the neon related commands in the config file, I don't see performance gain. Can someone tell me if I am going wrong anywhere? My config file is as given below.
function build_one_r6
{
make clean
./configure \
--prefix=$PREFIX \
--disable-shared \
--enable-static \
--enable-version3 \
--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 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing $OPTIMIZE_CFLAGS" \
--extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
--arch=arm \
--disable-symver \
--disable-debug \
--disable-indevs \
--disable-encoders \
--disable-bsfs \
--disable-filters \
$ADDITIONAL_CONFIGURE_FLAG || exit 1;
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 -j4 install || exit 1;
$PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o || exit 1;
$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/lib/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 || exit 1;
}
#armv5te
CPU=armv5te
OPTIMIZE_CFLAGS="-marm -march=$CPU "
PREFIX=../../build/android/armeabi
ADDITIONAL_CONFIGURE_FLAG=
build_one_r6
#arm v7n
CPU=armv7-a
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -march=$CPU -mtune=cortex-a8"
PREFIX=../../build/android/armeabi-v7a
ADDITIONAL_CONFIGURE_FLAG="--enable-neon --disable-armv5te --disable-armv6 --disable-armv6t2"
build_one_r6enter code here
I have compiled ffmpeg-0.10 for android using its script situated here: tools/build_libstagefright.sh. If you dont need libStagefright (as for me its still not working) it`s better to delete start android libs and headers download and android options. It has properly working options for NEON. My summary build options:
configuration:
--target-os=linux \
--cross-prefix=arm-linux-androideabi- \
--arch=arm --cpu=armv7-a \
--sysroot=/home/grid/Android/Android_NDK_r6b/platforms/android-9/arch-arm \
--disable-avdevice \
--enable-decoder=h264 \
--prefix=build/stagefright/armeabi-v7a \
--extra-cflags=' -march=armv7-a -mfloat-abi=softfp -mfpu=neon' \
--extra-ldflags='-Wl, --fix-cortex-a8' \
--extra-cxxflags='-Wno-multichar -fno-exceptions -fno-rtti'