[普通]ffmpeg android编译

作者(passion) 阅读(89次) 评论(0) 分类( 软件)

直接上脚本, 根据自己的需要修改



#!/bin/bash

NDK=/home/build/android/android-ndk-r20b
SYSROOT=$NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot
TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin
CPU_arr=(armv7-a arm "${TOOLCHAIN}/armv7a-linux-androideabi28-clang" "${TOOLCHAIN}/armv7a-linux-androideabi28-clang++" "${TOOLCHAIN}/arm-linux-androideabi-strip" "-mfloat-abi=softfp -mfpu=vfp -marm -march=armv7-a"
armv8-a arm64 "${TOOLCHAIN}/aarch64-linux-android28-clang" "${TOOLCHAIN}/aarch64linux-android28-clang++" "${TOOLCHAIN}/aarch64-linux-android-strip" "-march=armv8-a"
x86 x86 "${TOOLCHAIN}/i686-linux-android28-clang" "${TOOLCHAIN}/i686-linux-android28-clang++" "${TOOLCHAIN}/i686-linux-android-strip" "-march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32"
x86_64 x86_64 "${TOOLCHAIN}/x86_64-linux-android28-clang" "${TOOLCHAIN}/x86_64-linux-android28-clang++" "${TOOLCHAIN}/x86_64-linux-android-strip" "-msse4.2 -mpopcnt -m64 -mtune=intel")
configure()
{
    ../ffmpeg-4.2.4/configure \
    --prefix=$PREFIX \
--toolchain=clang-usan \
    --enable-cross-compile \
    --target-os=android \
    --arch=$ARCH \
    --sysroot=$SYSROOT \
--cc=${cc} \
--cxx=${cxx} \
    --strip=${strip} \
    --extra-cflags="-fpic -Os -Wall -s ${cflags} " \
--extra-cxxflags="-fpic -Os -Wall -s " \
    --extra-ldflags="-fPIE -pie " \
--disable-iconv \
--disable-yasm \
    --enable-encoders \
    --enable-decoders \
    --enable-avdevice \
    --disable-static \
    --disable-doc \
--disable-htmlpages \
--disable-manpages \
--disable-podpages \
--disable-txtpages \
    --disable-ffplay \
--disable-ffmpeg \
    --disable-symver \
--disable-ffprobe \
--enable-network \
--enable-neon \
    --enable-shared \
    --enable-gpl \
    --enable-pic \
    --enable-jni \
    --enable-pthreads \
    --enable-mediacodec \
    --enable-encoder=aac \
    --enable-encoder=gif \
    --enable-encoder=libopenjpeg \
    --enable-encoder=libmp3lame \
    --enable-encoder=libwavpack \
    --enable-encoder=libx264 \
    --enable-encoder=mpeg4 \
    --enable-encoder=pcm_s16le \
    --enable-encoder=png \
    --enable-encoder=mjpeg \
    --enable-encoder=srt \
    --enable-encoder=subrip \
    --enable-encoder=yuv4 \
    --enable-encoder=text \
    --enable-decoder=aac \
    --enable-decoder=aac_latm \
    --enable-decoder=libopenjpeg \
    --enable-decoder=mp3 \
    --enable-decoder=mpeg4_mediacodec \
    --enable-decoder=pcm_s16le \
    --enable-decoder=flac \
    --enable-decoder=flv \
    --enable-decoder=gif \
    --enable-decoder=png \
    --enable-decoder=srt \
    --enable-decoder=xsub \
    --enable-decoder=yuv4 \
    --enable-decoder=vp8_mediacodec \
    --enable-decoder=h264_mediacodec \
    --enable-decoder=hevc_mediacodec \
    --enable-bsf=aac_adtstoasc \
    --enable-bsf=h264_mp4toannexb \
    --enable-bsf=hevc_mp4toannexb \
    --enable-bsf=mpeg4_unpack_bframes
}
build(){
for(( i=0;i<${#CPU_arr[@]};i=i+6)) 
do
CPU=${CPU_arr[i + 0]}
ARCH=${CPU_arr[i + 1]}
cc=${CPU_arr[i + 2]}
cxx=${CPU_arr[i + 3]}
strip=${CPU_arr[i + 4]}
cflags=${CPU_arr[i + 5]}
PREFIX=$(pwd)/android/$CPU
x264=$(pwd)/x264/android/$CPU
export PATH=$x264/bin:$PATH
export PATH=$x264/include:$PATH
export PATH=$x264/lib:$PATH
export PKG_CONFIG_PATH=$x264/lib/pkgconfig:$PKG_CONFIG_PATH
configure
make clean
make -j16
make install
done
}
build


« 上一篇:ubuntu时区的显示与设置
在这里写下您精彩的评论
  • 微信

  • QQ

  • 支付宝

返回首页
返回首页 img
返回顶部~
返回顶部 img
';