行云

行至水穷处,坐看云起时。

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

编译x264:
下载最新版的x264
ftp://ftp.videolan.org/pub/videolan/x264/snapshots/
1.解压到指定的目录
2.切换当前目录为该目录
3.创建一个shell脚本build_x264.sh,内容如下:

export NDK=/home/robin/桌面/android-ndk-r8c
export PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt
export PLATFORM=$NDK/platforms/android-8/arch-arm 
export PREFIX=/home/robin/android-x264
./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

执行如下命令编译和安装
make
sudo make install
sudo ldconfig
编译ffmpeg:
下载最新版的ffmpeg
http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
1.解压到指定的目录
2.切换当前目录为该目录
3.创建一个shell脚本build_ffmpeg.sh,内容如下:

#!/bin/sh
export PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt
export PLATFORM=$NDK/platforms/android-8/arch-arm
export PREFIX=/home/robin/android-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/robin/android-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/robin/android-x264/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

执行build_ffmpeg.sh编译完成,编译输出在$PREFIX指定的目录

原文:http://hi.baidu.com/duizhe_memory/item/482e6fd6ccfee7fa93a974be

posted on 2013-04-01 21:17  windflying  阅读(7756)  评论(0编辑  收藏  举报