编译x264和FAAC

关于

x264
FAAC

编译x264源码

git clone git://git.videolan.org/x264.git
如果没有git请先安装git
apt-get install git

vim android_build.sh
#!/bin/bash
NDK_ROOT=/ndk_build/android-ndk-r14b
SYSROOT=$NDK_ROOT/platforms/android-9/arch-arm/
TOOLCHAIN=$NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
function build_one
{
 ./configure \
    --prefix=$PREFIX \
    --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
    --sysroot=$SYSROOT \
    --host=arm-linux \
    --enable-pic \
    --enable-static \
    --disable-asm \
    --disable-shared \
    --disable-cli
    make clean
    make
    make install
}
CPU=arm
PREFIX=$(pwd)/android/$CPU  
build_one

然后执行

chmod 777 android_build.sh
./android_build.sh

会得到一个android文件夹,在这个文件夹中即有我们需要的东西。

编译FAAC

wget https://ncu.dl.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz

下载解压

#!/bin/sh

CPU=$1
NDK_ROOT=/ndk_build/android-ndk-r14b
export PLATFORM=$NDK_ROOT/platforms/android-9/arch-arm 
export PREBUILT=$NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin
export PREFIX="$(pwd)/android/arm"
export CROSS_COMPILE=$PREBUILT/arm-linux-androideabi-

export CFLAGS="-DANDROID -fPIC -ffunction-sections -funwind-tables -fstack-protector -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300"

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 --without-mp4v2 --host=arm-linux

make
cp ./libfaac/.libs/*.a $PREFIX/lib
cp ./libfaac/.libs/*.so $PREFIX/lib
cp ./include/*.h $PREFIX/include

执行脚本,NDK_ROOT注意改成自己的。

你可能感兴趣的:(编译x264和FAAC)