1. Download
Ffmpeg-0.11.2.tar.bz2
2. Enterffmpeg-0.11.2/tools
3. Modify build_libstagefright
#!/bin/bashNDK=/opt/android-ndk-r8dif [ "$NDK" = "" ]; then echo NDK variable not set, assuming ${HOME}/android-ndk export NDK=${HOME}/android-ndkfiecho "Fetching Android system headers"git clone --depth=1 --branch gingerbread-release git://github.com/CyanogenMod/android_frameworks_base.git /opt/android-source/frameworks/basegit clone --depth=1 --branch gingerbread-release git://github.com/CyanogenMod/android_frameworks_av.git /opt/android-source/frameworks/avgit clone --depth=1 --branch gingerbread-release git://github.com/CyanogenMod/android_frameworks_native.git /opt/android-source/frameworks/nativegit clone --depth=1 --branch gingerbread-release git://github.com/CyanogenMod/android_hardware_libhardware.git /opt/android-source/hardware/libhardwaregit clone --depth=1 --branch gingerbread-release git://github.com/CyanogenMod/android_system_core.git /opt/android-source/system/coreecho "Fetching Android libraries for linking" Libraries from any froyo/gingerbread device/emulator should work fine, since the symbols used should be available on most of them.if [ ! -d "/opt/android-libs" ]; then if [ ! -f "/opt/update-cm-7.0.3-N1-signed.zip" ]; then wget http://download.cyanogenmod.com/get/update-cm-7.0.3-N1-signed.zip -P../ fi unzip /opt/update-cm-7.0.3-N1-signed.zip system/lib/* -d../ mv /opt/system/lib /opt/android-libs rmdir /opt/systemfiSYSROOT=$NDK/platforms/android-9/arch-arm# Expand the prebuilt/* path into the correct one#TOOLCHAIN=`echo $NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/*-x86`TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86export PATH=$TOOLCHAIN/bin:$PATHANDROID_SOURCE=/opt/android-sourceANDROID_LIBS=/opt/android-libsABI="armeabi-v7a"CC=$TOOLCHAIN/bin/arm-linux-androideabi-gcc NM=$TOOLCHAIN/bin/arm-linux-androideabi-nmrm -rf ../build/stagefrightmkdir -p ../build/stagefrightDEST=../build/stagefrightDEST="$DEST/$ABI"FLAGS="--target-os=linux --cross-prefix=arm-linux-androideabi- --arch=arm --cpu=armv7-a --cc=$CC --nm=$NM"FLAGS="$FLAGS --sysroot=$SYSROOT"FLAGS="$FLAGS --disable-avdevice --disable-encoders --disable-decoder=h264 --disable-decoder=h264_vdpau --enable-libstagefright-h264 --enable-asm --enable-neon"#FLAGS="$FLAGS --disable-shared --enable-static --disable-avdevice --disable-parsers --enable-parser=h264 --disable-filters --disable-decoders --disable-demuxers --disable-network --disable-protocols --disable-swscale --disable-swresample --enable-avformat --enable-avcodec --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-devices --disable-postproc --disable-avfilter --disable-swscale-alpha --disable-bsfs --disable-encoders --disable-muxers --disable-indevs --disable-debug --disable-doc --enable-zlib --enable-pic --disable-optimizations --disable-decoder=h264 --disable-decoder=h264_vdpau --enable-libstagefright-h264 --enable-asm --enable-neon"#EXTRA_CFLAGS="-I$ANDROID_SOURCE/frameworks/base/include -I$ANDROID_SOURCE/system/core/include"#EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/media/libstagefright"#EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/include/media/stagefright/openmax"#EXTRA_CFLAGS="$EXTRA_CFLAGS -I$NDK/sources/cxx-stl/gnu-libstdc++/4.6/include -I$NDK/sources/cxx-stl/gnu-libstdc++/4.6/libs/$ABI/include"#EXTRA_CFLAGS="/ffmpeg-0.11.2/build/stagefright/armeabi-v7a/include"EXTRA_CFLAGS="-I$DEST/include"EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/include"EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/include/media/stagefright/openmax"EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/native/include"EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/native/include/media/openmax"EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/av/include"EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/system/core/include"EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/hardware/libhardware/include"EXTRA_CFLAGS="$EXTRA_CFLAGS -I$NDK/sources/cxx-stl/stlport/stlport"#EXTRA_CFLAGS="$EXTRA_CFLAGS -I$NDK/sources/cxx-stl/gnu-libstdc++/4.6/include"#EXTRA_CFLAGS="$EXTRA_CFLAGS -I$NDK/sources/cxx-stl/gnu-libstdc++/4.6/libs/$ABI/include"EXTRA_CFLAGS="$EXTRA_CFLAGS -mfloat-abi=softfp -mfpu=neon -marm -march=armv7-a -mtune=cortex-a8"EXTRA_CFLAGS="$EXTRA_CFLAGS -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -D_STLP_USE_NEWALLOC"EXTRA_CFLAGS="$EXTRA_CFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"EXTRA_LDFLAGS=" -Wl,--fix-cortex-a8 -L$ANDROID_LIBS -Wl,-rpath-link,$ANDROID_LIBS -L$NDK/sources/cxx-stl/gnu-libstdc++/4.6/libs/$ABI"EXTRA_CXXFLAGS="-Wno-multichar -fno-exceptions -fno-rtti"FLAGS="$FLAGS --prefix=$DEST"#mkdir -p $DESTecho $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" --extra-cxxflags="$EXTRA_CXXFLAGS" > $DEST/info.txt../configure $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" --extra-cxxflags="$EXTRA_CXXFLAGS" | tee $DEST/configuration.txt#[ $PIPESTATUS == 0 ] || exit 1make cleanmake -j8 install $TOOLCHAIN/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o$TOOLCHAIN/bin/arm-linux-androideabi-ld -rpath-link=$TOOLCHAIN/usr/lib -L$TOOLCHAIN/usr/lib -L$ANDROID_LIBS -soname libffmpeg-neon.so -shared -z noexecstack -Bsymbolic --whole-archive --no-undefined -o $DEST/libffmpeg-neon.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a -lc -lm -lz -ldl -llog -lstdc++ -lmedia -lutils -lstagefright -lbinder --dynamic-linker=/system/bin/linker /opt/android-ndk-r8d/sources/cxx-stl/stlport/libs/armeabi-v7a/libstlport_static.a $NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
4. Result
root@zhangjie:/home/ffmpeg_j3/jni/ffmpeg/build/stagefright/armeabi-v7a# pwd/home/ffmpeg_j3/jni/ffmpeg/build/stagefright/armeabi-v7aroot@zhangjie:/home/ffmpeg_j3/jni/ffmpeg/build/stagefright/armeabi-v7a# lsbin configuration.txt include info.txt lib libffmpeg-neon.so share
5. Configure
install prefix ../build/stagefright/armeabi-v7asource path /home/ffmpeg_j3/jni/ffmpegC compiler /opt/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gccARCH arm (armv7-a)big-endian noruntime cpu detection noARMv5TE enabled yesARMv6 enabled yesARMv6T2 enabled yesARM VFP enabled yesNEON enabled yesdebug symbols yesstrip symbols yesoptimize for size nooptimizations yesstatic yesshared nopostprocessing support nonew filter support yesnetwork support yesthreading support pthreadssafe bitstream reader yesSDL support nolibdxva2 enabled nolibva enabled nolibvdpau enabled noAVISynth enabled nofrei0r enabled nognutls enabled nolibaacplus enabled nolibass enabled nolibcdio support nolibcelt enabled nolibdc1394 support nolibfaac enabled nolibgsm enabled nolibmodplug enabled nolibmp3lame enabled nolibnut enabled nolibopencore-amrnb support nolibopencore-amrwb support nolibopencv support nolibopenjpeg enabled nolibpulse enabled nolibrtmp enabled nolibschroedinger enabled nolibspeex enabled nolibstagefright-h264 enabled yeslibtheora enabled nolibutvideo enabled nolibv4l2 enabled nolibvo-aacenc support nolibvo-amrwbenc support nolibvorbis enabled nolibvpx enabled nolibx264 enabled nolibxavs enabled nolibxvid enabled noopenal enabled noopenssl enabled nozlib enabled yesbzlib enabled noEnabled decoders:aac cinepak lagarithaac_latm cljr libstagefright_h264aasc cook locoac3 cscd mace3adpcm_4xm cyuv mace6adpcm_adx dca mdecadpcm_ct dfa microdvdadpcm_ea dirac mimicadpcm_ea_maxis_xa dnxhd mjpegadpcm_ea_r1 dpx mjpegbadpcm_ea_r2 dsicinaudio mlpadpcm_ea_r3 dsicinvideo mmvideoadpcm_ea_xas dvbsub motionpixelsadpcm_g722 dvdsub mp1adpcm_g726 dvvideo mp1floatadpcm_ima_amv dxa mp2adpcm_ima_apc dxtory mp2floatadpcm_ima_dk3 eac3 mp3adpcm_ima_dk4 eacmv mp3aduadpcm_ima_ea_eacs eamad mp3adufloatadpcm_ima_ea_sead eatgq mp3floatadpcm_ima_iss eatgv mp3on4adpcm_ima_qt eatqi mp3on4floatadpcm_ima_smjpeg eightbps mpc7adpcm_ima_wav eightsvx_exp mpc8adpcm_ima_ws eightsvx_fib mpeg1videoadpcm_ms escape124 mpeg2videoadpcm_sbpro_2 escape130 mpeg4adpcm_sbpro_3 exr mpegvideoadpcm_sbpro_4 ffv1 msmpeg4v1adpcm_swf ffvhuff msmpeg4v2adpcm_thp ffwavesynth msmpeg4v3adpcm_xa flac msrleadpcm_yamaha flashsv msvideo1alac flashsv2 mszhals flic mxpegamrnb flv nellymoseramrwb fourxm nuvamv fraps pamanm frwu pbmansi g723_1 pcm_alawape g729 pcm_blurayass gif pcm_dvdasv1 gsm pcm_f32beasv2 gsm_ms pcm_f32leatrac1 h261 pcm_f64beatrac3 h263 pcm_f64leaura h263i pcm_lxfaura2 huffyuv pcm_mulawavrp idcin pcm_s16beavs idf pcm_s16leavui iff_byterun1 pcm_s16le_planarayuv iff_ilbm pcm_s24bebethsoftvid imc pcm_s24daudbfi indeo2 pcm_s24lebink indeo3 pcm_s32bebinkaudio_dct indeo4 pcm_s32lebinkaudio_rdft indeo5 pcm_s8bintext interplay_dpcm pcm_s8_planarbmp interplay_video pcm_u16bebmv_audio jacosub pcm_u16lebmv_video jpeg2000 pcm_u24bec93 jpegls pcm_u24lecavs jv pcm_u32becdgraphics kgv1 pcm_u32lecdxl kmvc pcm_u8pcm_zork smc vmdvideopcx snow vmncpgm sol_dpcm vorbispgmyuv sonic vp3pgssub sp5x vp5pictor srt vp6png sunrast vp6appm svq1 vp6fprores svq3 vp8prores_lgpl targa vqaptx theora wavpackqcelp thp wmalosslessqdm2 tiertexseqvideo wmaproqdraw tiff wmav1qpeg tmv wmav2qtrle truehd wmavoicer10k truemotion1 wmv1r210 truemotion2 wmv2ra_144 truespeech wmv3ra_288 tscc wmv3imageralf tta wnv1rawvideo twinvq ws_snd1rl2 txd xan_dpcmroq ulti xan_wc3roq_dpcm utvideo xan_wc4rpza v210 xbinrv10 v210x xbmrv20 v308 xlrv30 v408 xsubrv40 v410 xwds302m vb y41psgi vble yopshorten vc1 yuv4sipr vc1image zerocodecsmackaud vcr1 zlibsmacker vmdaudio zmbvEnabled encoders:Enabled hwaccels:Enabled parsers:aac dvdsub mpegvideoaac_latm flac pngac3 gsm pnmadx h261 rv30cavsvideo h263 rv40cook h264 vc1dca mjpeg vorbisdirac mlp vp3dnxhd mpeg4video vp8dvbsub mpegaudioEnabled demuxers:aac iff pcm_u24beac3 image2 pcm_u24leact image2pipe pcm_u32beadf ingenient pcm_u32leadx ipmovie pcm_u8aea iss pmpaiff iv8 pvaamr ivf qcpanm jacosub r3dapc jv rawvideoape latm rl2asf lmlm4 rmass loas roqau lxf rplavi m4v rsoavs matroska rtpbethsoftvid mgsts rtspbfi microdvd sapbink mjpeg sbgbintext mlp sdpbit mm segafilmbmv mmf shortenc93 mov siffcaf mp3 smackercavsvideo mpc smjpegcdg mpc8 solcdxl mpegps soxdaud mpegts spdifdfa mpegtsraw srtdirac mpegvideo strdnxhd msnwc_tcp swfdsicin mtv thpdts mvi tiertexseqdv mxf tmvdxa mxg truehdea nc ttaea_cdata nsv ttyeac3 nut txdffm nuv vc1ffmetadata ogg vc1tfilmstrip oma vmdflac pcm_alaw vocflic pcm_f32be vqfflv pcm_f32le w64fourxm pcm_f64be wavg722 pcm_f64le wc3g723_1 pcm_mulaw wsaudg729 pcm_s16be wsvqagsm pcm_s16le wtvgxf pcm_s24be wvh261 pcm_s24le xah263 pcm_s32be xbinh264 pcm_s32le xmvhls pcm_s8 xwmaico pcm_u16be yopidcin pcm_u16le yuv4mpegpipeidfEnabled muxers:a64 ipod pcm_mulawac3 ismv pcm_s16beadts ivf pcm_s16leadx jacosub pcm_s24beaiff latm pcm_s24leamr m4v pcm_s32beasf matroska pcm_s32leasf_stream matroska_audio pcm_s8ass md5 pcm_u16beau microdvd pcm_u16leavi mjpeg pcm_u24beavm2 mkvtimestamp_v2 pcm_u24lebit mlp pcm_u32becaf mmf pcm_u32lecavsvideo mov pcm_u8crc mp2 pspdaud mp3 rawvideodirac mp4 rmdnxhd mpeg1system roqdts mpeg1vcd rsodv mpeg1video rtpeac3 mpeg2dvd rtspffm mpeg2svcd sapffmetadata mpeg2video segmentfilmstrip mpeg2vob smjpegflac mpegts soxflv mpjpeg spdifframecrc mxf srtframemd5 mxf_d10 swfg722 null tg2g723_1 nut tgpgif ogg truehdgxf oma vc1th261 pcm_alaw voch263 pcm_f32be wavh264 pcm_f32le webmimage2 pcm_f64be wtvimage2pipe pcm_f64le yuv4mpegpipeEnabled protocols:applehttp hls pipecache http rtmpconcat httpproxy rtpcrypto md5 tcpfile mmsh udpgopher mmstEnabled filters:abuffersink earwax panaconvert fade pixdesctestaevalsrc fieldorder removelogoaformat fifo rgbtestsrcamerge format selectamix fps setdaramovie gradfun setfieldanull hflip setptsanullsink idet setsaranullsrc life settbaresample lut showinfoashowinfo lutrgb silencedetectasplit lutyuv slicifyastreamsync mandelbrot splitbbox movie swapuvblackdetect negate testsrcbuffersink noformat thumbnailcellauto null tilecolor nullsink transposecopy nullsrc unsharpcrop overlay vflipdeshake pad volumedrawboxEnabled bsfs:aac_adtstoasc mjpeg2jpeg mp3_header_decompresschomp mjpega_dump_header noisedump_extradata mov2textsub remove_extradatah264_mp4toannexb mp3_header_compress text2movsubimx_dump_headerEnabled indevs:dv1394 lavfi v4l2fbdevEnabled outdevs:License: LGPL version 2.1 or laterCreating config.mak and config.h...libavutil/avconfig.h is unchanged