FFmpeg Compiling for Android

Source: Internet
Author: User

Compilation Environment:

Debian x64

ndk-r14b

1. Installing ndk-r14b

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

Installation:

Cd/opt/workspace && Unzip Android-ndk-r14b-linux-x86_64.zip

2. NDK compilation Environment setup script: setup_build_env.sh

1 export ndk=/opt/workspace/android-ndk-r14b2 export prebuilt= $NDK/toolchains/ arm-linux-androideabi-4.9/3 export platform= $NDK/platforms/android-9/arch- Arm 4 Export prefix=$ (pwd)/android-lib

2.1 Compiling libx264

git clone git://git.videolan.org/x264.git. ./setup_build_env. SH CD x264. /configure--prefix=--enable-static--enable---enable-pic--disable-asm--disable-cli--host=arm-  --cross-prefix= $PREBUILT/linux-x86_64/bin/arm-linux-androideabi---sysroot=$PLATFORM  Make  Make Install CD..

2.2 Compiling 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 Make Make InstallCD..

2.3 Compiling FFmpeg

. Setup_build_env.SHExport PREFIX=.. /ffmpeg-Lib MakeCleanconfigure_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_normal Make Make Install

The installation directory after successful compilation is as follows:

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│  │& nbsp; ├──videotoolbox.h│  │  ├──vorbis_parser.h│  │  └──xvmc.h│& nbsp; ├──libavdevice│  │  ├──avdevice.h│  │  └──version.h│ & nbsp ├──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│& nbsp; │  ├──bprint.h│  │  ├──bswap.h│  │  ├──buffer.h│& nbsp; │  ├──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│ & nbsp │  ├──hwcontext_dxva2.h│  │  ├──hwcontext.h│  │  ├── Hwcontext_qsv.h│  │  ├──hwcontext_vaapi.h│  │  ├──hwcontext_vdpau.h│   │  ├──imgutils.h│  │  ├──intfloat.h│  │  ├──intreadwrite.h│  │  ├──lfg.h│  │ & nbsp ├──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│  │& nbsp; ├──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│ & nbsp └──libswscale│  ├──swscale.h│  └──version.h├──lib│  ├──libavcodec.a│ &n Bsp ├──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.p     c│  ├──libavfilter.pc│  ├──libavformat.pc│  ├──libavutil.pc│   ├──libpostproc.pc│  ├──libswresample.pc│  └──libswscale.pc└──share├──doc│&nb Sp; └──ffmpeg├──ffmpeg│  ├──examples│  ├──ffprobe.xsd│  ├──lib Vpx-1080p50_60.ffpreset│  ├──libvpx-1080p.ffpreset│  ├──libvpx-360p.ffpreset│ &nb Sp ├──libvpx-720p50_60.ffpreset│ &nBsp └──libvpx-720p.ffpreset└──man├──man1└──man320 directories, 157 files

FFmpeg Compiling for Android

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.