编译android下可用的faac,为android编译ffmpeg+x264+faac

#!/bin/bash

export VERSION=4.6

export NDK=/opt/google/android-ndk-r9b

export PREBUILT=$NDK/toolchains/arm-linux-androideabi-$VERSION/prebuilt/linux-x86_64

export PLATFORM=$NDK/platforms/android-9/arch-arm

export FFMPEG_ROOT=../ffmpeg-1.2.4

export X264_ROOT=../x264 #上面的x264的源码目录

export PREFIX=../install

export ELIB="$PREFIX/lib"

export FAAC_ROOT=../faac-1.28

function build_x264

{

cd $X264_ROOT

pwd

./configure --enable-static \

--prefix=$PREFIX \

--enable-shared \

--enable-pic \

--disable-asm \

--disable-cli \

--host=arm-linux \

--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \

--sysroot=$PLATFORM

make

cp libx264.a $ELIB

cd -

}

function build_faac

{

cd $FAAC_ROOT

pwd

CFLAGS="-fpic -DANDROID -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID -Wa,--noexecstack -MMD -MP "

#FLAGS="--host=arm-androideabi-linux --enable-static --disable-shared --prefix=$HOME --enable-armv5e "

CROSS_COMPILE=$PREBUILT/bin/arm-linux-androideabi-

export CPPFLAGS="$CFLAGS"

export CFLAGS="$CFLAGS"

export CXXFLAGS="$CFLAGS"

export CXX="${CROSS_COMPILE}g++ --sysroot=${PLATFORM}"

export LDFLAGS="$LDFLAGS"

export CC="${CROSS_COMPILE}gcc --sysroot=${PLATFORM}"

export NM="${CROSS_COMPILE}nm"

export STRIP="${CROSS_COMPILE}strip"

export RANLIB="${CROSS_COMPILE}ranlib"

export AR="${CROSS_COMPILE}ar"

./configure --program-prefix=$PREFIX \

--host=arm-linux

make

cp ./libfaac/.libs/libfaac.a $ELIB

cd -

}

function build_one

{

$FFMPEG_ROOT/configure --target-os=linux \

--prefix=$PREFIX \

--enable-cross-compile \

--enable-runtime-cpudetect \

--disable-asm \

--arch=arm \

--cc=$PREBUILT/bin/arm-linux-androideabi-gcc \

--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \

--disable-stripping \

--nm=$PREBUILT/bin/arm-linux-androideabi-nm \

--sysroot=$PLATFORM \

--enable-nonfree \

--enable-version3 \

--enable-gpl \

--disable-doc \

--enable-avresample \

--enable-demuxer=rtsp \

--enable-muxer=rtsp \

--disable-ffplay \

--disable-ffserver \

--enable-ffmpeg \

--disable-ffprobe \

--enable-libx264 \

--enable-libfaac --enable-nonfree \

--enable-encoder=libx264 \

--enable-decoder=h264 \

--enable-protocol=rtp \

--enable-encoder=libfaac \

--enable-decoder=aac \

--enable-hwaccels \

--enable-zlib \

--disable-devices \

--disable-avdevice \

--extra-cflags="-I$X264_ROOT -I$FAAC_ROOT/include -fPIC -DANDROID -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=armv7-a" \

--extra-ldflags="-L$ELIB"

make -j4

make install

}

mkdir -p $ELIB

build_faac

build_x264

build_one

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值