Skip to content

Commit

Permalink
Use ffmpeg 7.0.2, fixes for AArch64
Browse files Browse the repository at this point in the history
The old Docker environment must have changed. Moving libraries now doesn't work so
stage 1 and 2 have been combined. I also cut out unneeded/problematic libraries like freetype.
I'll see if libbluray and gnutls can be enabled again. openjpeg only implements jpeg2000, not jpeg or jpegxl,
so that's why it's removed.
  • Loading branch information
WyattBlue authored Aug 7, 2024
1 parent 0d64138 commit 931ebcc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 79 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/build-ffmpeg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,42 +128,6 @@ jobs:
with:
name: stage-1-${{ matrix.os }}-${{ matrix.arch }}
path: vendor
- name: Build FFmpeg dependencies
run: |
docker run -v $PWD:/project:rw --workdir=/project quay.io/pypa/manylinux2014_${{ matrix.arch }} bash -exc '
export PATH=/opt/python/cp39-cp39/bin:$PATH;
export CIBUILDWHEEL=1;
cp -ar vendor /tmp;
python scripts/build-ffmpeg.py /tmp/vendor --stage ${{ env.stage }};
cp -ar /tmp/vendor /project;
'
shell: bash
- uses: actions/upload-artifact@v4
with:
name: stage-2-${{ matrix.os }}-${{ matrix.arch }}
path: vendor

build-qemu-stage-3:
needs: build-qemu-stage-2
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
arch: [aarch64, ppc64le]
os: [ubuntu-latest]
env:
stage: 3
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- uses: actions/download-artifact@v4
with:
name: stage-2-${{ matrix.os }}-${{ matrix.arch }}
path: vendor
- name: Build FFmpeg
env:
CIBW_ARCHS: ${{ matrix.arch }}
Expand Down
59 changes: 16 additions & 43 deletions scripts/build-ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,12 @@
# out-of-tree builds fail on Windows
build_dir=".",
),
Package(
name="png",
source_url="http://deb.debian.org/debian/pool/main/libp/libpng1.6/libpng1.6_1.6.37.orig.tar.gz",
# avoid an assembler error on Windows
build_arguments=["PNG_COPTS=-fno-asynchronous-unwind-tables"],
),
Package(
name="xml2",
requires=["xz"],
source_url="https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.13.tar.xz",
build_arguments=["--without-python"],
),
Package(
name="freetype",
requires=["png"],
# source_url="https://download.savannah.gnu.org/releases/freetype/freetype-2.10.1.tar.gz",
# Real URL is unacceptably flakey.
source_url="https://pyav.basswood-io.com/mirror/freetype-2.10.1.tar.gz",
build_arguments=["--with-harfbuzz=no"],
),
Package(
name="fontconfig",
requires=["freetype", "xml2"],
source_url="https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.15.0.tar.xz",
build_arguments=["--disable-nls", "--enable-libxml2"],
),
]

gnutls_group = [
Expand Down Expand Up @@ -104,12 +84,6 @@
],
build_parallel=False,
),
Package(
name="bluray",
requires=["fontconfig"],
source_url="https://download.videolan.org/pub/videolan/libbluray/1.3.4/libbluray-1.3.4.tar.bz2",
build_arguments=["--disable-bdjava-jar"],
),
Package(
name="dav1d",
requires=["meson", "nasm", "ninja"],
Expand All @@ -130,13 +104,6 @@
# parallel build hangs on Windows
build_parallel=plat != "Windows",
),
Package(
name="openjpeg",
requires=["cmake"],
source_filename="openjpeg-2.5.2.tar.gz",
source_url="https://github.com/uclouvain/openjpeg/archive/v2.5.2.tar.gz",
build_system="cmake",
),
Package(
name="opus",
source_url="https://github.com/xiph/opus/releases/download/v1.4/opus-1.4.tar.gz",
Expand Down Expand Up @@ -167,6 +134,12 @@
"--disable-unit-tests",
],
),
Package(
name="png",
source_url="http://deb.debian.org/debian/pool/main/libp/libpng1.6/libpng1.6_1.6.37.orig.tar.gz",
# avoid an assembler error on Windows
build_arguments=["PNG_COPTS=-fno-asynchronous-unwind-tables"],
),
Package(
name="webp",
source_filename="webp-1.4.0.tar.gz",
Expand Down Expand Up @@ -211,7 +184,7 @@

ffmpeg_package = Package(
name="ffmpeg",
source_url="https://ffmpeg.org/releases/ffmpeg-7.0.1.tar.xz",
source_url="https://ffmpeg.org/releases/ffmpeg-7.0.2.tar.xz",
build_arguments=[],
)

Expand Down Expand Up @@ -253,7 +226,7 @@ def main():
parser.add_argument(
"--stage",
default=None,
help="AArch64 build requires stage and possible values can be 1, 2 or 3",
help="AArch64 build requires stage and possible values can be 1, 2",
)
parser.add_argument("--disable-gpl", action="store_true")
args = parser.parse_args()
Expand All @@ -266,7 +239,7 @@ def main():
output_dir = os.path.abspath("output")

# FFmpeg has native TLS backends for macOS and Windows
use_gnutls = plat == "Linux"
use_gnutls = False # plat == "Linux"

if plat == "Linux" and os.environ.get("CIBUILDWHEEL") == "1":
output_dir = "/output"
Expand Down Expand Up @@ -330,18 +303,18 @@ def main():
"--disable-alsa",
"--disable-doc",
"--disable-libtheora",
"--disable-libfreetype",
"--disable-libfontconfig",
"--disable-libbluray",
"--disable-libopenjpeg",
"--enable-mediafoundation" if plat == "Windows" else "--disable-mediafoundation",
"--enable-fontconfig",
"--enable-gmp",
"--enable-gnutls" if use_gnutls else "--disable-gnutls",
"--enable-libaom",
"--enable-libbluray",
"--enable-libdav1d",
"--enable-libfreetype",
"--enable-libmp3lame",
"--enable-libopencore-amrnb",
"--enable-libopencore-amrwb",
"--enable-libopenjpeg",
"--enable-libopus",
"--enable-libspeex",
"--enable-libtwolame",
Expand Down Expand Up @@ -375,7 +348,7 @@ def main():
if use_gnutls:
library_group += gnutls_group

package_groups = [library_group, codec_group, [ffmpeg_package]]
package_groups = [library_group + codec_group, [ffmpeg_package]]
if build_stage is not None:
packages = package_groups[build_stage]
else:
Expand All @@ -390,7 +363,7 @@ def main():
else:
builder.build(package)

if plat == "Windows" and (build_stage is None or build_stage == 2):
if plat == "Windows" and (build_stage is None or build_stage == 1):
# fix .lib files being installed in the wrong directory
for name in (
"avcodec",
Expand Down Expand Up @@ -440,7 +413,7 @@ def main():
run(["strip", "-s"] + libraries)

# build output tarball
if build_stage is None or build_stage == 2:
if build_stage is None or build_stage == 1:
os.makedirs(output_dir, exist_ok=True)
run(["tar", "czvf", output_tarball, "-C", dest_dir, "bin", "include", "lib"])

Expand Down

0 comments on commit 931ebcc

Please sign in to comment.