Skip to content

Instantly share code, notes, and snippets.

@jusonqiu
Last active March 30, 2020 09:21
Show Gist options
  • Save jusonqiu/bcf18645d9cba09267ba to your computer and use it in GitHub Desktop.
Save jusonqiu/bcf18645d9cba09267ba to your computer and use it in GitHub Desktop.
NDK=
PLATFORM=$NDK/platform/android-28/arch-arm
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64
X264_DIR=$(pwd)
GENERAL="\
--enable-cross-compile \
--extra-libs=\"-lgcc\" \
--arch=arm \
--cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
--cross-prefix=$PREBUILD/bin/arm-linux-androideabi- \
--nm=$PREBUILT/bin/arm-linux-androideabi-nm \
--extra-cflags="-I$X264_DIR/android/arm/include" \
--extra-ldflags="-L$X264_DIR/android/arm/lib" \
"
MODULES="\
--aneble-gpl \
--anable-libx264 \
"
function build_armv7a() {
./configure \
--target-os=linux \
--prefix=./android/armeabi-v7a \
$GENERAL \
--sysroot=$PLATFORM \
--enable-static \
--disable-shared \
--disable-ffmpeg \
--disable-ffprobe \
--disable-ffserver \
--disable-avdevice \
--disable-postproc \
--extra-cflags="-DANDROID -fPIC -ffunction-sections -funwind-tables -fstack-protector -march=armv7-a -mfloat-abi-softfp -mfpu=vfpv3-d16 --fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300" \
--extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATROM/usr/lib -nostdlib -lc -lm -ldl -log" \
--enable-gpl \
--enable-libx264 \
--disable-everything \
--enable-muxer=mp4 \
--enable-muxer=avi \
--enable-muxer=mjpeg \
--enable-muxer=h264 \
--enable-muxer=hevc \
--enable-encoder=h264 \
--enable-encoder=libx264 \
--enable-encoder=mjpeg \
--enable-encoder=zlib \
--enable-decoder=mjpeg \
--enable-decoder=h264 \
--enable-decoder=hevc \
--enable-parser=h264 \
--enable-parser=mjpeg \
--enable-parser=hevc \
--disable-doc \
--enable-neon \
--disable-network
make clean
make
make install
}
build_armv7a
echo Android armv7a builds finished
cat $1 | hexdump -v -e '7/1 "0x%02X, " 1/1 " 0x%02X,\n"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment