FFmpeg 編譯for Android

來源:互聯網
上載者:User

標籤:scale   doc   tab   lan   display   ica   camel   dom   tar   

編譯環境:

debian x64

ndk-r14b

 1. 安裝ndk-r14b 

 http://mirrors.neusoft.edu.cn/android/repository/android-ndk-r14b-linux-x86_64.zip

安裝:

cd /opt/workspace && unzip  android-ndk-r14b-linux-x86_64.zip

2. ndk編譯環境設定指令碼: setup_build_env.sh

1 export NDK=/opt/workspace/android-ndk-r14b2 export PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt 3 export PLATFORM=$NDK/platforms/android-9/arch-arm4 export PREFIX=$(pwd)/android-lib

2.1 編譯libx264

git clone git://git.videolan.org/x264.git. ./setup_build_env.sh cd x264./configure --prefix=$PREFIX --enable-static --enable-shared --enable-pic --disable-asm --disable-cli --host=arm-linux --cross-prefix=$PREBUILT/linux-x86_64/bin/arm-linux-androideabi- --sysroot=$PLATFORMmakemake installcd ..

2.2 編譯libfdk-aac

git clone https://github.com/mstorsjo/fdk-aac.git. ./setup_build_envcd fdk-aac./autogen.shCFLAGS="-fpic -DANDROID -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_7__ -Wno-psabi -march=armv7 -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID -Wa,--noexecstack -MMD -MP " CROSS_COMPILE=$PREBUILT/linux-x86_64/bin/arm-linux-androideabi-export CPPFLAGS="$CFLAGS"export CFLAGS="$CFLAGS"export CXXFLAGS="$CFLAGS"  export CXX="${CROSS_COMPILE}g++ --sysroot=${PLATFORM}"  export LDFLAGS="$LDFLAGS"  export CC="${CROSS_COMPILE}gcc --sysroot=${PLATFORM}"  export NM="${CROSS_COMPILE}nm"  export STRIP="${CROSS_COMPILE}strip"  export thout-mp4v2 RANLIB="${CROSS_COMPILE}ranlib"  export AR="${CROSS_COMPILE}ar"./configure  --prefix=$PREFIX --without-mp4v2 --host=arm-linux --enable-static --enable-shared makemake installcd ..

2.3 編譯FFmpeg

. setup_build_env.shexport PREFIX=../ffmpeg-libmake cleanconfigure_normal() {./configure --target-os=linux --prefix=$PREFIX --enable-cross-compile --enable-runtime-cpudetect --disable-asm --arch=arm --cc=$PREBUILT/linux-x86_64/bin/arm-linux-androideabi-gcc --cross-prefix=$PREBUILT/linux-x86_64/bin/arm-linux-androideabi- --disable-stripping --nm=$PREBUILT/linux-x86_64/bin/arm-linux-androideabi-nm --sysroot=$PLATFORM --enable-gpl --enable-nonfree --enable-shared --enable-static --enable-small --enable-libx264 --enable-libfdk-aac --extra-cflags="-I ./deps/android-lib/include -fPIC -DANDROID -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated -mfloat-abi=softfp -marm -march=armv7-a" --extra-ldflags="-L ./deps/android-lib/lib"}configure_normalmakemake install

編譯成功後安裝目錄如下:

