From ca78671973ef5c4bc7a81e5c49be6b323482be1a Mon Sep 17 00:00:00 2001 From: xufulong <839789740@qq.com> Date: Thu, 5 Dec 2019 00:33:45 +0800 Subject: [PATCH] update the shell of FFmpeg update the shell of FFmpeg --- shell/ffmpeg/build_ffmpeg_one.sh | 106 ++++++++++++++++++++++++++++ shell/ffmpeg/build_ffmpeg_onelib.sh | 52 -------------- 2 files changed, 106 insertions(+), 52 deletions(-) create mode 100644 shell/ffmpeg/build_ffmpeg_one.sh delete mode 100644 shell/ffmpeg/build_ffmpeg_onelib.sh diff --git a/shell/ffmpeg/build_ffmpeg_one.sh b/shell/ffmpeg/build_ffmpeg_one.sh new file mode 100644 index 0000000..d15bdc8 --- /dev/null +++ b/shell/ffmpeg/build_ffmpeg_one.sh @@ -0,0 +1,106 @@ +make clean +cd compat +rm -rf strtod.d +rm -rf strtod.o +cd ../ + +set -e + +archbit=32 + +if [ $archbit -eq 32 ];then +echo "build for 32bit" +#32bit +ABI='armeabi-v7a' +CPU='arm' +ARCH='arm' +ANDROID='androideabi' +NATIVE_CPU='armv7-a' +OPTIMIZE_CFLAGS="-march=$NATIVE_CPU -mcpu=cortex-a8 -mfpu=vfpv3-d16 -mfloat-abi=softfp -mthumb" +else +#64bit +echo "build for 64bit" +ABI='arm64-v8a' +CPU='aarch64' +ARCH='arm64' +ANDROID='android' +NATIVE_CPU='armv8-a' +OPTIMIZE_CFLAGS="" +fi + +#export NDK=/Users/xufulong/Library/Android/sdk/ndk-bundle +export NDK=/Users/xufulong/Library/Android/android-ndk-r10e +export PREBUILT=$NDK/toolchains/$CPU-linux-$ANDROID-4.9/prebuilt +export PLATFORM=$NDK/platforms/android-21/arch-$ARCH +export TOOLCHAIN=$PREBUILT/darwin-x86_64 +export PREFIX=../ffmpeg-android/$ABI +export ADDITIONAL_CONFIGURE_FLAG="--cpu=$NATIVE_CPU" +export EXTRA_CFLAGS="-Os -fpic $OPTIMIZE_CFLAGS" +export EXTRA_LDFLAGS="-lc -lm -ldl -llog -lgcc -lz" + +build_one(){ + ./configure --target-os=linux --prefix=$PREFIX \ +--enable-cross-compile \ +--arch=$CPU \ +--cc=$TOOLCHAIN/bin/$CPU-linux-$ANDROID-gcc \ +--cross-prefix=$TOOLCHAIN/bin/$CPU-linux-$ANDROID- \ +--sysroot=$PLATFORM \ +--enable-neon \ +--enable-hwaccels \ +--enable-static \ +--disable-shared \ +--disable-doc \ +--enable-asm \ +--enable-small \ +--disable-ffmpeg \ +--disable-ffplay \ +--disable-ffprobe \ +--disable-ffserver \ +--disable-debug \ +--disable-gpl \ +--disable-avdevice \ +--disable-indevs \ +--disable-outdevs \ +--disable-avresample \ +--extra-cflags="$EXTRA_CFLAGS" \ +--extra-ldflags="$EXTRA_LDFLAGS" \ +--enable-avcodec \ +--enable-avformat \ +--enable-avutil \ +--enable-swresample \ +--enable-swscale \ +--enable-avfilter \ +--enable-network \ +--enable-bsfs \ +--enable-postproc \ +--enable-filters \ +--enable-encoders \ +--disable-decoders \ +--enable-decoder=mpeg4,h264,flv,gif,hevc,vp9,wmv3,png,ljpeg,jpeg2000,mjpeg,\ +aac,m4a,amrnb,amrwb,ape,dolby_e,dst,flac,opus,vorbis,wavesynth,wavpack,wmav2,\ +mp3float,mp3,mp3_at,mp3adufloat,mp3adu,mp3on4float,mp3on4,aac_fixed,aac_at,aac_latm,pcm_s16be,pcm_s16le \ +--enable-muxers \ +--enable-parsers \ +--enable-protocols \ +--disable-demuxers \ +--enable-demuxer=aac,ac3,amr,amrnb,amrwb,ape,asf,asf_o,ast,avi,caf,cavsvideo,codec2,concat,data,dnxhd,flac,flv,g722,g729,\ +gif,gif_pipe,h264,hevc,hls,image2,image2pipe,ingenient,jpeg_pipe,lavfi,lrc,m4v,matroska,webm,mjpeg,mov,mp4,m4a,3gp,mp3,mpeg,\ +mpegts,mv,ogg,png_pipe,realtext,rm,rtp,rtsp,s16be,s16le,s24be,s24le,s32be,s32le,sdp,srt,swf,u16be,u16le,u24be,u24le,u32be,u32le,\ +vc1,wav,webm_dash,manifest,xmv,f32be,f32le,f64be,f64le \ +$ADDITIONAL_CONFIGURE_FLAG +make +make install + +$TOOLCHAIN/bin/$CPU-linux-$ANDROID-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib \ +-L$PREFIX/lib -soname libffmpeg.so \ +-shared -nostdlib -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so \ +$PREFIX/lib/libavcodec.a \ +$PREFIX/lib/libavfilter.a \ +$PREFIX/lib/libswresample.a \ +$PREFIX/lib/libavformat.a \ +$PREFIX/lib/libavutil.a \ +$PREFIX/lib/libswscale.a \ +-lc -lm -lz -ldl -llog --dynamic-linker=/system/bin/linker $TOOLCHAIN/lib/gcc/$CPU-linux-$ANDROID/4.9/libgcc.a +} + +build_one \ No newline at end of file diff --git a/shell/ffmpeg/build_ffmpeg_onelib.sh b/shell/ffmpeg/build_ffmpeg_onelib.sh deleted file mode 100644 index 73fa34b..0000000 --- a/shell/ffmpeg/build_ffmpeg_onelib.sh +++ /dev/null @@ -1,52 +0,0 @@ -cd ffmpeg - -make clean - -archbit=32 - -#=========================== -if [ $archbit -eq 32 ];then -echo "build for 32bit" -#32bit -abi='armeabi' -cpu='arm' -arch='arm' -android='androideabi' -else -#64bit -echo "build for 64bit" -abi='arm64-v8a' -cpu='aarch64' -arch='arm64' -android='android' -fi - -export NDK=/home/frank/android/android-ndk-r10e -export PREBUILT=$NDK/toolchains/$cpu-linux-$android-4.9/prebuilt -export PLATFORM=$NDK/platforms/android-21/arch-$cpu -export PREFIX=../ff-onelib - -build_one(){ - ./configure --target-os=linux --prefix=$PREFIX \ ---enable-cross-compile \ ---enable-runtime-cpudetect \ ---arch=$cpu \ ---cc=$PREBUILT/linux-x86_64/bin/$cpu-linux-$android-gcc \ ---cross-prefix=$PREBUILT/linux-x86_64/bin/$cpu-linux-$android- \ ---disable-stripping \ ---nm=$PREBUILT/linux-x86_64/bin/$cpu-linux-$android-nm \ ---sysroot=$PLATFORM \ ---enable-gpl --enable-static --disable-shared --enable-nonfree --enable-version3 --enable-small \ ---enable-neon --enable-mediacodec --enable-asm \ ---enable-zlib --disable-ffprobe --disable-ffplay --enable-ffmpeg --disable-debug \ ---enable-jni \ ---extra-cflags="-fpic -mfpu=neon -mcpu=cortex-a8 -mfloat-abi=softfp -marm -march=armv7-a" -} -build_one - -make -make install - -$PREBUILT/linux-x86_64/bin/$cpu-linux-$android-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -L$PREFIX/lib -soname libffmpeg.so -shared -nostdlib -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavfilter/libavfilter.a libswresample/libswresample.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a libpostproc/libpostproc.a libavdevice/libavdevice.a -lc -lm -lz -ldl -llog --dynamic-linker=/system/bin/linker $PREBUILT/linux-x86_64/lib/gcc/$cpu-linux-$android/4.9/libgcc.a - -cd ..