Skip to content

Commit

Permalink
Merge tag 'v2.8.4' into media-file
Browse files Browse the repository at this point in the history
  • Loading branch information
Javernaut committed Oct 15, 2023
2 parents 5cdc6ee + 86a97d4 commit dc146e4
Show file tree
Hide file tree
Showing 23 changed files with 116 additions and 34 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/compilability_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ name: Compilability check
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
abi: [ "armeabi-v7a", "arm64-v8a", "x86", "x86_64" ]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup the environment
run: |
sudo pip3 install meson==0.58.2
sudo pip3 install meson==1.2.2
sudo apt-get install nasm ninja-build
- name: Executing the script
run: |
export ANDROID_SDK_HOME=$ANDROID_HOME
export ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME
./ffmpeg-android-maker.sh -dav1d -android=16 -abis=${{ matrix.abi }}
export ANDROID_NDK_HOME=$ANDROID_NDK
./ffmpeg-android-maker.sh -dav1d -android=19 -abis=${{ matrix.abi }}
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Alexander Berezhnoi
Copyright (c) 2022 Oleksandr Berezhnyi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The script also produces `ffmpeg` and `ffprobe` executables that can be used in

The main focus of ffmpeg-android-maker is to prepare shared libraries for seamless integration into an Android project. The script prepares the `output` directory that is meant to be used. And it's not the only thing this project does.

By default this script downloads and builds the FFmpeg **5.0**, but the version can be overridden.
By default this script downloads and builds the FFmpeg **6.0**, but the version can be overridden.

The details of how this script is implemented are described in this series of posts:
* [Part 1](https://proandroiddev.com/a-story-about-ffmpeg-in-android-part-i-compilation-898e4a249422)
Expand Down
5 changes: 4 additions & 1 deletion scripts/export-build-variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export CROSS_PREFIX_WITH_PATH=${TOOLCHAIN_PATH}/bin/llvm-
# The FAM_ prefix is used to eliminate passing those values implicitly to build systems
export FAM_ADDR2LINE=${CROSS_PREFIX_WITH_PATH}addr2line
export FAM_AR=${CROSS_PREFIX_WITH_PATH}ar
export FAM_AS=${CROSS_PREFIX_WITH_PATH}as
export FAM_NM=${CROSS_PREFIX_WITH_PATH}nm
export FAM_OBJCOPY=${CROSS_PREFIX_WITH_PATH}objcopy
export FAM_OBJDUMP=${CROSS_PREFIX_WITH_PATH}objdump
Expand All @@ -69,7 +70,6 @@ export TARGET=${TARGET_TRIPLE_MACHINE_CC}-linux-${TARGET_TRIPLE_OS}${ANDROID_PLA
export FAM_CC=${TOOLCHAIN_PATH}/bin/${TARGET}-clang
export FAM_CXX=${FAM_CC}++
export FAM_LD=${FAM_CC}
export FAM_AS=${FAM_CC}

# TODO consider abondaning this strategy of defining the name of the clang wrapper
# in favour of just passing -mstackrealign and -fno-addrsig depending on
Expand All @@ -81,6 +81,9 @@ export FAM_YASM=${TOOLCHAIN_PATH}/bin/yasm
# A variable to which certain dependencies can add -l arguments during build.sh
export FFMPEG_EXTRA_LD_FLAGS=

# A variable to which certain dependencies can add addtional arguments during ffmpeg build.sh
export EXTRA_BUILD_CONFIGURATION_FLAGS=

export INSTALL_DIR=${BUILD_DIR_EXTERNAL}/${ANDROID_ABI}

# Forcing FFmpeg and its dependencies to look for dependencies
Expand Down
2 changes: 1 addition & 1 deletion scripts/export-host-variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export HOST_TAG=$HOST_TAG
export HOST_NPROC=$HOST_NPROC

# Using CMake from the Android SDK
export CMAKE_EXECUTABLE=${ANDROID_SDK_HOME}/cmake/3.10.2.4988404/bin/cmake
export CMAKE_EXECUTABLE=${ANDROID_SDK_HOME}/cmake/3.22.1/bin/cmake
# Using Make from the Android SDK
export MAKE_EXECUTABLE=${ANDROID_NDK_HOME}/prebuilt/${HOST_TAG}/bin/make
# Using Build machine's Ninja. It is used for libdav1d building. Needs to be installed
Expand Down
5 changes: 3 additions & 2 deletions scripts/ffmpeg/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ case $ANDROID_ABI in
;;
x86)
# Disabling assembler optimizations, because they have text relocations
EXTRA_BUILD_CONFIGURATION_FLAGS=--disable-asm
EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --disable-asm"
;;
x86_64)
EXTRA_BUILD_CONFIGURATION_FLAGS=--x86asmexe=${FAM_YASM}
EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --x86asmexe=${FAM_YASM}"
;;
esac