ffmpeg-lib/├── bin│   ├── ffmpeg│   ├── ffprobe│   └── ffserver├── include│   ├── libavcodec│   │   ├── avcodec.h│   │   ├── avdct.h│   │   ├── avfft.h│   │   ├── d3d11va.h│   │   ├── dirac.h│   │   ├── dv_profile.h│   │   ├── dxva2.h│   │   ├── jni.h│   │   ├── mediacodec.h│   │   ├── qsv.h│   │   ├── vaapi.h│   │   ├── vda.h│   │   ├── vdpau.h│   │   ├── version.h│   │   ├── videotoolbox.h│   │   ├── vorbis_parser.h│   │   └── xvmc.h│   ├── libavdevice│   │   ├── avdevice.h│   │   └── version.h│   ├── libavfilter│   │   ├── avfiltergraph.h│   │   ├── avfilter.h│   │   ├── buffersink.h│   │   ├── buffersrc.h│   │   └── version.h│   ├── libavformat│   │   ├── avformat.h│   │   ├── avio.h│   │   └── version.h│   ├── libavutil│   │   ├── adler32.h│   │   ├── aes_ctr.h│   │   ├── aes.h│   │   ├── attributes.h│   │   ├── audio_fifo.h│   │   ├── avassert.h│   │   ├── avconfig.h│   │   ├── avstring.h│   │   ├── avutil.h│   │   ├── base64.h│   │   ├── blowfish.h│   │   ├── bprint.h│   │   ├── bswap.h│   │   ├── buffer.h│   │   ├── camellia.h│   │   ├── cast5.h│   │   ├── channel_layout.h│   │   ├── common.h│   │   ├── cpu.h│   │   ├── crc.h│   │   ├── des.h│   │   ├── dict.h│   │   ├── display.h│   │   ├── downmix_info.h│   │   ├── error.h│   │   ├── eval.h│   │   ├── ffversion.h│   │   ├── fifo.h│   │   ├── file.h│   │   ├── frame.h│   │   ├── hash.h│   │   ├── hmac.h│   │   ├── hwcontext_cuda.h│   │   ├── hwcontext_dxva2.h│   │   ├── hwcontext.h│   │   ├── hwcontext_qsv.h│   │   ├── hwcontext_vaapi.h│   │   ├── hwcontext_vdpau.h│   │   ├── imgutils.h│   │   ├── intfloat.h│   │   ├── intreadwrite.h│   │   ├── lfg.h│   │   ├── log.h│   │   ├── lzo.h│   │   ├── macros.h│   │   ├── mastering_display_metadata.h│   │   ├── mathematics.h│   │   ├── md5.h│   │   ├── mem.h│   │   ├── motion_vector.h│   │   ├── murmur3.h│   │   ├── opt.h│   │   ├── parseutils.h│   │   ├── pixdesc.h│   │   ├── pixelutils.h│   │   ├── pixfmt.h│   │   ├── random_seed.h│   │   ├── rational.h│   │   ├── rc4.h│   │   ├── replaygain.h│   │   ├── ripemd.h│   │   ├── samplefmt.h│   │   ├── sha512.h│   │   ├── sha.h│   │   ├── spherical.h│   │   ├── stereo3d.h│   │   ├── tea.h│   │   ├── threadmessage.h│   │   ├── timecode.h│   │   ├── time.h│   │   ├── timestamp.h│   │   ├── tree.h│   │   ├── twofish.h│   │   ├── version.h│   │   └── xtea.h│   ├── libpostproc│   │   ├── postprocess.h│   │   └── version.h│   ├── libswresample│   │   ├── swresample.h│   │   └── version.h│   └── libswscale│       ├── swscale.h│       └── version.h├── lib│   ├── libavcodec.a│   ├── libavcodec.so -> libavcodec.so.57.89.100│   ├── libavcodec.so.57 -> libavcodec.so.57.89.100│   ├── libavcodec.so.57.89.100│   ├── libavdevice.a│   ├── libavdevice.so -> libavdevice.so.57.6.100│   ├── libavdevice.so.57 -> libavdevice.so.57.6.100│   ├── libavdevice.so.57.6.100│   ├── libavfilter.a│   ├── libavfilter.so -> libavfilter.so.6.82.100│   ├── libavfilter.so.6 -> libavfilter.so.6.82.100│   ├── libavfilter.so.6.82.100│   ├── libavformat.a│   ├── libavformat.so -> libavformat.so.57.71.100│   ├── libavformat.so.57 -> libavformat.so.57.71.100│   ├── libavformat.so.57.71.100│   ├── libavutil.a│   ├── libavutil.so -> libavutil.so.55.58.100│   ├── libavutil.so.55 -> libavutil.so.55.58.100│   ├── libavutil.so.55.58.100│   ├── libpostproc.a│   ├── libpostproc.so -> libpostproc.so.54.5.100│   ├── libpostproc.so.54 -> libpostproc.so.54.5.100│   ├── libpostproc.so.54.5.100│   ├── libswresample.a│   ├── libswresample.so -> libswresample.so.2.7.100│   ├── libswresample.so.2 -> libswresample.so.2.7.100│   ├── libswresample.so.2.7.100│   ├── libswscale.a│   ├── libswscale.so -> libswscale.so.4.6.100│   ├── libswscale.so.4 -> libswscale.so.4.6.100│   ├── libswscale.so.4.6.100│   └── pkgconfig│       ├── libavcodec.pc│       ├── libavdevice.pc│       ├── libavfilter.pc│       ├── libavformat.pc│       ├── libavutil.pc│       ├── libpostproc.pc│       ├── libswresample.pc│       └── libswscale.pc└── share    ├── doc    │   └── ffmpeg    ├── ffmpeg    │   ├── examples    │   ├── ffprobe.xsd    │   ├── libvpx-1080p50_60.ffpreset    │   ├── libvpx-1080p.ffpreset    │   ├── libvpx-360p.ffpreset    │   ├── libvpx-720p50_60.ffpreset    │   └── libvpx-720p.ffpreset    └── man        ├── man1        └── man320 directories, 157 files

 

FFmpeg 編譯for Android

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.