diff --git a/.circleci/config.yml b/.circleci/config.yml
index 4cbee8a..0e058a9 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -14,12 +14,13 @@ defaults: &defaults
mkdir -p build_logs;
export FINAL_DIR=$(pwd)/artifacts/$TARGET;
export BUILD_DIR=$(pwd)/build_scripts/build_dir && mkdir -p $BUILD_DIR;
- ./build_scripts/build_ffmpeg.sh $TARGET $BUILD_DIR $FINAL_DIR;
+ ./build_scripts/build_ffmpeg.sh $TARGET full $BUILD_DIR $FINAL_DIR;
+ ./build_scripts/build_ffmpeg.sh $TARGET lite $BUILD_DIR $FINAL_DIR;
- run:
name: Copy error report
command: |
mkdir -p build_logs/ffmpeg;
- cp build_scripts/ffmpeg-$FFMPEG_VERSION/config.log build_logs/ffmpeg/ || true;
+ cp ffmpeg-$FFMPEG_VERSION/config.log build_logs/ffmpeg/ || true;
when: on_fail
- store_artifacts:
path: build_logs
@@ -49,12 +50,12 @@ jobs:
TARGET: arm64-v8a
<< : *defaults
- build_arm_x86:
+ build_x86:
environment:
TARGET: i686
<< : *defaults
- build_arm_x86_64:
+ build_x86_64:
environment:
TARGET: x86_64
<< : *defaults
@@ -100,8 +101,8 @@ workflows:
- build_arm_v7a
- build_arm_v7a_neon
- build_arm_v8a
- - build_arm_x86
- - build_arm_x86_64
+ - build_x86
+ - build_x86_64
- build_native_linux
- hold:
type: approval
@@ -110,14 +111,14 @@ workflows:
- build_arm_v7a
- build_arm_v7a_neon
- build_arm_v8a
- - build_arm_x86
- - build_arm_x86_64
+ - build_x86
+ - build_x86_64
- build_native_linux
- - create_release:
- requires:
- - hold
filters:
branches:
only: master
+ - create_release:
+ requires:
+ - hold
diff --git a/README.md b/README.md
index 7dea201..8d2b853 100644
--- a/README.md
+++ b/README.md
@@ -1,57 +1,55 @@
-# FFmpeg Prebuilt Android
-This repo contains static FFmpeg executable binary which compatible with all Android [ABIs](https://developer.android.com/ndk/guides/abis.html):
-- `armeabi` (Android 16+)
-- `armeabi-v7a` (Android 16+)
-- `arm64-v8a` (Android 21+)
-- `x86` (Android 16+)
-- `x86_64` (Android 21+)
-- `mips` (Android 16+)
-- `mips64` (Android 21+)
+[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Prebuilt%20FFmpeg%20Android-brightgreen.svg?style=flat-square)](https://android-arsenal.com/details/1/6815)
-This is main configuration, optimizes for smallest binary size with most common media codecs and container formats:
-```
-[...]
- --enable-pic \
- --enable-small \
- --enable-gpl \
- \
- --disable-shared \
- --enable-static \
- \
- --enable-ffmpeg \
- --disable-ffplay \
- --disable-ffprobe \
- --disable-ffserver \
- \
- --disable-protocols \
- --enable-protocol='file,pipe' \
- \
- --disable-demuxers \
- --disable-muxers \
- --enable-demuxer='aac,avi,dnxhd,flac,flv,gif,h261,h263,h264,image2,matroska,webm,mov,mp3,mp4,mpeg,ogg,srt,wav,webvtt' \
- --enable-muxer='3gp,dnxhd,flac,flv,gif,image2,matroska,webm,mov,mp3,mp4,mpeg,ogg,opus,srt,wav,webvtt,ipod' \
- \
- --disable-encoders \
- --disable-decoders \
- --enable-encoder='aac,dnxhd,flac,flv,gif,libmp3lame,libopus,libshine,libvorbis,mpeg4,png,srt,subrip,webvtt' \
- --enable-decoder='aac,aac_at,aac_fixed,aac_latm,dnxhd,flac,flv,h261,h263,h263i,h263p,h264,vp8,vp9,libopus,libvorbis,mp3,mpeg4,wavpack,png,rawvideo,srt,webvtt' \
- \
- --enable-libshine \
- --enable-libmp3lame \
- --enable-libopus \
- --enable-libvorbis \
- --enable-bsf=aac_adtstoasc \
-```
+# Prebuilt FFmpeg Android
+This repo contains build scripts to build FFmpeg executable binary for Android and also [publish prebuilt files here](https://github.com/Khang-NT/ffmpeg-binary-android/releases).
+There are two build flavors: _FULL_ and _LITE_
+ * **LITE** is a version that optimized binrary size, so it only includes small set features to work with most commom formats and codecs.
+ + ABI and android version supported:
+ - `armeabi` (Android 16+)
+ - `armeabi-v7a`, `armeabi-v7a-neon`, (Android 16+)
+ - `x86` (Android 16+)
+ - `arm64-v8a` (Android 21+)
+ - `x86_64` (Android 21+)
+ - ~~`mips` (Android 16+)~~ (No longer support)
+ - ~~`mips64` (Android 21+)~~ (No longer support)
+ + Addition libraries: `libmp3lame`, `libshine`, `libopus`, `libvorbis`
+ * **FULL** is a version compiled full FFmpeg feature, include **https** support protocol.
+ + ABI and android version supported:
+ - `armeabi` (Android **21+**)
+ - `armeabi-v7a`, `armeabi-v7a-neon`, (Android **21+**)
+ - `x86` (Android **21+**)
+ - `arm64-v8a` (Android 21+)
+ - `x86_64` (Android 21+)
+ + Include libraries in `LITE` version, plus with: `libfdk-aac` (**non-free**), `libx264`, **`openssl`** (thanks to [leenjewel/openssl_for_ios_and_android](https://github.com/leenjewel/openssl_for_ios_and_android))
+
+## Download
+Latest build:
+[![Latest build](https://img.shields.io/github/release/Khang-NT/ffmpeg-binary-android.svg?style=for-the-badge)](https://github.com/Khang-NT/ffmpeg-binary-android/releases)
## Build
-You can build it and customize as you want using build scripts in [build_scripts](build_scripts) folder. (Recommended using Android NDK r15).
-```
-export NDK="path/to/ndk-r15"
-./build_all.sh
+
+Prerequisites:
+ * Android NDK r15
+ * `export NDK=path/to/android-ndk`
+
+Build:
+```bash
+export NDK=path/to/android-ndk
+cd build_scripts
+
+FLAVOR=full # or "lite"
+TARGET=armv7-a # Support targets: "arm", "armv7-a", "arm-v7n", "arm64-v8a", "i686", "x86_64"
+BUILD_DIR=$(pwd)/build_dir
+FINAL_DIR=$(pwd)/final/$TARGET
+
+./build_ffmpeg.sh $TARGET $FLAVOR $BUILD_DIR $FINAL_DIR
```
-## Referent
+The `ffmpeg` binary should in folder `$FINAL_DIR/$TARGET/$FLAVOR/ffmpeg` after build succeed.
+
+## References
- [FFmpegMediaPlayer](https://github.com/wseemann/FFmpegMediaPlayer) by [wseemann](https://github.com/wseemann)
+ - [PrebuiltOpenSSL](https://github.com/leenjewel/openssl_for_ios_and_android)
## FFmpeg license
This software uses code of FFmpeg licensed under the LGPLv2.1 and its source can be downloaded here.
diff --git a/build_scripts/build_all.sh b/build_scripts/build_all.sh
deleted file mode 100755
index a006d43..0000000
--- a/build_scripts/build_all.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/bash
-
-set -e
-set -x
-
-if [ "$NDK" = "" ] || [ ! -d $NDK ]; then
- echo "NDK variable not set or path to NDK is invalid, exiting..."
- exit 1
-fi
-
-export WORKING_DIR=`pwd`
-export BUILD_DIR="$WORKING_DIR/build"
-
-TARGET_ARMEABI_DIR=$BUILD_DIR/armeabi
-TARGET_ARMEABIV7A_DIR=$BUILD_DIR/armeabi-v7a
-TARGET_ARMEABIV7N_DIR=$BUILD_DIR/armeabi-v7-neon
-TARGET_X86_DIR=$BUILD_DIR/x86
-TARGET_MIPS_DIR=$BUILD_DIR/mips
-TARGET_MIPS64_DIR=$BUILD_DIR/mips64
-TARGET_X86_64_DIR=$BUILD_DIR/x86_64
-TARGET_ARMEABI_64_DIR=$BUILD_DIR/arm64-v8a
-
-TARGET_NATIVE_DIR=$BUILD_DIR/native
-
-cd $WORKING_DIR
-./build_ffmpeg_for_macos.sh $TARGET_NATIVE_DIR
-
-cd $WORKING_DIR
-./build_ffmpeg.sh armv7-a $TARGET_ARMEABIV7A_DIR
-
-cd $WORKING_DIR
-./build_ffmpeg.sh arm $TARGET_ARMEABI_DIR
-
-cd $WORKING_DIR
-./build_ffmpeg.sh arm64-v8a $TARGET_ARMEABI_64_DIR
-
-cd $WORKING_DIR
-./build_ffmpeg.sh i686 $TARGET_X86_DIR
-
-cd $WORKING_DIR
-./build_ffmpeg.sh x86_64 $TARGET_X86_64_DIR
-
-cd $WORKING_DIR
-./build_ffmpeg.sh mips $TARGET_MIPS_DIR
-
-cd $WORKING_DIR
-./build_ffmpeg.sh mips64 $TARGET_MIPS64_DIR
-
-cd $WORKING_DIR
-./build_ffmpeg.sh arm-v7n $TARGET_ARMEABIV7N_DIR
-
-echo "Build complete."
-exit 0
\ No newline at end of file
diff --git a/build_scripts/build_ffmpeg.sh b/build_scripts/build_ffmpeg.sh
index fbda60f..8e8bcb1 100755
--- a/build_scripts/build_ffmpeg.sh
+++ b/build_scripts/build_ffmpeg.sh
@@ -15,8 +15,9 @@ if [ "$NDK" = "" ] || [ ! -d $NDK ]; then
fi
export TARGET=$1
-export PREFIX=$2
-export DESTINATION_FOLDER=$3
+export FLAVOR=$2
+export PREFIX=$3
+export DESTINATION_FOLDER=$4
if [ "$(uname)" == "Darwin" ]; then
OS="darwin-x86_64"
@@ -26,15 +27,21 @@ fi
NATIVE_SYSROOT=/
-ARM_SYSROOT=$NDK/platforms/android-16/arch-arm/
+if [ "$FLAVOR" = "lite" ]; then
+ # LITE flavor support android 16+
+ ARM_SYSROOT=$NDK/platforms/android-16/arch-arm/
+ X86_SYSROOT=$NDK/platforms/android-16/arch-x86/
+else
+ # FULL flavor require android 21 at minimum (because of including openssl)
+ ARM_SYSROOT=$NDK/platforms/android-21/arch-arm/
+ X86_SYSROOT=$NDK/platforms/android-21/arch-x86/
+fi
ARM_PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/$OS
+X86_PREBUILT=$NDK/toolchains/x86-4.9/prebuilt/$OS
ARM64_SYSROOT=$NDK/platforms/android-21/arch-arm64/
ARM64_PREBUILT=$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/$OS
-X86_SYSROOT=$NDK/platforms/android-16/arch-x86/
-X86_PREBUILT=$NDK/toolchains/x86-4.9/prebuilt/$OS
-
X86_64_SYSROOT=$NDK/platforms/android-21/arch-x86_64/
X86_64_PREBUILT=$NDK/toolchains/x86_64-4.9/prebuilt/$OS
@@ -60,20 +67,13 @@ else
echo "Using existing `pwd`/ffmpeg-${FFMPEG_VERSION}"
fi
-YASM_VERSION="1.3.0"
-if [ ! -d "yasm-${YASM_VERSION}" ]; then
- echo "Downloading yasm-${YASM_VERSION}"
- curl -O "http://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz"
- tar -xzf "yasm-${YASM_VERSION}.tar.gz"
+LIBX264_VERSION="snapshot-20171130-2245"
+if [ ! -d "x264-$LIBX264_VERSION" ]; then
+ echo "Downloading x264-$LIBX264_VERSION"
+ curl -O "ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-$LIBX264_VERSION.tar.bz2"
+ tar -xf "x264-$LIBX264_VERSION.tar.bz2"
else
- echo "Using existing `pwd`/yasm-${YASM_VERSION}"
-fi
-
-if [ ! -d "x264" ]; then
- echo "Cloning x264"
- git clone --depth=1 git://git.videolan.org/x264.git x264
-else
- echo "Using existing `pwd`/x264"
+ echo "Using existing `pwd`/x264-$LIBX264_VERSION"
fi
OPUS_VERSION="1.1.5"
@@ -140,30 +140,48 @@ fi
# echo "Using existing `pwd`/libvpx-${LIBVPX_VERSION}"
# fi
+# Download lib openssl prebuilt
+OPENSSL_PREBUILT_FOLDER="$(pwd)/openssl-prebuilt"
+if [ ! -d $OPENSSL_PREBUILT_FOLDER/android ]; then
+ curl -LO "https://github.com/leenjewel/openssl_for_ios_and_android/releases/download/openssl-1.0.2k/openssl.1.0.2k_for_android_ios.zip"
+ mkdir -p $OPENSSL_PREBUILT_FOLDER && unzip -q "openssl.1.0.2k_for_android_ios.zip" -d $OPENSSL_PREBUILT_FOLDER
+fi
+
function build_one
{
-pushd yasm-${YASM_VERSION}
-./configure --prefix=$PREFIX
-
-# make clean
-make -j8
-make install
-popd
+if [ "$(uname)" == "Darwin" ]; then
+ brew install yasm nasm
+else
+ # Install nasm >= 2.13 for libx264
+ if [ ! -d "nasm-2.13.03" ]; then
+ curl -LO 'http://www.nasm.us/pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.xz'
+ tar -xf nasm-2.13.03.tar.xz
+ fi
+ pushd nasm-2.13.03
+ ./configure --prefix=/usr
+ make
+ sudo make install
+ popd
+fi
if [ $ARCH == "native" ]
then
SYSROOT=$NATIVE_SYSROOT
HOST=
CROSS_PREFIX=
+ if [ "$(uname)" == "Darwin" ]; then
+ brew install openssl
+ else
+ sudo apt-get install -y libssl-dev
+ fi
elif [ $ARCH == "arm" ]
then
SYSROOT=$ARM_SYSROOT
HOST=arm-linux-androideabi
CROSS_PREFIX=$ARM_PREBUILT/bin/$HOST-
- OPTIMIZE_CFLAGS="$OPTIMIZE_CFLAGS -Dlog2\(x\)=\(log\(x\)/log\(2\)\) -Dlog2f\(x\)=\(logf\(x\)/log\(2\)\)"
-#added by alexvas
+ OPTIMIZE_CFLAGS="$OPTIMIZE_CFLAGS "
elif [ $ARCH == "arm64" ]
then
SYSROOT=$ARM64_SYSROOT
@@ -179,7 +197,6 @@ then
SYSROOT=$X86_SYSROOT
HOST=i686-linux-android
CROSS_PREFIX=$X86_PREBUILT/bin/$HOST-
-
# elif [ $ARCH == "mips" ]
# then
# SYSROOT=$MIPS_SYSROOT
@@ -208,24 +225,40 @@ export CPPFLAGS="--sysroot=$SYSROOT "
export STRIP=${CROSS_PREFIX}strip
export PATH="$PATH:$PREFIX/bin/"
-# TODO: fix build failed
-# pushd x264
-# ./configure \
-# --cross-prefix=$CROSS_PREFIX \
-# --sysroot=$SYSROOT \
-# --host=$HOST \
-# --enable-pic \
-# --enable-static \
-# --disable-shared \
-# --disable-cli \
-# --disable-opencl \
-# --disable-asm \
-# --prefix=$PREFIX
-
-# make clean
-# make -j8
-# make install
-# popd
+if [ "$FLAVOR" = "full" ]; then
+ pushd x264-$LIBX264_VERSION
+ ./configure \
+ --cross-prefix=$CROSS_PREFIX \
+ --sysroot=$SYSROOT \
+ --host=$HOST \
+ --enable-pic \
+ --enable-static \
+ --disable-shared \
+ --disable-cli \
+ --disable-opencl \
+ --prefix=$PREFIX \
+ $LIBX264_FLAGS
+
+ make clean
+ make -j8
+ make install
+ popd
+
+ # Non-free
+ pushd fdk-aac-${FDK_AAC_VERSION}
+ ./configure \
+ --prefix=$PREFIX \
+ --host=$HOST \
+ --enable-static \
+ --disable-shared \
+ --with-sysroot=$SYSROOT
+
+ make clean
+ make -j8
+ make install
+ popd
+fi;
+
pushd opus-${OPUS_VERSION}
./configure \
@@ -241,21 +274,6 @@ make -j8
make install V=1
popd
-
-# Non-free
-pushd fdk-aac-${FDK_AAC_VERSION}
-./configure \
- --prefix=$PREFIX \
- --host=$HOST \
- --enable-static \
- --disable-shared \
- --with-sysroot=$SYSROOT
-
-make clean
-make -j8
-make install
-popd
-
pushd lame-${LAME_VERSION}
./configure \
--prefix=$PREFIX \
@@ -324,132 +342,95 @@ else
--sysroot=$SYSROOT"
fi
-# Build - FULL version
-./configure --prefix=$PREFIX \
- $CROSS_COMPILE_FLAGS \
- --pkg-config=$(which pkg-config) \
- --pkg-config-flags="--static" \
- --enable-pic \
- --enable-small \
- --enable-gpl \
- --enable-nonfree \
- \
- --disable-shared \
- --enable-static \
- \
- --enable-ffmpeg \
- --disable-ffplay \
- --disable-ffprobe \
- --disable-ffserver \
- \
- --enable-libshine \
- --enable-libmp3lame \
- --enable-libopus \
- --enable-libvorbis \
- --enable-libfdk-aac \
- --enable-bsf=aac_adtstoasc \
- \
- --disable-doc \
- $ADDITIONAL_CONFIGURE_FLAG
-
-make clean
-make -j8
-make install V=1
-
-mkdir -p $DESTINATION_FOLDER/full/
-cp $PREFIX/bin/ffmpeg $DESTINATION_FOLDER/full/
-
-
-# Build - LITE version
-./configure --prefix=$PREFIX \
- $CROSS_COMPILE_FLAGS \
- --pkg-config=$(which pkg-config) \
- --pkg-config-flags="--static" \
- --enable-pic \
- --enable-small \
- --enable-gpl \
- \
- --disable-shared \
- --enable-static \
- \
- --enable-ffmpeg \
- --disable-ffplay \
- --disable-ffprobe \
- --disable-ffserver \
- \
- --disable-protocols \
- --enable-protocol='file,pipe' \
- \
- --disable-demuxers \
- --disable-muxers \
- --enable-demuxer='aac,avi,dnxhd,flac,flv,gif,h261,h263,h264,image2,matroska,webm,mov,mp3,mp4,mpeg,ogg,srt,wav,webvtt,gif,image2,image2pipe,mjpeg' \
- --enable-muxer='3gp,dnxhd,flac,flv,gif,image2,matroska,webm,mov,mp3,mp4,mpeg,ogg,opus,srt,wav,webvtt,ipod,gif,image2,image2pipe,mjpeg' \
- \
- --disable-encoders \
- --disable-decoders \
- --enable-encoder='aac,dnxhd,flac,flv,gif,libmp3lame,libopus,libshine,libvorbis,mpeg4,png,mjpeg,gif,srt,subrip,webvtt' \
- --enable-decoder='aac,aac_at,aac_fixed,aac_latm,dnxhd,flac,flv,h261,h263,h263i,h263p,h264,vp8,vp9,libopus,libvorbis,mp3,mpeg4,wavpack,png,mjpeg,gif,pcm_s16le,pcm_s16be,rawvideo,srt,webvtt' \
- \
- --enable-libshine \
- --enable-libmp3lame \
- --enable-libopus \
- --enable-libvorbis \
- --enable-bsf=aac_adtstoasc \
- \
- --disable-doc \
- $ADDITIONAL_CONFIGURE_FLAG
+if [ "$FLAVOR" = "full" ]; then
+ # Build - FULL version
+ ./configure --prefix=$PREFIX \
+ $CROSS_COMPILE_FLAGS \
+ --pkg-config=$(which pkg-config) \
+ --pkg-config-flags="--static" \
+ --enable-pic \
+ --enable-small \
+ --enable-gpl \
+ --enable-nonfree \
+ \
+ --disable-shared \
+ --enable-static \
+ \
+ --enable-ffmpeg \
+ --disable-ffplay \
+ --disable-ffprobe \
+ --disable-ffserver \
+ \
+ --enable-libshine \
+ --enable-libmp3lame \
+ --enable-libopus \
+ --enable-libvorbis \
+ --enable-libx264 \
+ --enable-libfdk-aac \
+ --enable-bsf=aac_adtstoasc \
+ --enable-openssl \
+ \
+ --disable-doc \
+ $ADDITIONAL_CONFIGURE_FLAG
+else
+ # Build - LITE version
+ ./configure --prefix=$PREFIX \
+ $CROSS_COMPILE_FLAGS \
+ --pkg-config=$(which pkg-config) \
+ --pkg-config-flags="--static" \
+ --enable-pic \
+ --enable-small \
+ --enable-gpl \
+ \
+ --disable-shared \
+ --enable-static \
+ \
+ --enable-ffmpeg \
+ --disable-ffplay \
+ --disable-ffprobe \
+ --disable-ffserver \
+ \
+ --disable-protocols \
+ --enable-protocol='file,pipe' \
+ \
+ --disable-demuxers \
+ --disable-muxers \
+ --enable-demuxer='aac,avi,dnxhd,flac,flv,gif,h261,h263,h264,image2,matroska,webm,mov,mp3,mp4,mpeg,ogg,srt,wav,webvtt,gif,image2,image2pipe,mjpeg' \
+ --enable-muxer='3gp,dnxhd,flac,flv,gif,image2,matroska,webm,mov,mp3,mp4,mpeg,ogg,opus,srt,wav,webvtt,ipod,gif,image2,image2pipe,mjpeg' \
+ \
+ --disable-encoders \
+ --disable-decoders \
+ --enable-encoder='aac,dnxhd,flac,flv,gif,libmp3lame,libopus,libshine,libvorbis,mpeg4,png,mjpeg,gif,srt,subrip,webvtt' \
+ --enable-decoder='aac,aac_at,aac_fixed,aac_latm,dnxhd,flac,flv,h261,h263,h263i,h263p,h264,vp8,vp9,libopus,libvorbis,mp3,mpeg4,wavpack,png,mjpeg,gif,pcm_s16le,pcm_s16be,rawvideo,srt,webvtt' \
+ \
+ --enable-libshine \
+ --enable-libmp3lame \
+ --enable-libopus \
+ --enable-libvorbis \
+ --enable-bsf=aac_adtstoasc \
+ \
+ --disable-doc \
+ $ADDITIONAL_CONFIGURE_FLAG
+fi;
make clean
make -j8
make install V=1
-mkdir -p $DESTINATION_FOLDER/lite/
-cp $PREFIX/bin/ffmpeg $DESTINATION_FOLDER/lite/
+mkdir -p $DESTINATION_FOLDER/$FLAVOR/
+cp $PREFIX/bin/ffmpeg $DESTINATION_FOLDER/$FLAVOR/
popd
}
-if [ $TARGET == 'arm-v5te' ]; then
- #arm v5te
- CPU=armv5te
- ARCH=arm
- OPTIMIZE_CFLAGS="-marm -march=$CPU -Os -O3"
- ADDITIONAL_CONFIGURE_FLAG=
- build_one
-elif [ $TARGET == 'arm-v6' ]; then
- #arm v6
- CPU=armv6
- ARCH=arm
- OPTIMIZE_CFLAGS="-marm -march=$CPU -Os -O3"
- ADDITIONAL_CONFIGURE_FLAG=
- build_one
-elif [ $TARGET == 'arm-v7vfpv3' ]; then
- #arm v7vfpv3
- CPU=armv7-a
- ARCH=arm
- OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU -Os -O3 "
- ADDITIONAL_CONFIGURE_FLAG=
- build_one
-elif [ $TARGET == 'arm-v7vfp' ]; then
- #arm v7vfp
- CPU=armv7-a
- ARCH=arm
- OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfp -marm -march=$CPU -Os -O3 "
- ADDITIONAL_CONFIGURE_FLAG=
- build_one
-elif [ $TARGET == 'arm-v7n' ]; then
+if [ $TARGET == 'arm-v7n' ]; then
#arm v7n
CPU=armv7-a
ARCH=arm
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -mtune=cortex-a8 -march=$CPU -Os -O3"
- ADDITIONAL_CONFIGURE_FLAG=--enable-neon
- build_one
-elif [ $TARGET == 'arm-v6+vfp' ]; then
- #arm v6+vfp
- CPU=armv6
- ARCH=arm
- OPTIMIZE_CFLAGS="-DCMP_HAVE_VFP -mfloat-abi=softfp -mfpu=vfp -marm -march=$CPU -Os -O3"
- ADDITIONAL_CONFIGURE_FLAG=
+ ADDITIONAL_CONFIGURE_FLAG="--enable-neon "
+ LIBX264_FLAGS=
+ cp -a $OPENSSL_PREBUILT_FOLDER/android/openssl-armeabi-v7a/. $PREFIX
build_one
elif [ $TARGET == 'arm64-v8a' ]; then
#arm64-v8a
@@ -457,6 +438,8 @@ elif [ $TARGET == 'arm64-v8a' ]; then
ARCH=arm64
OPTIMIZE_CFLAGS="-march=$CPU -Os -O3"
ADDITIONAL_CONFIGURE_FLAG=
+ LIBX264_FLAGS=
+ cp -a $OPENSSL_PREBUILT_FOLDER/android/openssl-arm64-v8a/. $PREFIX
build_one
elif [ $TARGET == 'x86_64' ]; then
#x86_64
@@ -464,6 +447,8 @@ elif [ $TARGET == 'x86_64' ]; then
ARCH=x86_64
OPTIMIZE_CFLAGS="-fomit-frame-pointer -march=$CPU -Os -O3"
ADDITIONAL_CONFIGURE_FLAG=
+ LIBX264_FLAGS=
+ cp -a $OPENSSL_PREBUILT_FOLDER/android/openssl-x86_64/. $PREFIX
build_one
elif [ $TARGET == 'i686' ]; then
#x86
@@ -471,23 +456,9 @@ elif [ $TARGET == 'i686' ]; then
ARCH=i686
OPTIMIZE_CFLAGS="-fomit-frame-pointer -march=$CPU -Os -O3"
# disable asm to fix
- ADDITIONAL_CONFIGURE_FLAG=' --disable-asm '
- build_one
-elif [ $TARGET == 'mips' ]; then
- #mips
- CPU=mips32
- ARCH=mips
- OPTIMIZE_CFLAGS="-march=$CPU -Os -O3"
- #"-std=c99 -O3 -Wall -pipe -fpic -fasm -ftree-vectorize -ffunction-sections -funwind-tables -fomit-frame-pointer -funswitch-loops -finline-limit=300 -finline-functions -fpredictive-commoning -fgcse-after-reload -fipa-cp-clone -Wno-psabi -Wa,--noexecstack"
- ADDITIONAL_CONFIGURE_FLAG=
- build_one
-elif [ $TARGET == 'mips64' ]; then
- #mips
- CPU=mips64r6
- ARCH=mips64
- OPTIMIZE_CFLAGS="-march=$CPU -Os -O3"
- #"-std=c99 -O3 -Wall -pipe -fpic -fasm -ftree-vectorize -ffunction-sections -funwind-tables -fomit-frame-pointer -funswitch-loops -finline-limit=300 -finline-functions -fpredictive-commoning -fgcse-after-reload -fipa-cp-clone -Wno-psabi -Wa,--noexecstack"
- ADDITIONAL_CONFIGURE_FLAG=
+ ADDITIONAL_CONFIGURE_FLAG='--disable-asm'
+ LIBX264_FLAGS="--disable-asm"
+ cp -a $OPENSSL_PREBUILT_FOLDER/android/openssl-x86/. $PREFIX
build_one
elif [ $TARGET == 'armv7-a' ]; then
# armv7-a
@@ -495,6 +466,8 @@ elif [ $TARGET == 'armv7-a' ]; then
ARCH=arm
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -marm -march=$CPU -Os -O3 "
ADDITIONAL_CONFIGURE_FLAG=
+ LIBX264_FLAGS=
+ cp -a $OPENSSL_PREBUILT_FOLDER/android/openssl-armeabi-v7a/. $PREFIX
build_one
elif [ $TARGET == 'arm' ]; then
#arm
@@ -502,6 +475,8 @@ elif [ $TARGET == 'arm' ]; then
ARCH=arm
OPTIMIZE_CFLAGS="-march=$CPU -Os -O3 "
ADDITIONAL_CONFIGURE_FLAG=
+ LIBX264_FLAGS="--disable-asm"
+ cp -a $OPENSSL_PREBUILT_FOLDER/android/openssl-armeabi/. $PREFIX
build_one
elif [ $TARGET == 'native' ]; then
# host = current machine
@@ -509,6 +484,7 @@ elif [ $TARGET == 'native' ]; then
ARCH=native
OPTIMIZE_CFLAGS="-O2 -pipe -march=native"
ADDITIONAL_CONFIGURE_FLAG=
+ LIBX264_FLAGS=
build_one
else
echo "Unknown target: $TARGET"
diff --git a/build_scripts/build_ffmpeg_for_macos.sh b/build_scripts/build_ffmpeg_for_macos.sh
deleted file mode 100755
index a67c3be..0000000
--- a/build_scripts/build_ffmpeg_for_macos.sh
+++ /dev/null
@@ -1,258 +0,0 @@
-#!/bin/bash
-
-set -e
-set -x
-
-export PREFIX=$1
-
-FFMPEG_VERSION="3.3.2"
-if [ ! -d "ffmpeg-${FFMPEG_VERSION}" ]; then
- echo "Downloading ffmpeg-${FFMPEG_VERSION}.tar.bz2"
- curl -LO http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2
- echo "extracting ffmpeg-${FFMPEG_VERSION}.tar.bz2"
- tar -xvf ffmpeg-${FFMPEG_VERSION}.tar.bz2
-else
- echo "Using existing `pwd`/ffmpeg-${FFMPEG_VERSION}"
-fi
-
-YASM_VERSION="1.3.0"
-if [ ! -d "yasm-${YASM_VERSION}" ]; then
- echo "Downloading yasm-${YASM_VERSION}"
- curl -O "http://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz"
- tar -xvzf "yasm-${YASM_VERSION}.tar.gz"
-else
- echo "Using existing `pwd`/yasm-${YASM_VERSION}"
-fi
-
-# if [ ! -d "x264" ]; then
-# echo "Cloning x264"
-# git clone --depth=1 git://git.videolan.org/x264.git x264
-# else
-# echo "Using existing `pwd`/x264"
-# fi
-
-OPUS_VERSION="1.1.5"
-if [ ! -d "opus-${OPUS_VERSION}" ]; then
- echo "Downloading opus-${OPUS_VERSION}"
- curl -LO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz
- tar -xvzf opus-${OPUS_VERSION}.tar.gz
-else
- echo "Using existing `pwd`/opus-${OPUS_VERSION}"
-fi
-
-# FDK_AAC_VERSION="0.1.5"
-# if [ ! -d "fdk-aac-${FDK_AAC_VERSION}" ]; then
-# echo "Downloading fdk-aac-${FDK_AAC_VERSION}"
-# curl -LO http://downloads.sourceforge.net/opencore-amr/fdk-aac-${FDK_AAC_VERSION}.tar.gz
-# tar -xvzf fdk-aac-${FDK_AAC_VERSION}.tar.gz
-# else
-# echo "Using existing `pwd`/fdk-aac-${FDK_AAC_VERSION}"
-# fi
-
-LAME_MAJOR="3.99"
-LAME_VERSION="3.99.5"
-if [ ! -d "lame-${LAME_VERSION}" ]; then
- echo "Downloading lame-${LAME_VERSION}"
- curl -LO http://downloads.sourceforge.net/project/lame/lame/${LAME_MAJOR}/lame-${LAME_VERSION}.tar.gz
- tar -xvzf lame-${LAME_VERSION}.tar.gz
- curl -L -o lame-${LAME_VERSION}/config.guess "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD"
- curl -L -o lame-${LAME_VERSION}/config.sub "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD"
-else
- echo "Using existing `pwd`/lame-${LAME_VERSION}"
-fi
-
-if [ ! -d "shine" ]; then
- echo "Cloning https://github.com/toots/shine"
- git clone --depth=1 https://github.com/toots/shine.git
-else
- echo "Using existing `pwd`/shine"
-fi
-
-LIBOGG_VERSION="1.3.2"
-if [ ! -d "libogg-${LIBOGG_VERSION}" ]; then
- echo "Downloading libogg-${LIBOGG_VERSION}"
- curl -LO http://downloads.xiph.org/releases/ogg/libogg-${LIBOGG_VERSION}.tar.gz
- tar -xvzf libogg-${LIBOGG_VERSION}.tar.gz
-else
- echo "Using existing `pwd`/libogg-${LIBOGG_VERSION}"
-fi
-
-LIBVORBIS_VERSION="1.3.4"
-if [ ! -d "libvorbis-${LIBVORBIS_VERSION}" ]; then
- echo "Downloading libvorbis-${LIBVORBIS_VERSION}"
- curl -LO http://downloads.xiph.org/releases/vorbis/libvorbis-${LIBVORBIS_VERSION}.tar.gz
- tar -xvzf libvorbis-${LIBVORBIS_VERSION}.tar.gz
-else
- echo "Using existing `pwd`/libvorbis-${LIBVORBIS_VERSION}"
-fi
-
-# LIBVPX_VERSION="1.6.1"
-# if [ ! -d "libvpx-${LIBVPX_VERSION}" ]; then
-# echo "Downloading libvpx-${LIBVPX_VERSION}"
-# curl -LO http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-${LIBVPX_VERSION}.tar.bz2
-# tar -xvf libvpx-${LIBVPX_VERSION}.tar.bz2
-# else
-# echo "Using existing `pwd`/libvpx-${LIBVPX_VERSION}"
-# fi
-
-
-function build_one
-{
-
-export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig"
-unset CPP
-unset CXX
-unset CC
-unset LD
-unset AR
-unset NM
-unset RANLIB
-unset STRIP
-unset CPPFLAGS
-export LDFLAGS="-L$PREFIX/lib "
-export CFLAGS="$OPTIMIZE_CFLAGS -I$PREFIX/include "
-export CXXFLAGS="$CFLAGS"
-
-pushd yasm-${YASM_VERSION}
-./configure --prefix=$PREFIX
-make clean
-make -j8
-make install
-popd
-
-# pushd x264
-# ./configure \
-# --cross-prefix=$CROSS_PREFIX \
-# --sysroot=$PLATFORM \
-# --host=$HOST \
-# --enable-pic \
-# --enable-static \
-# --disable-shared \
-# --disable-cli \
-# --prefix=$PREFIX
-# make clean
-# make -j8
-# make install
-# popd
-
-pushd opus-${OPUS_VERSION}
-./configure \
- --prefix=$PREFIX \
- --enable-static \
- --disable-shared \
- --disable-doc \
- --disable-extra-programs
-
-make clean
-make -j8
-make install V=1
-popd
-
-
-# Non-free
-# pushd fdk-aac-${FDK_AAC_VERSION}
-# ./configure \
-# --prefix=$PREFIX \
-# --enable-static \
-# --disable-shared
-# make clean
-# make -j8
-# make install
-# popd
-
-pushd lame-${LAME_VERSION}
-./configure \
- --prefix=$PREFIX \
- --enable-static \
- --disable-shared
-
-make clean
-make -j8
-make install
-popd
-
-pushd shine
-./bootstrap
-./configure \
- --prefix=$PREFIX \
- --enable-static \
- --disable-shared
-
-make clean
-make -j8
-make install
-popd
-
-pushd libogg-${LIBOGG_VERSION}
-./configure \
- --prefix=$PREFIX \
- --enable-static \
- --disable-shared
-make clean
-make -j8
-make install
-popd
-
-pushd libvorbis-${LIBVORBIS_VERSION}
-./configure \
- --prefix=$PREFIX \
- --enable-static \
- --disable-shared \
- --with-ogg=$PREFIX
-make clean
-make -j8
-make install
-popd
-
-# (wget --no-check-certificate https://raw.githubusercontent.com/FFmpeg/gas-preprocessor/master/gas-preprocessor.pl && \
-# chmod +x gas-preprocessor.pl && \
-# sudo mv gas-preprocessor.pl /usr/bin) || exit 1
-
-pushd ffmpeg-$FFMPEG_VERSION
-./configure --prefix=$PREFIX \
- --pkg-config-flags="--static" \
- --enable-pic \
- --enable-small \
- --enable-gpl \
- \
- --disable-shared \
- --enable-static \
- \
- --enable-ffmpeg \
- --disable-ffplay \
- --disable-ffprobe \
- --disable-ffserver \
- \
- --disable-protocols \
- --enable-protocol='file,pipe' \
- \
- --enable-libshine \
- --enable-libmp3lame \
- --enable-libopus \
- --enable-libvorbis \
- --enable-bsf=aac_adtstoasc \
- \
- --disable-demuxers \
- --disable-muxers \
- --enable-demuxer='aac,avi,dnxhd,flac,flv,gif,h261,h263,h264,image2,matroska,webm,mov,mp3,mp4,mpeg,ogg,srt,wav,webvtt' \
- --enable-muxer='3gp,dnxhd,flac,flv,gif,image2,matroska,webm,mov,mp3,mp4,mpeg,ogg,opus,srt,wav,webvtt,ipod' \
- \
- --disable-encoders \
- --disable-decoders \
- --enable-encoder='aac,dnxhd,flac,flv,gif,libmp3lame,libopus,libshine,libvorbis,mpeg4,png,srt,subrip,webvtt' \
- --enable-decoder='aac,aac_at,aac_fixed,aac_latm,dnxhd,flac,flv,h261,h263,h263i,h263p,h264,vp8,vp9,libopus,libvorbis,mp3,mpeg4,wavpack,png,rawvideo,srt,webvtt' \
- \
- --disable-doc \
- $ADDITIONAL_CONFIGURE_FLAG
-
-make clean
-make -j8
-make install V=1
-popd
-}
-
-
-OPTIMIZE_CFLAGS="-O2 -pipe -march=native"
-ADDITIONAL_CONFIGURE_FLAG=
-build_one
-