Expand Down Expand Up @@ -49,6 +49,7 @@ DEP_LD_FLAGS="-L${BUILD_DIR_EXTERNAL}/${ANDROID_ABI}/lib $FFMPEG_EXTRA_LD_FLAGS"
--extra-ldflags="$DEP_LD_FLAGS" \
--enable-shared \
--disable-static \
--disable-vulkan \
--pkg-config=${PKG_CONFIG_EXECUTABLE} \
${EXTRA_BUILD_CONFIGURATION_FLAGS} \
--disable-runtime-cpudetect \
Expand Down
2 changes: 1 addition & 1 deletion scripts/libaom/android.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ include("$ENV{ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake")
if(DEFINED CMAKE_ASM_NASM_COMPILER)
set(AS_EXECUTABLE ${CMAKE_ASM_NASM_COMPILER})
else()
set(AS_EXECUTABLE ${_CMAKE_TOOLCHAIN_PREFIX}as)
set(AS_EXECUTABLE ${ANDROID_ASM_COMPILER})
endif()

# AV1 Codec Library doesn't recognise 'i686' as CMAKE_SYSTEM_PROCESSOR
Expand Down
2 changes: 1 addition & 1 deletion scripts/libaom/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source ${SCRIPTS_DIR}/common-functions.sh

AOM_VERSION=v3.3.0
AOM_VERSION=v3.7.0

downloadTarArchive \
"libaom" \
Expand Down
22 changes: 22 additions & 0 deletions scripts/libbluray/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

CC=${FAM_CC} \
AR=${FAM_AR} \
AS=${FAM_AS} \
RANLIB=${FAM_RANLIB} \
./configure \
--prefix=${INSTALL_DIR} \
--host=${TARGET} \
--with-sysroot=${SYSROOT_PATH} \
--disable-shared \
--enable-static \
--disable-examples \
--with-pic \
--without-libxml2 \
--without-freetype \
--without-fontconfig \
--disable-bdjava-jar || exit 1

${MAKE_EXECUTABLE} clean
${MAKE_EXECUTABLE} -j${HOST_NPROC}
${MAKE_EXECUTABLE} install
10 changes: 10 additions & 0 deletions scripts/libbluray/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

source ${SCRIPTS_DIR}/common-functions.sh

LIBBLURAY_VERSION=1.3.4

downloadTarArchive \
"libbluray" \
"https://download.videolan.org/pub/videolan/libbluray/${LIBBLURAY_VERSION}/libbluray-${LIBBLURAY_VERSION}.tar.bz2"

2 changes: 1 addition & 1 deletion scripts/libdav1d/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source ${SCRIPTS_DIR}/common-functions.sh

DAV1D_VERSION=1.0.0
DAV1D_VERSION=1.3.0

downloadTarArchive \
"libdav1d" \
Expand Down
4 changes: 2 additions & 2 deletions scripts/libfreetype/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

source ${SCRIPTS_DIR}/common-functions.sh

FREETYPE_VERSION=2.11.1
FREETYPE_VERSION=2.13.2

downloadTarArchive \
"libfreetype" \
"https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz" \
"https://nav.dl.sourceforge.net/project/freetype/freetype2/${FREETYPE_VERSION}/freetype-${FREETYPE_VERSION}.tar.gz"
2 changes: 1 addition & 1 deletion scripts/libfribidi/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source ${SCRIPTS_DIR}/common-functions.sh

FRIBIDI_VERSION=1.0.11
FRIBIDI_VERSION=1.0.13

downloadTarArchive \
"libfribidi" \
Expand Down
2 changes: 1 addition & 1 deletion scripts/libspeex/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source ${SCRIPTS_DIR}/common-functions.sh

SPEEX_VERSION=1.2.0
SPEEX_VERSION=1.2.1

downloadTarArchive \
"libspeex" \
Expand Down
2 changes: 1 addition & 1 deletion scripts/libvpx/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source ${SCRIPTS_DIR}/common-functions.sh

VPX_VERSION=v1.11.0
VPX_VERSION=v1.13.1

downloadTarArchive \
"libvpx" \
Expand Down
2 changes: 1 addition & 1 deletion scripts/libwavpack/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source ${SCRIPTS_DIR}/common-functions.sh

WAVPACK_VERSION=5.4.0
WAVPACK_VERSION=5.6.0

downloadTarArchive \
"libwavpack" \
Expand Down
13 changes: 10 additions & 3 deletions scripts/libwebp/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@

./configure \
--prefix=${INSTALL_DIR} \
--host=${TARGET_TRIPLE_MACHINE_ARCH}-linux-android \
--host=${TARGET} \
--with-sysroot=${SYSROOT_PATH} \
--target=${TARGET} \
CC=${FAM_CC} || exit 1
--disable-shared \
--enable-static \
--with-pic \
CC=${FAM_CC} \
AR=${FAM_AR} \
RANLIB=${FAM_RANLIB} || exit 1

# libsharpyuv.a is available alongside the libwebp.a
export FFMPEG_EXTRA_LD_FLAGS="${FFMPEG_EXTRA_LD_FLAGS} -lm -lsharpyuv"

