x264:

下载最新源码

创建 build_x264.sh


NDK= NDK=/home/eric/android-ndk-r8
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt
PLATFORM=$NDK/platforms/android-8/arch-arm
PREFIX=/home/eric/Desktop/android-ffmpeg
./configure --prefix=$PREFIX \
--enable-static \
--enable-pic \
--disable-asm \
--disable-cli \
--host=arm-linux \
--cross-prefix=$PREBUILT/linux-x86/bin/arm-linux-androideabi- \
--sysroot=$PLATFORM


chmod u+x build_x264.sh

./build_x264.sh

make

make install


ffmpeg:

下载最新源码

创建build_ffmpeg.sh


#!/bin/bash
export NDK=/home/eric/android-ndk-r8
export PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt
export PLATFORM=$NDK/platforms/android-8/arch-arm
export PREFIX=/home/eric/Desktop/android-ffmpeg
function build_one
{
./configure --target-os=linux --prefix=$PREFIX \
--enable-cross-compile \
--enable-runtime-cpudetect \
--disable-asm \
--arch=arm \
--cc=$PREBUILT/linux-x86/bin/arm-linux-androideabi-gcc \
--cross-prefix=$PREBUILT/linux-x86/bin/arm-linux-androideabi- \
--disable-stripping \
--nm=$PREBUILT/linux-x86/bin/arm-linux-androideabi-nm \
--sysroot=$PLATFORM \
--enable-nonfree \
--enable-version3 \
--disable-everything \
--enable-gpl \
--disable-doc \
--enable-avresample \
--enable-demuxer=rtsp \
--enable-muxer=rtsp \
--disable-ffplay \
--disable-ffserver \
--enable-ffmpeg \
--disable-ffprobe \
--enable-libx264 \
--enable-encoder=libx264 \
--enable-decoder=h264 \
--enable-protocol=rtp \
--enable-hwaccels \
--enable-zlib \
--disable-devices \
--disable-avdevice \
--extra-cflags="-I/home/eric/Desktop/android-ffmpeg/include -fPIC -DANDROID -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=armv7-a" \
--extra-ldflags="-L/home/eric/Desktop/android-ffmpeg/lib"
make -j4 install


$PREBUILT/linux-x86/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o
$PREBUILT/linux-x86/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -L$PREFIX/lib  -soname libffmpeg.so -shared -nostdlib  -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavfilter/libavfilter.a libavresample/libavresample.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog -lx264 --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
}
build_one


chmod u+x build_ffmpeg.sh

./build_ffmpeg.sh




Logo

更多推荐