ffmpeg编译x264, 这个libffmpeg即可解码又可以h264编码

 
http://blog.csdn.net/u012917616/article/details/40921861
不废话,直接上.sh脚本:

export NDK=/home/xxx/my_software/android-ndk-r10

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

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

export PREFIX=/home/xxx/x264


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/xxx/x264/include -fPIC -DANDROID -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=armv7-a" \

--extra-ldflags="-L/home/xxx/x264/lib"


#make clean

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 /home/xxx/x264/lib/libx264.a -lc -lm -lz -ldl -llog --dynamic-linker=/system/bin/linker $PREBUILT/linux-x86/lib/gcc/arm-linux-androideabi/4.8/libgcc.a

}


build_one

你可能感兴趣的:(ffmpeg)