Android ffmpeg支持x264的编译脚本

1.编译x264:
下载最新版的x264
ftp://ftp.videolan.org/pub/videolan/x264/snapshots/
1.解压到指定的目录
2.切换当前目录为该目录
3.创建一个shell脚本build_x264.sh,内容如下:
#!/bin/bash
export NDK=/home/android/android-ndk-r14b
export SYSROOT= N D K / p l a t f o r m s / a n d r o i d − 21 / a r c h − a r m / e x p o r t T O O L C H A I N = NDK/platforms/android-21/arch-arm/ export TOOLCHAIN= NDK/platforms/android21/archarm/exportTOOLCHAIN=NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
function build_one
{
./configure
–prefix=KaTeX parse error: Expected 'EOF', got '\ ' at position 8: PREFIX \̲ ̲--enable-static…TOOLCHAIN/bin/arm-linux-androideabi-
–sysroot=$SYSROOT
–extra-cflags="-Os -fpic KaTeX parse error: Expected 'EOF', got '\ ' at position 14: ADDI_CFLAGS" \̲ ̲--extra-ldflags…ADDI_LDFLAGS"
KaTeX parse error: Expected 'EOF', got '}' at position 27: …CONFIGURE_FLAG }̲ CPU=arm PREFIX…(pwd)/android/$CPU
ADDI_CFLAGS=""
build_one

2.编译ffmpeg:
下载最新版的ffmpeg
http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
1.解压到指定的目录
2.切换当前目录为该目录
3.创建一个shell脚本build_android.sh,内容如下:
#!/bin/bash
export NDK_HOME=/home/android/android-ndk-r14b
function build
{
echo “start build ffmpeg for KaTeX parse error: Expected 'EOF', got '\ ' at position 37: …arget-os=linux \̲ ̲ --prefix=PREFIX --arch=KaTeX parse error: Expected 'EOF', got '\ ' at position 5: CPU \̲ ̲ --disable-doc …CROSS_COMPILE
–enable-cross-compile
–sysroot=$SYSROOT
–enable-small
–enable-protocols
–enable-libx264
–extra-cflags=”-I/home/android/libx264/include"
–extra-ldflags="-L/home/android/libx264/lib"
–extra-cflags="-Os -fpic KaTeX parse error: Expected 'EOF', got '\ ' at position 14: ADDI_CFLAGS" \̲ ̲ --extra-ldflag…ADDI_LDFLAGS"
$ADDITIONAL_CONFIGURE_FLAG
make clean
make
make install
echo “build ffmpeg for $CPU finished”
}

#arm
PLATFORM_VERSION=android-14
ARCH=arm
CPU=armeabi
PREFIX= ( p w d ) / a n d r o i d a l l / (pwd)/android_all/ (pwd)/androidall/CPU
TOOLCHAIN= N D K H O M E / t o o l c h a i n s / a r m − l i n u x − a n d r o i d e a b i − 4.9 / p r e b u i l t / l i n u x − x 8 6 6 4 C R O S S C O M P I L E = NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 CROSS_COMPILE= NDKHOME/toolchains/armlinuxandroideabi4.9/prebuilt/linuxx8664CROSSCOMPILE=TOOLCHAIN/bin/arm-linux-androideabi-
ADDI_CFLAGS="-marm -mthumb"
ADDI_LDFLAGS=""
SYSROOT= N D K H O M E / p l a t f o r m s / NDK_HOME/platforms/ NDKHOME/platforms/PLATFORM_VERSION/arch-$ARCH/
build

#arm-v7a
PLATFORM_VERSION=android-14
ARCH=arm
CPU=armeabi-v7a
PREFIX= ( p w d ) / a n d r o i d a l l / (pwd)/android_all/ (pwd)/androidall/CPU
TOOLCHAIN= N D K H O M E / t o o l c h a i n s / a r m − l i n u x − a n d r o i d e a b i − 4.9 / p r e b u i l t / l i n u x − x 8 6 6 4 C R O S S C O M P I L E = NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 CROSS_COMPILE= NDKHOME/toolchains/armlinuxandroideabi4.9/prebuilt/linuxx8664CROSSCOMPILE=TOOLCHAIN/bin/arm-linux-androideabi-
ADDI_CFLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -mfpu=neon"
ADDI_LDFLAGS="-march=armv7-a -Wl,–fix-cortex-a8"
SYSROOT= N D K H O M E / p l a t f o r m s / NDK_HOME/platforms/ NDKHOME/platforms/PLATFORM_VERSION/arch-$ARCH/
build

#x86
PLATFORM_VERSION=android-14
ARCH=x86
CPU=x86
PREFIX= ( p w d ) / a n d r o i d a l l / (pwd)/android_all/ (pwd)/androidall/CPU
TOOLCHAIN= N D K H O M E / t o o l c h a i n s / x 86 − 4.9 / p r e b u i l t / l i n u x − x 8 6 6 4 C R O S S C O M P I L E = NDK_HOME/toolchains/x86-4.9/prebuilt/linux-x86_64 CROSS_COMPILE= NDKHOME/toolchains/x864.9/prebuilt/linuxx8664CROSSCOMPILE=TOOLCHAIN/bin/i686-linux-android-
ADDI_CFLAGS="-march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32"
ADDI_LDFLAGS=""
SYSROOT= N D K H O M E / p l a t f o r m s / NDK_HOME/platforms/ NDKHOME/platforms/PLATFORM_VERSION/arch-$ARCH/
build

#x86_64
PLATFORM_VERSION=android-14
ARCH=x86_64
CPU=x86_64
PREFIX= ( p w d ) / a n d r o i d a l l / (pwd)/android_all/ (pwd)/androidall/CPU
TOOLCHAIN= N D K H O M E / t o o l c h a i n s / x 8 6 6 4 − 4.9 / p r e b u i l t / l i n u x − x 8 6 6 4 C R O S S C O M P I L E = NDK_HOME/toolchains/x86_64-4.9/prebuilt/linux-x86_64 CROSS_COMPILE= NDKHOME/toolchains/x86644.9/prebuilt/linuxx8664CROSSCOMPILE=TOOLCHAIN/bin/x86_64-linux-android-
ADDI_CFLAGS="-march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel"
ADDI_LDFLAGS=""
SYSROOT= N D K H O M E / p l a t f o r m s / NDK_HOME/platforms/ NDKHOME/platforms/PLATFORM_VERSION/arch-$ARCH/
build

你可能感兴趣的:(ffmpeg)