${MAKE_EXECUTABLE} clean
${MAKE_EXECUTABLE} -j${HOST_NPROC}
Expand Down
2 changes: 1 addition & 1 deletion scripts/libwebp/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source ${SCRIPTS_DIR}/common-functions.sh

WEBP_VERSION=1.2.2
WEBP_VERSION=1.3.2

downloadTarArchive \
"libwebp" \
Expand Down
4 changes: 2 additions & 2 deletions scripts/libx264/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ source ${SCRIPTS_DIR}/common-functions.sh

# Libx264 doesn't have any versioning system. Currently it has 2 branches: master and stable.
# Latest commit in stable branch
# Jun 13, 2021 3:43pm GMT+0300
LIBX264_VERSION=5db6aa6cab1b146e07b60cc1736a01f21da01154
# Oct 1, 2023 4:28pm GMT
LIBX264_VERSION=31e19f92f00c7003fa115047ce50978bc98c3a0d

downloadTarArchive \
"libx264" \
Expand Down
21 changes: 21 additions & 0 deletions scripts/mbedtls/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

CMAKE_BUILD_DIR=mbedtls_build_${ANDROID_ABI}
# mbedtls authors park their source in a directory named mbedtls-${MBEDTLS_VERSION}
# instead of root directory
cd mbedtls-${MBEDTLS_VERSION}
rm -rf ${CMAKE_BUILD_DIR}
mkdir ${CMAKE_BUILD_DIR}
cd ${CMAKE_BUILD_DIR}

${CMAKE_EXECUTABLE} .. \
-DANDROID_PLATFORM=${ANDROID_PLATFORM} \
-DANDROID_ABI=${ANDROID_ABI} \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \
-DENABLE_TESTING=0

${MAKE_EXECUTABLE} -j${HOST_NPROC}
${MAKE_EXECUTABLE} install

export EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --enable-protocol=https --enable-version3"
9 changes: 9 additions & 0 deletions scripts/mbedtls/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

source ${SCRIPTS_DIR}/common-functions.sh

export MBEDTLS_VERSION=3.4.1
downloadTarArchive \
"mbedtls" \
"https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v${MBEDTLS_VERSION}.tar.gz" \
true
12 changes: 10 additions & 2 deletions scripts/parse-arguments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ABIS_TO_BUILD=()
API_LEVEL=19
SOURCE_TYPE=TAR
SOURCE_VALUE=5.0
SOURCE_VALUE=6.0
EXTERNAL_LIBRARIES=()
FFMPEG_GPL_ENABLED=false

Expand All @@ -25,6 +25,8 @@ SUPPORTED_LIBRARIES_FREE=(
"libwebp"
"libfreetype"
"libfribidi"
"mbedtls"
"libbluray"
)

# All GPL libraries that are supported
Expand Down Expand Up @@ -86,7 +88,7 @@ for argument in "$@"; do
--enable-libopus | -opus)
EXTERNAL_LIBRARIES+=("libopus")
;;
--enable-webp | -webp)
--enable-libwebp | -webp)
EXTERNAL_LIBRARIES+=("libwebp")
;;
--enable-libwavpack | -wavpack)
Expand All @@ -111,6 +113,12 @@ for argument in "$@"; do
EXTERNAL_LIBRARIES+=("libx264")
FFMPEG_GPL_ENABLED=true
;;
--enable-mbedtls | -mbedtls)
EXTERNAL_LIBRARIES+=("mbedtls")
;;
--enable-libbluray | -bluray)
EXTERNAL_LIBRARIES+=("libbluray")
;;
--enable-all-free | -all-free)
EXTERNAL_LIBRARIES+=" ${SUPPORTED_LIBRARIES_FREE[@]}"
;;
Expand Down
13 changes: 7 additions & 6 deletions tools/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM ubuntu:20.04
FROM --platform=linux/amd64 ubuntu:22.04

# Arguments that can be overridden in 'docker build' command:
# Versions of Android SDK and NDK. The CMake is installed via NDK.
ARG VERSION_SDK=6858069
ARG VERSION_NDK=21.4.7075529
ARG VERSION_CMAKE=3.10.2.4988404
ARG VERSION_SDK=10406996
ARG VERSION_NDK=25.2.9519653
ARG VERSION_CMAKE=3.22.1

# Package to install via pip3
ARG VERSION_MESON=0.58.2
ARG VERSION_MESON=1.2.2

# The HOME variable isn't available for ENV directive (during building an image).
# So we define one manually. For alpine and ubuntu it should be '/root'
Expand All @@ -18,7 +18,7 @@ ENV ANDROID_SDK_HOME=${HOME_TWIN}/android-sdk
ENV ANDROID_NDK_HOME=${ANDROID_SDK_HOME}/ndk/${VERSION_NDK}

# Installing basic software
RUN apt-get update && apt-get install -y --no-install-recommends \
RUN apt-get --allow-releaseinfo-change update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-setuptools \
Expand All @@ -32,6 +32,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
nasm \
pkg-config \
make \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down

0 comments on commit dc146e4

Please sign in to comment.