From 1e5a76397a229a995a266a81f058f2346f7342bc Mon Sep 17 00:00:00 2001 From: Jeff Sheffield Date: Fri, 8 Nov 2024 19:52:36 -0600 Subject: [PATCH] Upgrade ubuntu image to 24.04 (LTS), alpine to 320 and ffmpeg to 7.1 (#408) * fix dockerfile template for ubuntu point at correct base 'ubuntu:22.04' * got '7.1-ubuntu' 'docker-images/7.1/ubuntu2404' to build with no 'vulnerabilities' * added --enable-libharfbuzz * take nvidia and scratch builds out for ffmpeg 6.1 (took over an hour to build) --------- Co-authored-by: Julien Rottenberg --- .gitignore | 167 ++++ CONTRIBUTING.md | 70 ++ README.md | 144 ++- build_source.sh | 383 ++++++++ docker-images/5.1/alpine313/Dockerfile | 588 ------------ docker-images/5.1/nvidia2204/Dockerfile | 622 ------------- docker-images/5.1/ubuntu2204/Dockerfile | 590 ------------ docker-images/5.1/vaapi2204/Dockerfile | 596 ------------ docker-images/6.1/alpine320/Dockerfile | 210 +++++ docker-images/6.1/alpine320/build_source.sh | 427 +++++++++ .../6.1/alpine320/download_tarballs.sh | 141 +++ ...enerate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ docker-images/6.1/alpine320/install_ffmpeg.sh | 112 +++ docker-images/6.1/nvidia2204/Dockerfile | 622 ------------- docker-images/6.1/ubuntu2204/Dockerfile | 590 ------------ docker-images/6.1/ubuntu2404-edge/Dockerfile | 209 +++++ .../6.1/ubuntu2404-edge/build_source.sh | 427 +++++++++ .../6.1/ubuntu2404-edge/download_tarballs.sh | 141 +++ ...enerate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ .../6.1/ubuntu2404-edge/install_ffmpeg.sh | 112 +++ docker-images/6.1/ubuntu2404/Dockerfile | 200 ++++ docker-images/6.1/ubuntu2404/build_source.sh | 427 +++++++++ .../6.1/ubuntu2404/download_tarballs.sh | 141 +++ ...enerate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ .../6.1/ubuntu2404/install_ffmpeg.sh | 112 +++ docker-images/6.1/vaapi2204/Dockerfile | 596 ------------ docker-images/6.1/vaapi2404/Dockerfile | 205 +++++ docker-images/6.1/vaapi2404/build_source.sh | 428 +++++++++ .../6.1/vaapi2404/download_tarballs.sh | 141 +++ ...enerate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ docker-images/6.1/vaapi2404/install_ffmpeg.sh | 112 +++ docker-images/7.0/alpine313/Dockerfile | 588 ------------ docker-images/7.0/alpine320/Dockerfile | 210 +++++ docker-images/7.0/alpine320/build_source.sh | 427 +++++++++ .../7.0/alpine320/download_tarballs.sh | 141 +++ ...enerate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ docker-images/7.0/alpine320/install_ffmpeg.sh | 112 +++ docker-images/7.0/nvidia2204/Dockerfile | 622 ------------- docker-images/7.0/nvidia2404/Dockerfile | 231 +++++ docker-images/7.0/nvidia2404/build_source.sh | 432 +++++++++ .../7.0/nvidia2404/download_tarballs.sh | 141 +++ ...enerate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ .../7.0/nvidia2404/install_ffmpeg.sh | 112 +++ docker-images/7.0/scratch313/Dockerfile | 585 ------------ docker-images/7.0/scratch320/Dockerfile | 209 +++++ docker-images/7.0/scratch320/build_source.sh | 427 +++++++++ .../7.0/scratch320/download_tarballs.sh | 141 +++ ...enerate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ .../7.0/scratch320/install_ffmpeg.sh | 112 +++ docker-images/7.0/ubuntu2204/Dockerfile | 590 ------------ docker-images/7.0/ubuntu2404-edge/Dockerfile | 209 +++++ .../7.0/ubuntu2404-edge/build_source.sh | 427 +++++++++ .../7.0/ubuntu2404-edge/download_tarballs.sh | 141 +++ ...enerate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ .../7.0/ubuntu2404-edge/install_ffmpeg.sh | 112 +++ docker-images/7.0/ubuntu2404/Dockerfile | 200 ++++ docker-images/7.0/ubuntu2404/build_source.sh | 427 +++++++++ .../7.0/ubuntu2404/download_tarballs.sh | 141 +++ ...enerate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ .../7.0/ubuntu2404/install_ffmpeg.sh | 112 +++ docker-images/7.0/vaapi2204/Dockerfile | 596 ------------ docker-images/7.0/vaapi2404/Dockerfile | 205 +++++ docker-images/7.0/vaapi2404/build_source.sh | 428 +++++++++ .../7.0/vaapi2404/download_tarballs.sh | 141 +++ ...enerate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ docker-images/7.0/vaapi2404/install_ffmpeg.sh | 112 +++ docker-images/7.1/alpine320/Dockerfile | 210 +++++ docker-images/7.1/alpine320/build_source.sh | 427 +++++++++ .../7.1/alpine320/download_tarballs.sh | 141 +++ ...enerate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ docker-images/7.1/alpine320/install_ffmpeg.sh | 112 +++ docker-images/7.1/nvidia2404/Dockerfile | 231 +++++ docker-images/7.1/nvidia2404/build_source.sh | 432 +++++++++ .../7.1/nvidia2404/download_tarballs.sh | 141 +++ ...enerate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ .../7.1/nvidia2404/install_ffmpeg.sh | 112 +++ docker-images/7.1/scratch320/Dockerfile | 209 +++++ docker-images/7.1/scratch320/build_source.sh | 427 +++++++++ .../7.1/scratch320/download_tarballs.sh | 141 +++ ...enerate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ .../7.1/scratch320/install_ffmpeg.sh | 112 +++ docker-images/7.1/ubuntu2404-edge/Dockerfile | 209 +++++ .../7.1/ubuntu2404-edge/build_source.sh | 427 +++++++++ .../7.1/ubuntu2404-edge/download_tarballs.sh | 141 +++ ...enerate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ .../7.1/ubuntu2404-edge/install_ffmpeg.sh | 112 +++ docker-images/7.1/ubuntu2404/Dockerfile | 200 ++++ docker-images/7.1/ubuntu2404/build_source.sh | 427 +++++++++ .../7.1/ubuntu2404/download_tarballs.sh | 141 +++ ...enerate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ .../7.1/ubuntu2404/install_ffmpeg.sh | 112 +++ docker-images/7.1/vaapi2404/Dockerfile | 205 +++++ docker-images/7.1/vaapi2404/build_source.sh | 428 +++++++++ .../7.1/vaapi2404/download_tarballs.sh | 141 +++ ...enerate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ docker-images/7.1/vaapi2404/install_ffmpeg.sh | 112 +++ docker-images/azure-jobs.yml | 304 ++----- docker-images/gitlab-ci.yml | 347 ++----- download_tarballs.sh | 141 +++ generate-list-of-recent-images.py | 62 ++ generate-source-of-truth-ffmpeg-versions.py | 861 ++++++++++++++++++ install_ffmpeg.sh | 112 +++ templates/Dockerfile-env | 57 -- templates/Dockerfile-env-alpine | 7 + templates/Dockerfile-env-alpine-scratch | 7 + templates/Dockerfile-env-nvidia | 96 ++ templates/Dockerfile-env-ubuntu | 94 ++ templates/Dockerfile-env-ubuntu-edge | 22 + templates/Dockerfile-env-vaapi | 94 ++ templates/Dockerfile-run | 423 --------- templates/Dockerfile-run-alpine | 20 + templates/Dockerfile-run-alpine-scratch | 112 +++ templates/Dockerfile-run-nvidia | 29 + templates/Dockerfile-run-ubuntu | 25 + templates/Dockerfile-run-ubuntu-edge | 104 +++ templates/Dockerfile-run-vaapi | 29 + templates/Dockerfile-template.alpine313 | 70 -- templates/Dockerfile-template.alpine320 | 183 ++++ templates/Dockerfile-template.nvidia2404 | 106 +++ templates/Dockerfile-template.scratch313 | 67 -- templates/Dockerfile-template.scratch320 | 90 ++ templates/Dockerfile-template.ubuntu2204 | 71 -- templates/Dockerfile-template.ubuntu2404 | 81 ++ templates/Dockerfile-template.ubuntu2404-edge | 83 ++ templates/Dockerfile-template.vaapi2204 | 76 -- templates/Dockerfile-template.vaapi2404 | 82 ++ update.py | 199 +++- 127 files changed, 31511 insertions(+), 8513 deletions(-) create mode 100644 .gitignore create mode 100755 build_source.sh delete mode 100644 docker-images/5.1/alpine313/Dockerfile delete mode 100644 docker-images/5.1/nvidia2204/Dockerfile delete mode 100644 docker-images/5.1/ubuntu2204/Dockerfile delete mode 100644 docker-images/5.1/vaapi2204/Dockerfile create mode 100644 docker-images/6.1/alpine320/Dockerfile create mode 100644 docker-images/6.1/alpine320/build_source.sh create mode 100755 docker-images/6.1/alpine320/download_tarballs.sh create mode 100755 docker-images/6.1/alpine320/generate-source-of-truth-ffmpeg-versions.py create mode 100644 docker-images/6.1/alpine320/install_ffmpeg.sh delete mode 100644 docker-images/6.1/nvidia2204/Dockerfile delete mode 100644 docker-images/6.1/ubuntu2204/Dockerfile create mode 100644 docker-images/6.1/ubuntu2404-edge/Dockerfile create mode 100644 docker-images/6.1/ubuntu2404-edge/build_source.sh create mode 100755 docker-images/6.1/ubuntu2404-edge/download_tarballs.sh create mode 100755 docker-images/6.1/ubuntu2404-edge/generate-source-of-truth-ffmpeg-versions.py create mode 100644 docker-images/6.1/ubuntu2404-edge/install_ffmpeg.sh create mode 100644 docker-images/6.1/ubuntu2404/Dockerfile create mode 100644 docker-images/6.1/ubuntu2404/build_source.sh create mode 100755 docker-images/6.1/ubuntu2404/download_tarballs.sh create mode 100755 docker-images/6.1/ubuntu2404/generate-source-of-truth-ffmpeg-versions.py create mode 100644 docker-images/6.1/ubuntu2404/install_ffmpeg.sh delete mode 100644 docker-images/6.1/vaapi2204/Dockerfile create mode 100644 docker-images/6.1/vaapi2404/Dockerfile create mode 100644 docker-images/6.1/vaapi2404/build_source.sh create mode 100755 docker-images/6.1/vaapi2404/download_tarballs.sh create mode 100755 docker-images/6.1/vaapi2404/generate-source-of-truth-ffmpeg-versions.py create mode 100644 docker-images/6.1/vaapi2404/install_ffmpeg.sh delete mode 100644 docker-images/7.0/alpine313/Dockerfile create mode 100644 docker-images/7.0/alpine320/Dockerfile create mode 100644 docker-images/7.0/alpine320/build_source.sh create mode 100755 docker-images/7.0/alpine320/download_tarballs.sh create mode 100755 docker-images/7.0/alpine320/generate-source-of-truth-ffmpeg-versions.py create mode 100644 docker-images/7.0/alpine320/install_ffmpeg.sh delete mode 100644 docker-images/7.0/nvidia2204/Dockerfile create mode 100644 docker-images/7.0/nvidia2404/Dockerfile create mode 100644 docker-images/7.0/nvidia2404/build_source.sh create mode 100755 docker-images/7.0/nvidia2404/download_tarballs.sh create mode 100755 docker-images/7.0/nvidia2404/generate-source-of-truth-ffmpeg-versions.py create mode 100644 docker-images/7.0/nvidia2404/install_ffmpeg.sh delete mode 100644 docker-images/7.0/scratch313/Dockerfile create mode 100644 docker-images/7.0/scratch320/Dockerfile create mode 100644 docker-images/7.0/scratch320/build_source.sh create mode 100755 docker-images/7.0/scratch320/download_tarballs.sh create mode 100755 docker-images/7.0/scratch320/generate-source-of-truth-ffmpeg-versions.py create mode 100644 docker-images/7.0/scratch320/install_ffmpeg.sh delete mode 100644 docker-images/7.0/ubuntu2204/Dockerfile create mode 100644 docker-images/7.0/ubuntu2404-edge/Dockerfile create mode 100644 docker-images/7.0/ubuntu2404-edge/build_source.sh create mode 100755 docker-images/7.0/ubuntu2404-edge/download_tarballs.sh create mode 100755 docker-images/7.0/ubuntu2404-edge/generate-source-of-truth-ffmpeg-versions.py create mode 100644 docker-images/7.0/ubuntu2404-edge/install_ffmpeg.sh create mode 100644 docker-images/7.0/ubuntu2404/Dockerfile create mode 100644 docker-images/7.0/ubuntu2404/build_source.sh create mode 100755 docker-images/7.0/ubuntu2404/download_tarballs.sh create mode 100755 docker-images/7.0/ubuntu2404/generate-source-of-truth-ffmpeg-versions.py create mode 100644 docker-images/7.0/ubuntu2404/install_ffmpeg.sh delete mode 100644 docker-images/7.0/vaapi2204/Dockerfile create mode 100644 docker-images/7.0/vaapi2404/Dockerfile create mode 100644 docker-images/7.0/vaapi2404/build_source.sh create mode 100755 docker-images/7.0/vaapi2404/download_tarballs.sh create mode 100755 docker-images/7.0/vaapi2404/generate-source-of-truth-ffmpeg-versions.py create mode 100644 docker-images/7.0/vaapi2404/install_ffmpeg.sh create mode 100644 docker-images/7.1/alpine320/Dockerfile create mode 100644 docker-images/7.1/alpine320/build_source.sh create mode 100755 docker-images/7.1/alpine320/download_tarballs.sh create mode 100755 docker-images/7.1/alpine320/generate-source-of-truth-ffmpeg-versions.py create mode 100644 docker-images/7.1/alpine320/install_ffmpeg.sh create mode 100644 docker-images/7.1/nvidia2404/Dockerfile create mode 100644 docker-images/7.1/nvidia2404/build_source.sh create mode 100755 docker-images/7.1/nvidia2404/download_tarballs.sh create mode 100755 docker-images/7.1/nvidia2404/generate-source-of-truth-ffmpeg-versions.py create mode 100644 docker-images/7.1/nvidia2404/install_ffmpeg.sh create mode 100644 docker-images/7.1/scratch320/Dockerfile create mode 100644 docker-images/7.1/scratch320/build_source.sh create mode 100755 docker-images/7.1/scratch320/download_tarballs.sh create mode 100755 docker-images/7.1/scratch320/generate-source-of-truth-ffmpeg-versions.py create mode 100644 docker-images/7.1/scratch320/install_ffmpeg.sh create mode 100644 docker-images/7.1/ubuntu2404-edge/Dockerfile create mode 100644 docker-images/7.1/ubuntu2404-edge/build_source.sh create mode 100755 docker-images/7.1/ubuntu2404-edge/download_tarballs.sh create mode 100755 docker-images/7.1/ubuntu2404-edge/generate-source-of-truth-ffmpeg-versions.py create mode 100644 docker-images/7.1/ubuntu2404-edge/install_ffmpeg.sh create mode 100644 docker-images/7.1/ubuntu2404/Dockerfile create mode 100644 docker-images/7.1/ubuntu2404/build_source.sh create mode 100755 docker-images/7.1/ubuntu2404/download_tarballs.sh create mode 100755 docker-images/7.1/ubuntu2404/generate-source-of-truth-ffmpeg-versions.py create mode 100644 docker-images/7.1/ubuntu2404/install_ffmpeg.sh create mode 100644 docker-images/7.1/vaapi2404/Dockerfile create mode 100644 docker-images/7.1/vaapi2404/build_source.sh create mode 100755 docker-images/7.1/vaapi2404/download_tarballs.sh create mode 100755 docker-images/7.1/vaapi2404/generate-source-of-truth-ffmpeg-versions.py create mode 100644 docker-images/7.1/vaapi2404/install_ffmpeg.sh create mode 100755 download_tarballs.sh create mode 100644 generate-list-of-recent-images.py create mode 100755 generate-source-of-truth-ffmpeg-versions.py create mode 100644 install_ffmpeg.sh delete mode 100644 templates/Dockerfile-env create mode 100644 templates/Dockerfile-env-alpine create mode 100644 templates/Dockerfile-env-alpine-scratch create mode 100644 templates/Dockerfile-env-nvidia create mode 100644 templates/Dockerfile-env-ubuntu create mode 100644 templates/Dockerfile-env-ubuntu-edge create mode 100644 templates/Dockerfile-env-vaapi delete mode 100644 templates/Dockerfile-run create mode 100644 templates/Dockerfile-run-alpine create mode 100644 templates/Dockerfile-run-alpine-scratch create mode 100644 templates/Dockerfile-run-nvidia create mode 100644 templates/Dockerfile-run-ubuntu create mode 100644 templates/Dockerfile-run-ubuntu-edge create mode 100644 templates/Dockerfile-run-vaapi delete mode 100644 templates/Dockerfile-template.alpine313 create mode 100644 templates/Dockerfile-template.alpine320 create mode 100644 templates/Dockerfile-template.nvidia2404 delete mode 100644 templates/Dockerfile-template.scratch313 create mode 100644 templates/Dockerfile-template.scratch320 delete mode 100644 templates/Dockerfile-template.ubuntu2204 create mode 100644 templates/Dockerfile-template.ubuntu2404 create mode 100644 templates/Dockerfile-template.ubuntu2404-edge delete mode 100644 templates/Dockerfile-template.vaapi2204 create mode 100644 templates/Dockerfile-template.vaapi2404 diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..e6faaf320 --- /dev/null +++ b/.gitignore @@ -0,0 +1,167 @@ +list_of_recent_images.txt +generated_build_manifest.json +generated_build_versions_manifest.json +generated_versions_table.md + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/latest/usage/project/#working-with-version-control +.pdm.toml +.pdm-python +.pdm-build/ + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0f9b3e21d..02c402996 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,7 +49,77 @@ docker build -t my-build docker-images/VERSION/ find ffmpeg/ -name Dockerfile | xargs dirname | parallel --no-notice -j 4 --results logs docker build -t {} {} ``` +
Some detailed examples, of building and running +If you are not running the amd64 platform, you may need to pass in the --platform flag to build with docker desktop +- 7.1-ubuntu2404 + +```sh +$ ./update.py; time docker build --platform linux/amd64 -t ffmpeg-7.1-ubuntu2404-desktop-build docker-images/7.1/ubuntu2404 +$ docker run -it --rm --entrypoint='bash' --platform="linux/amd64" ffmpeg-7.1-ubuntu2404-desktop-build:latest +``` + +- 7.1-ubuntu2404-edge + +```sh +$ ./update.py; time docker build --platform linux/amd64 -t ffmpeg-7.1-ubuntu2404-edge-desktop-build docker-images/7.1/ubuntu2404-edge +$ docker run -it --rm --entrypoint='bash' --platform="linux/amd64" ffmpeg-7.1-ubuntu2404-edge-desktop-build:latest +``` + +- 7.1-nvidia2404 + +```sh +$ ./update.py; time docker build --platform linux/amd64 -t ffmpeg-7.1-nvidia2404-desktop-build docker-images/7.1/nvidia2404 +$ docker run -it --rm --entrypoint='bash' --platform="linux/amd64" ffmpeg-7.1-nvidia2404-desktop-build:latest +``` + +- vaapi2404 +```sh +$ ./update.py; time docker build --platform linux/amd64 -t ffmpeg-7.1-vaapi2404-desktop-build docker-images/7.1/vaapi2404 +$ docker run -it --rm --entrypoint='bash' --platform="linux/amd64" ffmpeg-7.1-vaapi2404-desktop-build:latest +``` + +- alpine320 +```sh +$ ./update.py; time docker build --platform linux/amd64 -t ffmpeg-7.1-alpine320-desktop-build docker-images/7.1/alpine320 +$ docker run -it --rm --entrypoint='sh' --platform="linux/amd64" ffmpeg-7.1-alpine320-desktop-build:latest +``` + +```sh +$ ./update.py; time docker build --platform linux/amd64 -t ffmpeg-7.1-scratch320-desktop-build docker-images/7.1/scratch320 +$ docker run -it --rm --entrypoint='sh' --platform="linux/amd64" ffmpeg-7.1-scratch320-desktop-build:latest +``` + +
+ +
More testing notes + + +``` +1: simply run the image: which should output the ffmpeg help +`docker run -it --rm --platform="linux/amd64" ffmpeg-7.1-ubuntu2404-desktop-build:latest` + +2: now run the image in bash +`docker run -it --rm --entrypoint=bash --platform="linux/amd64" ffmpeg-7.1-ubuntu2404-desktop-build:latest` + +In the bash shell, run the following commands + $ ffmpeg + $ ffmpeg -h + $ ldd `which ffmpeg` + Note: this next command on alipne will need to be modified to look in '/lib/' instead of '/usr/local/' + but they are all there + $ for i in ogg amr vorbis theora mp3lame opus vpx xvid fdk x264 x265;do echo $i; find /usr/local/ -name *$i*;done + $ ffmpeg -buildconf + +3: Convert an avi file to an mp4 file. + `docker run --rm -v $(pwd):$(pwd) -w $(pwd) --platform="linux/amd64" ffmpeg-7.1-ubuntu2404-desktop-build:latest -i drop_video_1.avi outfile/dv_converted.mp4` + +4: Convert a asf file to an mp4 + `docker run --rm -v $(pwd):$(pwd) -w $(pwd) --platform="linux/amd64" ffmpeg-7.1-ubuntu2404-desktop-build:latest -i MU_2_Discharge_Bottle___Inlet_to_Discharge.asf outfile/mpu2_discharge_bottle_converted.mp4` + +``` + +
# Reviewing diff --git a/README.md b/README.md index c0f04df03..cc85851a3 100644 --- a/README.md +++ b/README.md @@ -14,35 +14,69 @@ You can install the latest build of this image by running `docker pull jrottenbe This image can be used as a base for an encoding farm. -## Builds +## Builds / Avaliabvle Docker Containers There are different builds available: +Below is a table that provides examples for the nomenclature: + +`ffmpeg--` + +| image name | OS ver | ffmpeg ver | variant | description +| --- | --- | --- | --- | --- | +| ffmpeg-7.1-ubuntu2404 | 24.04 | 6.x - 7.x | [ubuntu](https://releases.ubuntu.com/) | external libraries are installed from os packages, and ffmpeg is built from source. See [Ubunu Compilation Guide](https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu) for details on this. | +| ffmpeg-7.1-ubuntu2404-edge | 24.04 | 6.x - 7.x | [ubuntu](https://releases.ubuntu.com/) | libs and ffmpeg are built from source. See [Ubunu Compilation Guide](https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu) for details on this. | +| ffmpeg-7.1-vaapi2404 | 24.04 | 6.x - 7.x | [ubuntu](https://releases.ubuntu.com/) | like: `ubuntu2404` but enables: [Video Acceleration API (VAAPI)](https://trac.ffmpeg.org/wiki/HWAccelIntro#VAAPI) in ffmpeg | +| ffmpeg-7.1-nvidia2204-edge | 22.04 | 6.x - 7.x | [ubuntu](https://releases.ubuntu.com/) | Built w/ [NVIDIA's hardware-accelerated encoding and decoding APIs](https://trac.ffmpeg.org/wiki/HWAccelIntro#CUDANVENCNVDEC) enabled | +| ffmpeg-7.1-alpine320 | 3.20 | 6.x - 7.x | [alpine](https://alpinelinux.org/releases/) | vendor libs, but ffmpeg is built from source | +| ffmpeg-7.1-scratch | 3.20 | 6.x - 7.x | [alpine](https://alpinelinux.org/releases/) | vendor libs, and ffmpeg are built from source. Also we make the distro as small as possible by not installing any packages in base and striping symbols of installed libs | + +ffmpeg `` can be one of the following: `6.1`, `7.0`, `7.1` with the above table. + +Note: The current versions of ffmpeg supported are anything newer than 3 years old and not exceeded the end-of-life + + +
Here are some additional older builds + - alpine based images `ffmpeg:-alpine` or `ffmpeg:-alpine313` (old versions with `ffmpeg:-alpine312` , `ffmpeg:-alpine311`) - alpine based scratch images `ffmpeg:-scratch` or `ffmpeg:-scratch313` (old versions with `ffmpeg:-scratch312` , `ffmpeg:-scratch311`) - ubuntu based images `ffmpeg:-ubuntu` or `ffmpeg:-ubuntu2004` (old versions with `ffmpeg:-ubuntu1804` , `ffmpeg:-ubuntu1604`) - ubuntu based nvidia images `ffmpeg:-nvidia` or `ffmpeg:-nvidia2004` (old versions with `ffmpeg:-nvidia1804`, `ffmpeg:-nvidia1604`) - ubuntu based vaapi images `ffmpeg:-vaapi1804` or `ffmpeg:-vaapi2004` (old versions with `ffmpeg:-vaapi1804`, `ffmpeg:-nvidia1604`) -`` can be one of the following: -- 3.2 -- 3.3 -- 3.4 -- 4.0 -- 4.1 -- 4.2 -- 4.3 -- 4.4 +
+ +### Philosophy behind the different builds +**ubuntu2404** +We chose Ubuntu 24.04 because it is the LTS ( Long Term Support ) build of Ubuntu. +We used the ffmpeg support libraries from the Ubuntu distrobution where possible. Example: we use 'libx264-dev' as the package to install. We do not tie it to a version. This way when its time to update from 24.04 to 26.04 we can simply update the base Docker template for ubuntu. This will make updating the OS easier as time goes on. +**ubuntu2404-edge** +This image is just like the above `ubuntu2404` container image, except we build all of the ffmpeg support libraries. This is in the spirit of the original intent of this project `jrottenberg/ffmpeg` alltogether. Building everything that ffmpeg needs, and ffmpeg itself from source. This gives us the most control over all of the details of release. The drawback of this is that its much harder to keep updated. The thought process of having both 'Ubuntu-2404' and 'Ubuntu-2404-edge' is that it makes updating the OS easier over time. +**vaapi2404** + This release is like also `ubuntu2404` but enables: [Video Acceleration API (VAAPI)](https://trac.ffmpeg.org/wiki/HWAccelIntro#VAAPI) when building ffmpeg +**nvidia2204-edge** + This release is like also `ubuntu2404` but enables: [NVIDIA's hardware-accelerated encoding and decoding APIs](https://trac.ffmpeg.org/wiki/HWAccelIntro#CUDANVENCNVDEC) enabled +**alpine320** +[alpine](https://alpinelinux.org/releases/) uses the os vendor libs, but ffmpeg is built from source. -### Generate list of recent images +**scratch** +Scratch is also an [alpine](https://alpinelinux.org/releases/) image. We build the vendor libs, and ffmpeg from source. Also we make the distro as small as possible by not installing any packages in base and striping symbols of installed libs. + +### Generate list of recent Docker Container Images You can use the following command to generate a list of current images: ```bash -$ curl --silent https://hub.docker.com/v2/repositories/jrottenberg/ffmpeg/tags/?page_size=500 | jq -cr ".results|sort_by(.name)|reverse[]|.sz=(.full_size/1048576|floor|tostring+\"mb\")|[.name,( (20-(.name|length))*\" \" ),.sz,( (8-(.sz|length))*\" \"),.last_updated[:10]]|@text|gsub(\"[,\\\"\\\]\\\[]\";null)" +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install requests +$ python3 ./generate-list-of-recent-images.py > list_of_recent_images.txt +$ deactivate +$ rm -rf .venv +$ less list_of_recent_images.txt ``` If you want to compare the one you have locally, use the following command: @@ -218,35 +252,69 @@ Full hardware acceleration example: ##### See what's inside the beast ```bash -docker run -it --entrypoint='bash' jrottenberg/ffmpeg:4.4-ubuntu - +docker run -it --entrypoint='bash' jrottenberg/ffmpeg:7.1-ubuntu2404 for i in ogg amr vorbis theora mp3lame opus vpx xvid fdk x264 x265;do echo $i; find /usr/local/ -name *$i*;done ``` +Libs are in `/lib` in alpine. +```bash +docker run -it --entrypoint='sh' jrottenberg/ffmpeg:7.1-alpine320 +for i in ogg amr vorbis theora mp3lame opus vpx xvid fdk x264 x265;do echo $i; find /lib/ -name *$i*;done +``` + + +## FFMPEG Supported Libraries +The following libraries are used by FFMPEG. The version number and release date are provided along with the license information. +These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'. +These libs are included in the package images as well, but the version numbers might vary slightly. +| Libraries | Version | Release Date | License | +|-----------|---------|--------------|---------| +| [ffmpeg](http://ffmpeg.org/) | [7.1](http://ffmpeg.org/releases/) | | [GNU Lesser General Public License (LGPL) version 2.1](https://ffmpeg.org/legal.html)| +| [libogg](https://www.xiph.org/ogg/) | [1.3.4](https://xiph.org/downloads/) | 08-2019 | [BSD-style license](https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD)| +| [libopencore-amr](https://sourceforge.net/projects/opencore-amr/) | [0.1.6](https://sourceforge.net/projects/opencore-amr/files/opencore-amr/) | 08-2022 | [Apache License](https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE)| + + +See `generate-source-of-truth-ffmpeg-versions.py` to update a version + +## FFMPEG Supported Libraries +The following libraries are used by FFMPEG. The version number and release date are provided along with the license information. +These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'. +These libs are included in the package images as well, but the version numbers might vary slightly. + +| Libraries | Version | Release Date | Download Source | Checksum | License | +|-----------|---------|--------------|------------ | --- | ---------| +| [libopencore-amr](https://sourceforge.net/projects/opencore-amr/) | [0.1.6](https://sourceforge.net/projects/opencore-amr/files/opencore-amr/) | 2022-08-01 | [opencore-amr-0.1.6.tar.gz](https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-0.1.6.tar.gz) | No | [Apache License](https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE) | +| [libx264](https://www.videolan.org/developers/x264.html) | [20191217-2245-stable](https://download.videolan.org/pub/videolan/x264/snapshots/) | 2019-12-17 | [x264-snapshot-20191217-2245-stable.tar.bz2](https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20191217-2245-stable.tar.bz2) | No | [GNU General Public License (GPL) version 2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) | +| [libx265](http://x265.org/) | [4.0](http://ftp.videolan.org/pub/videolan/x265/) | 2024-09-13 | [x265_4.0.tar.gz](http://ftp.videolan.org/pub/videolan/x265/x265_4.0.tar.gz) | No | [GNU General Public License (GPL) version 2](https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING) | +| [libogg](https://www.xiph.org/ogg/) | [1.3.5](https://xiph.org/downloads/) | 2021-06-04 | [libogg-1.3.5.tar.gz](https://downloads.xiph.org/releases/ogg/libogg-1.3.5.tar.gz) | No | [BSD-style license](https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD) | +| [libopus](https://www.opus-codec.org/) | [1.5.2](https://www.opus-codec.org/downloads/) | 2024-04-12 | [opus-1.5.2.tar.gz](https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz) | Yes | [BSD-style license](https://www.xiph.org/licenses/bsd/) | +| [libvorbis](https://xiph.org/vorbis/) | [1.3.7](https://xiph.org/downloads/) | 2020-07-04 | [libvorbis-1.3.7.tar.gz](http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.gz) | Yes | [BSD-style license](https://www.xiph.org/licenses/bsd/) | +| [libvpx](https://www.webmproject.org/code/) | [1.14.1](https://chromium.googlesource.com/webm/libvpx.git/) | 2024-05-30 | | No | [BSD-style license](https://github.com/webmproject/libvpx/blob/master/LICENSE) | +| [libwebp](https://developers.google.com/speed/webp/) | [1.4.0](https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html) | 2024-04-13 | [libwebp-1.4.0.tar.gz](https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.4.0.tar.gz) | No | [BSD-style license](https://github.com/webmproject/libvpx/blob/master/LICENSE) | +| [libmp3lame](http://lame.sourceforge.net/) | [3.100](http://lame.sourceforge.net/download.php) | 2017-10-13 | [lame-3.100.tar.gz](https://sourceforge.net/projects/lame/files/lame/3.100/lame-3.100.tar.gz) | No | [GNU Lesser General Public License (LGPL) version 2.1](http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9) | +| [libxvid](https://www.xvid.com/) | [1.3.7](https://labs.xvid.com/source/) | 2019 | [xvidcore-1.3.7.tar.gz](https://downloads.xvid.com/downloads/xvidcore-1.3.7.tar.gz) | No | [GNU General Public Licence (GPL) version 2](http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851) | +| [libfdk-aac](https://github.com/mstorsjo/fdk-aac) | [2.0.3](https://github.com/mstorsjo/fdk-aac/tags) | 2023-12-21 | [fdk-aac-2.0.3.tar.gz](https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v2.0.3.tar.gz) | No | [Liberal but not a license of patented technologies](https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE) | +| [openjpeg](https://github.com/uclouvain/openjpeg) | [2.5.2](https://github.com/uclouvain/openjpeg/releases) | 2024-02-28 | [openjpeg-2.5.2.tar.gz](https://github.com/uclouvain/openjpeg/archive/refs/tags/v2.5.2.tar.gz) | No | [BSD-style license](https://github.com/uclouvain/openjpeg/blob/master/LICENSE) | +| [freetype](https://www.freetype.org/) | [2.13.3](http://download.savannah.gnu.org/releases/freetype/) | 2024-08-12 | [freetype-2.13.3.tar.gz](http://download.savannah.gnu.org/releases/freetype/freetype-2.13.3.tar.gz) | No | [GNU General Public License (GPL) version 2](https://www.freetype.org/license.html) | +| [libvidstab](https://github.com/georgmartius/vid.stab) | [1.1.1](https://github.com/georgmartius/vid.stab/tags) | 2022-05-30 | [vid.stab-1.1.1.tar.gz](https://github.com/georgmartius/vid.stab/archive/v1.1.1.tar.gz) | No | [GNU General Public License (GPL) version 2](https://github.com/georgmartius/vid.stab/blob/master/LICENSE) | +| [fontconfig](https://www.freedesktop.org/wiki/Software/fontconfig/) | [2.15.0](https://www.freedesktop.org/software/fontconfig/release/) | 2023-12-22 | [fontconfig-2.15.0.tar.gz](https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.15.0.tar.gz) | No | []() | +| [kvazaar](https://github.com/ultravideo/kvazaar) | [2.3.1](https://github.com/ultravideo/kvazaar/releases) | 2024-04-10 | [kvazaar-2.3.1.tar.gz](https://github.com/ultravideo/kvazaar/releases/download/v2.3.1/kvazaar-2.3.1.tar.gz) | No | [BSD 3-Clause](https://github.com/ultravideo/kvazaar/blob/master/LICENSE`) | +| [aom](https://aomedia.googlesource.com/aom) | [3.10.0](https://aomedia.googlesource.com/aom/+refs) | 2024-08-01 | | No | [Alliance for Open Media](https://aomedia.org/license/software-license/) | +| [nvidia-codec-headers](https://github.com/FFmpeg/nv-codec-headers) | [12.2.72.0]() | 2024-03-31 | [nv-codec-headers-12.2.72.0.tar.gz](https://github.com/FFmpeg/nv-codec-headers/releases/download/n12.2.72.0/nv-codec-headers-12.2.72.0.tar.gz) | No | []() | +| [libsvtav1](https://gitlab.com/AOMediaCodec/SVT-AV1) | [2.2.1](https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags) | 2024-08-01 | [SVT-AV1-v2.2.1.tar.gz](https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v2.2.1/SVT-AV1-v2.2.1.tar.gz) | No | [BSD 3-Clause Clear License](https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads) | +| [xproto](https://www.x.org/releases/individual/proto/) | [7.0.31](https://www.x.org/releases/individual/proto/) | 2016-09-23 | [xproto-7.0.31.tar.gz](https://www.x.org/releases/individual/proto/xproto-7.0.31.tar.gz) | No | [The MIT License](https://opensource.org/licenses/MIT) | +| [libpthread-stubs](https://www.x.org/releases/individual/lib/) | [0.5](https://www.x.org/releases/individual/lib/) | 2023-07-18 | [libpthread-stubs-0.5.tar.xz](https://www.x.org/releases/individual/lib/libpthread-stubs-0.5.tar.xz) | No | [The MIT License](https://opensource.org/licenses/MIT) | +| [libbluray](https://www.videolan.org/developers/libbluray.html) | [1.3.4](https://download.videolan.org/pub/videolan/libbluray/) | 2022-11-26 | [libbluray-1.3.4.tar.bz2](https://download.videolan.org/pub/videolan/libbluray/1.3.4/libbluray-1.3.4.tar.bz2) | No | [GNU General Public License (GPL) version 2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) | +| [libzmq](https://github.com/zeromq/libzmq/) | [4.3.5](https://github.com/zeromq/libzmq/releases/) | 2023-10-9 | [zeromq-4.3.5.tar.gz](https://github.com/zeromq/libzmq/releases/download/v4.3.5/zeromq-4.3.5.tar.gz) | No | [Mozilla Public License (MPL) version 2.0](https://github.com/zeromq/libzmq/blob/v4.3.5/LICENSE) | +| [libaribb24](https://github.com/nkoriyama/aribb24/) | [1.0.3](https://github.com/nkoriyama/aribb24/releases) | 2014-08-18 | [aribb24-v1.0.3.tar.gz](https://github.com/nkoriyama/aribb24/archive/refs/tags/v1.0.3.tar.gz) | No | [GNU Lesser General Public License (LGPL) version 2.1 or newer](https://github.com/nkoriyama/aribb24/issues/9) | +| [zimg](https://github.com/sekrit-twc/zimg) | [3.0.5](https://github.com/sekrit-twc/zimg/releases) | 2023-6-30 | [zimg-3.0.5.tar.gz](https://github.com/sekrit-twc/zimg/archive/refs/tags/release-3.0.5.tar.gz) | No | [WTFPL](https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file) | +| [libtheora](https://xiph.org/downloads/) | [1.1.1](https://xiph.org/downloads/) | 2010-01-25 | [libtheora-1.1.1.tar.gz](https://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz) | No | [BSD-style license](https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD) | +| [libsrt](https://github.com/Haivision/srt) | [1.5.3](https://github.com/Haivision/srt/releases/) | 2023-09-07 | [srt-v1.5.3.tar.gz](https://github.com/Haivision/srt/archive/refs/tags/v1.5.3.tar.gz) | No | [Mozilla Public License (MPL) version 2.0](https://github.com/Haivision/srt/blob/master/LICENSE) | +| [libvmaf](https://github.com/Netflix/vmaf) | [3.0.0](https://github.com/Netflix/vmaf/releases) | 2023-12-07 | [vmaf-v3.0.0.tar.gz](https://github.com/Netflix/vmaf/archive/refs/tags/v3.0.0.tar.gz) | No | [BSD-2-Clause](https://github.com/Netflix/vmaf/blob/master/LICENSE) | +| [ffmpeg-7.1](http://ffmpeg.org/) | [7.1](http://ffmpeg.org/releases/) | 2024-09-30 | [ffmpeg-7.1.tar.bz2](https://ffmpeg.org/releases/ffmpeg-7.1.tar.bz2) | No | [GNU Lesser General Public License (LGPL) version 2.1](https://ffmpeg.org/legal.html) | +| [ffmpeg-7.0](http://ffmpeg.org/) | [7.0](http://ffmpeg.org/releases/) | 2024-04-05 | [ffmpeg-7.0.tar.bz2](https://ffmpeg.org/releases/ffmpeg-7.0.tar.bz2) | No | [GNU Lesser General Public License (LGPL) version 2.1](https://ffmpeg.org/legal.html) | +| [ffmpeg-6.1](http://ffmpeg.org/) | [6.1](http://ffmpeg.org/releases/) | 2023-11-11 | [ffmpeg-6.1.tar.bz2](https://ffmpeg.org/releases/ffmpeg-6.1.tar.bz2) | No | [GNU Lesser General Public License (LGPL) version 2.1](https://ffmpeg.org/legal.html) | + -## Keep up to date - -See Dockerfile-env to update a version - -- [FFMPEG_VERSION](http://ffmpeg.org/releases/): [GNU Lesser General Public License (LGPL) version 2.1](https://ffmpeg.org/legal.html) -- [OGG_VERSION](https://xiph.org/downloads/): [BSD-style license](https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD) -- [OPENCOREAMR_VERSION](https://sourceforge.net/projects/opencore-amr/files/opencore-amr/): [Apache License](https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE) -- [VORBIS_VERSION](https://xiph.org/downloads/): [BSD-style license](https://git.xiph.org/?p=mirrors/vorbis.git;a=blob_plain;f=COPYING;hb=HEAD) -- [THEORA_VERSION](https://xiph.org/downloads/): [BSD-style license](https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD) -- [LAME_VERSION](http://lame.sourceforge.net/download.php): [GNU Lesser General Public License (LGPL) version 2.1](http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9) -- [OPUS_VERSION](https://www.opus-codec.org/downloads/): [BSD-style license](https://www.opus-codec.org/license/) -- [VPX_VERSION](https://github.com/webmproject/libvpx/releases): [BSD-style license](https://github.com/webmproject/libvpx/blob/master/LICENSE) -- [WEBP_VERSION](https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html): [BSD-style license](https://github.com/webmproject/libvpx/blob/master/LICENSE) -- [XVID_VERSION](https://labs.xvid.com/source/): [GNU General Public Licence (GPL) version 2](http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851) -- [FDKAAC_VERSION](https://github.com/mstorsjo/fdk-aac/releases): [Liberal but not a license of patented technologies](https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE) -- [FREETYPE_VERSION](http://download.savannah.gnu.org/releases/freetype/): [GNU General Public License (GPL) version 2](https://www.freetype.org/license.html) -- [LIBVIDSTAB_VERSION](https://github.com/georgmartius/vid.stab/releases): [GNU General Public License (GPL) version 2](https://github.com/georgmartius/vid.stab/blob/master/LICENSE) -- [LIBFRIDIBI_VERSION](https://www.fribidi.org/): [GNU General Public License (GPL) version 2](https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING) -- [X264_VERSION](http://www.videolan.org/developers/x264.html): [GNU General Public License (GPL) version 2](https://git.videolan.org/?p=x264.git;a=blob_plain;f=COPYING;hb=HEAD) -- [X265_VERSION](https://bitbucket.org/multicoreware/x265/downloads/): [GNU General Public License (GPL) version 2](https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING) -- [LIBZMQ_VERSION](https://github.com/zeromq/libzmq/releases/): [GNU Lesser General Public License (LGPL) version 3.0](https://github.com/zeromq/libzmq/blob/v4.3.2/COPYING.LESSER) -- [LIBSRT_VERSION](https://github.com/Haivision/srt/releases/): [MPL-2.0](https://github.com/Haivision/srt/blob/master/LICENSE) -- [LIBPNG_VERSION](https://sourceforge.net/projects/libpng/files/): [zlib/libpng License](https://sourceforge.net/p/libpng/code/ci/master/tree/LICENSE) -- [LIBARIBB24_VERSION](https://github.com/nkoriyama/aribb24/tree/bc45f1406899603033218c2cc6d611ddcc5b3720): [GNU Lesser General Public License (LGPL) version 2.1 or newer](https://github.com/nkoriyama/aribb24/issues/9) ## Contribute diff --git a/build_source.sh b/build_source.sh new file mode 100755 index 000000000..a5e566c16 --- /dev/null +++ b/build_source.sh @@ -0,0 +1,383 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure %%FFMPEG_CONFIG_FLAGS%% && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/5.1/alpine313/Dockerfile b/docker-images/5.1/alpine313/Dockerfile deleted file mode 100644 index 47b6e7808..000000000 --- a/docker-images/5.1/alpine313/Dockerfile +++ /dev/null @@ -1,588 +0,0 @@ -# ffmpeg - http://ffmpeg.org/download.html -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# - -FROM alpine:3.13 AS base - -RUN apk add --no-cache --update libgcc libstdc++ ca-certificates libcrypto1.1 libssl1.1 libgomp expat git - - -FROM base AS build - -WORKDIR /tmp/workdir - -ENV FFMPEG_VERSION=5.1.6 \ - AOM_VERSION=v3.8.1 \ - CHROMAPRINT_VERSION=1.5.0 \ - FDKAAC_VERSION=0.1.5 \ - FONTCONFIG_VERSION=2.12.4 \ - FREETYPE_VERSION=2.10.4 \ - FRIBIDI_VERSION=0.19.7 \ - KVAZAAR_VERSION=2.0.0 \ - LAME_VERSION=3.100 \ - LIBASS_VERSION=0.13.7 \ - LIBPTHREAD_STUBS_VERSION=0.4 \ - LIBVIDSTAB_VERSION=1.1.0 \ - LIBXCB_VERSION=1.13.1 \ - XCBPROTO_VERSION=1.13 \ - OGG_VERSION=1.3.2 \ - OPENCOREAMR_VERSION=0.1.5 \ - OPUS_VERSION=1.2 \ - OPENJPEG_VERSION=2.1.2 \ - PYTHON=python3 \ - THEORA_VERSION=1.1.1 \ - VORBIS_VERSION=1.3.5 \ - VPX_VERSION=1.8.0 \ - WEBP_VERSION=1.0.2 \ - X264_VERSION=20170226-2245-stable \ - X265_VERSION=3.4 \ - XAU_VERSION=1.0.9 \ - XORG_MACROS_VERSION=1.19.2 \ - XPROTO_VERSION=7.0.31 \ - XVID_VERSION=1.3.4 \ - LIBXML2_VERSION=2.9.12 \ - LIBBLURAY_VERSION=1.1.2 \ - LIBZMQ_VERSION=4.3.2 \ - LIBSRT_VERSION=1.4.1 \ - LIBARIBB24_VERSION=1.0.3 \ - LIBPNG_VERSION=1.6.9 \ - LIBVMAF_VERSION=2.1.1 \ - ZIMG_VERSION=3.0.5 \ - SRC=/usr/local - -ARG FREETYPE_SHA256SUM="5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac freetype-2.10.4.tar.gz" -ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz" -ARG LIBASS_SHA256SUM="8fadf294bf701300d4605e6f1d92929304187fca4b8d8a47889315526adbafd7 0.13.7.tar.gz" -ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz" -ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" -ARG LIBBLURAY_SHA256SUM="a3dd452239b100dc9da0d01b30e1692693e2a332a7d29917bf84bb10ea7c0b42 libbluray-1.1.2.tar.bz2" -ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz" -ARG LIBARIBB24_SHA256SUM="f61560738926e57f9173510389634d8c06cabedfa857db4b28fb7704707ff128 v1.0.3.tar.gz" - - -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" -ARG PREFIX="/opt/ffmpeg" -ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64" - - -RUN buildDeps="autoconf \ - automake \ - bash \ - binutils \ - bzip2 \ - cmake \ - coreutils \ - curl \ - diffutils \ - expat-dev \ - file \ - g++ \ - gcc \ - gperf \ - libtool \ - make \ - nasm \ - openssl-dev \ - python3 \ - tar \ - xcb-proto \ - yasm \ - zlib-dev" && \ - apk add --no-cache --update ${buildDeps} -## libvmaf https://github.com/Netflix/vmaf -RUN \ - if which meson || false; then \ - echo "Building VMAF." && \ - DIR=/tmp/vmaf && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Netflix/vmaf/archive/v${LIBVMAF_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBVMAF_VERSION}.tar.gz && \ - cd /tmp/vmaf/libvmaf && \ - meson build --buildtype release --prefix=${PREFIX} && \ - ninja -vC build && \ - ninja -vC build install && \ - mkdir -p ${PREFIX}/share/model/ && \ - cp -r /tmp/vmaf/model/* ${PREFIX}/share/model/ && \ - rm -rf ${DIR}; \ - else \ - echo "VMAF skipped."; \ - fi - -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make && \ - make install && \ - rm -rf ${DIR} -### x265 http://x265.org/ -RUN \ - DIR=/tmp/x265 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/videolan/x265/archive/refs/tags/${X265_VERSION}.tar.gz | \ - tar -zx && \ - cd x265-${X265_VERSION}/build/linux && \ - sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ - sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ - ./multilib.sh && \ - make -C 8bit install && \ - rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make && \ - make install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/lame/files/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make && \ - make install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make && \ - make install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make && \ - make install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make install && \ - rm -rf ${DIR} -## fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ -RUN \ - DIR=/tmp/fontconfig && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libass https://github.com/libass/libass -RUN \ - DIR=/tmp/libass && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/libass/libass/archive/${LIBASS_VERSION}.tar.gz && \ - echo ${LIBASS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${LIBASS_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/aom && \ - git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ - cd ${DIR} ; \ - rm -rf CMakeCache.txt CMakeFiles ; \ - mkdir -p ./aom_build ; \ - cd ./aom_build ; \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ - make ; \ - make install ; \ - rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - - -## libxml2 - for libbluray -RUN \ - DIR=/tmp/libxml2 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/GNOME/libxml2/archive/refs/tags/v${LIBXML2_VERSION}.tar.gz | \ - tar -xz --strip-components=1 && \ - ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libbluray - Requires libxml, freetype, and fontconfig -RUN \ - DIR=/tmp/libbluray && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.videolan.org/pub/videolan/libbluray/${LIBBLURAY_VERSION}/libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - echo ${LIBBLURAY_SHA256SUM} | sha256sum --check && \ - tar -jx --strip-components=1 -f libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libsrt https://github.com/Haivision/srt -RUN \ - DIR=/tmp/srt && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Haivision/srt/archive/v${LIBSRT_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBSRT_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libpng -RUN \ - DIR=/tmp/png && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - git clone https://git.code.sf.net/p/libpng/code ${DIR} -b v${LIBPNG_VERSION} --depth 1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libaribb24 -RUN \ - DIR=/tmp/b24 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/nkoriyama/aribb24/archive/v${LIBARIBB24_VERSION}.tar.gz && \ - echo ${LIBARIBB24_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBARIBB24_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -# zimg https://github.com/sekrit-twc/zimg -RUN \ - DIR=/tmp/zimg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/sekrit-twc/zimg/archive/refs/tags/release-${ZIMG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## Download ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - ./configure --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --extra-libs=-ldl && \ - make ; make install - - - - - -## Build ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && cd ${DIR} && \ - ./configure \ - --disable-debug \ - --disable-doc \ - --disable-ffplay \ - --enable-fontconfig \ - --enable-gpl \ - --enable-libaom \ - --enable-libaribb24 \ - --enable-libass \ - --enable-libbluray \ - --enable-libfdk_aac \ - --enable-libfreetype \ - --enable-libkvazaar \ - --enable-libmp3lame \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-libopenjpeg \ - --enable-libopus \ - --enable-libsrt \ - --enable-libtheora \ - --enable-libvidstab \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libx264 \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libzimg \ - --enable-libzmq \ - --enable-nonfree \ - --enable-openssl \ - --enable-postproc \ - --enable-shared \ - --enable-small \ - --enable-version3 \ - --extra-cflags="-I${PREFIX}/include" \ - --extra-ldflags="-L${PREFIX}/lib" \ - --extra-libs=-ldl \ - --extra-libs=-lpthread \ - --prefix="${PREFIX}" && \ - make clean && \ - make && \ - make install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ - - -RUN \ - ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - mkdir -p /usr/local/include && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - -### Release Stage -FROM base AS release -LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ - org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -COPY --from=build /usr/local /usr/local - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output diff --git a/docker-images/5.1/nvidia2204/Dockerfile b/docker-images/5.1/nvidia2204/Dockerfile deleted file mode 100644 index 32a3acfe5..000000000 --- a/docker-images/5.1/nvidia2204/Dockerfile +++ /dev/null @@ -1,622 +0,0 @@ -# ffmpeg - http://ffmpeg.org/download.html -# -# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# - -FROM nvcr.io/nvidia/cuda:12.3.1-devel-ubuntu22.04 AS devel-base -ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,video -ENV DEBIAN_FRONTEND=noninteractive -WORKDIR /tmp/workdir - -RUN apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 python3 && \ - apt-get autoremove -y && \ - apt-get clean -y - -FROM nvcr.io/nvidia/cuda:12.3.1-runtime-ubuntu22.04 AS runtime-base - -ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,video -ENV DEBIAN_FRONTEND=nonintercative -WORKDIR /tmp/workdir - -RUN apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 libxcb-shape0-dev && \ - apt-get autoremove -y && \ - apt-get clean -y - - -FROM devel-base as build - -ENV NVIDIA_HEADERS_VERSION=11.1.5.3 - -ENV FFMPEG_VERSION=5.1.6 \ - AOM_VERSION=v3.8.1 \ - CHROMAPRINT_VERSION=1.5.0 \ - FDKAAC_VERSION=0.1.5 \ - FONTCONFIG_VERSION=2.12.4 \ - FREETYPE_VERSION=2.10.4 \ - FRIBIDI_VERSION=0.19.7 \ - KVAZAAR_VERSION=2.0.0 \ - LAME_VERSION=3.100 \ - LIBASS_VERSION=0.13.7 \ - LIBPTHREAD_STUBS_VERSION=0.4 \ - LIBVIDSTAB_VERSION=1.1.0 \ - LIBXCB_VERSION=1.13.1 \ - XCBPROTO_VERSION=1.13 \ - OGG_VERSION=1.3.2 \ - OPENCOREAMR_VERSION=0.1.5 \ - OPUS_VERSION=1.2 \ - OPENJPEG_VERSION=2.1.2 \ - PYTHON=python3 \ - THEORA_VERSION=1.1.1 \ - VORBIS_VERSION=1.3.5 \ - VPX_VERSION=1.8.0 \ - WEBP_VERSION=1.0.2 \ - X264_VERSION=20170226-2245-stable \ - X265_VERSION=3.4 \ - XAU_VERSION=1.0.9 \ - XORG_MACROS_VERSION=1.19.2 \ - XPROTO_VERSION=7.0.31 \ - XVID_VERSION=1.3.4 \ - LIBXML2_VERSION=2.9.12 \ - LIBBLURAY_VERSION=1.1.2 \ - LIBZMQ_VERSION=4.3.2 \ - LIBSRT_VERSION=1.4.1 \ - LIBARIBB24_VERSION=1.0.3 \ - LIBPNG_VERSION=1.6.9 \ - LIBVMAF_VERSION=2.1.1 \ - ZIMG_VERSION=3.0.5 \ - SRC=/usr/local - -ARG FREETYPE_SHA256SUM="5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac freetype-2.10.4.tar.gz" -ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz" -ARG LIBASS_SHA256SUM="8fadf294bf701300d4605e6f1d92929304187fca4b8d8a47889315526adbafd7 0.13.7.tar.gz" -ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz" -ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" -ARG LIBBLURAY_SHA256SUM="a3dd452239b100dc9da0d01b30e1692693e2a332a7d29917bf84bb10ea7c0b42 libbluray-1.1.2.tar.bz2" -ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz" -ARG LIBARIBB24_SHA256SUM="f61560738926e57f9173510389634d8c06cabedfa857db4b28fb7704707ff128 v1.0.3.tar.gz" - - -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" -ARG PREFIX="/opt/ffmpeg" -ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64" - - -RUN buildDeps="autoconf \ - automake \ - cmake \ - curl \ - bzip2 \ - libexpat1-dev \ - g++ \ - gcc \ - git \ - gperf \ - libtool \ - make \ - nasm \ - perl \ - pkg-config \ - python3 \ - libssl-dev \ - yasm \ - zlib1g-dev" && \ - apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ${buildDeps} - -RUN \ - DIR=/tmp/nv-codec-headers && \ - git clone https://github.com/FFmpeg/nv-codec-headers ${DIR} && \ - cd ${DIR} && \ - git checkout n${NVIDIA_HEADERS_VERSION} && \ - make PREFIX="${PREFIX}" && \ - make install PREFIX="${PREFIX}" && \ - rm -rf ${DIR} - -## libvmaf https://github.com/Netflix/vmaf -RUN \ - if which meson || false; then \ - echo "Building VMAF." && \ - DIR=/tmp/vmaf && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Netflix/vmaf/archive/v${LIBVMAF_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBVMAF_VERSION}.tar.gz && \ - cd /tmp/vmaf/libvmaf && \ - meson build --buildtype release --prefix=${PREFIX} && \ - ninja -vC build && \ - ninja -vC build install && \ - mkdir -p ${PREFIX}/share/model/ && \ - cp -r /tmp/vmaf/model/* ${PREFIX}/share/model/ && \ - rm -rf ${DIR}; \ - else \ - echo "VMAF skipped."; \ - fi - -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make && \ - make install && \ - rm -rf ${DIR} -### x265 http://x265.org/ -RUN \ - DIR=/tmp/x265 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/videolan/x265/archive/refs/tags/${X265_VERSION}.tar.gz | \ - tar -zx && \ - cd x265-${X265_VERSION}/build/linux && \ - sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ - sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ - ./multilib.sh && \ - make -C 8bit install && \ - rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make && \ - make install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/lame/files/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make && \ - make install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make && \ - make install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make && \ - make install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make install && \ - rm -rf ${DIR} -## fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ -RUN \ - DIR=/tmp/fontconfig && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libass https://github.com/libass/libass -RUN \ - DIR=/tmp/libass && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/libass/libass/archive/${LIBASS_VERSION}.tar.gz && \ - echo ${LIBASS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${LIBASS_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/aom && \ - git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ - cd ${DIR} ; \ - rm -rf CMakeCache.txt CMakeFiles ; \ - mkdir -p ./aom_build ; \ - cd ./aom_build ; \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ - make ; \ - make install ; \ - rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - - -## libxml2 - for libbluray -RUN \ - DIR=/tmp/libxml2 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/GNOME/libxml2/archive/refs/tags/v${LIBXML2_VERSION}.tar.gz | \ - tar -xz --strip-components=1 && \ - ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libbluray - Requires libxml, freetype, and fontconfig -RUN \ - DIR=/tmp/libbluray && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.videolan.org/pub/videolan/libbluray/${LIBBLURAY_VERSION}/libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - echo ${LIBBLURAY_SHA256SUM} | sha256sum --check && \ - tar -jx --strip-components=1 -f libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libsrt https://github.com/Haivision/srt -RUN \ - DIR=/tmp/srt && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Haivision/srt/archive/v${LIBSRT_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBSRT_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libpng -RUN \ - DIR=/tmp/png && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - git clone https://git.code.sf.net/p/libpng/code ${DIR} -b v${LIBPNG_VERSION} --depth 1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libaribb24 -RUN \ - DIR=/tmp/b24 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/nkoriyama/aribb24/archive/v${LIBARIBB24_VERSION}.tar.gz && \ - echo ${LIBARIBB24_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBARIBB24_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -# zimg https://github.com/sekrit-twc/zimg -RUN \ - DIR=/tmp/zimg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/sekrit-twc/zimg/archive/refs/tags/release-${ZIMG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## Download ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - ./configure --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --extra-libs=-ldl && \ - make ; make install - - - - - -## Build ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && cd ${DIR} && \ - ./configure \ - --disable-debug \ - --disable-doc \ - --disable-ffplay \ - --enable-cuda \ - --enable-cuvid \ - --enable-fontconfig \ - --enable-gpl \ - --enable-libaom \ - --enable-libaribb24 \ - --enable-libass \ - --enable-libbluray \ - --enable-libfdk_aac \ - --enable-libfreetype \ - --enable-libkvazaar \ - --enable-libmp3lame \ - --enable-libnpp \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-libopenjpeg \ - --enable-libopus \ - --enable-libsrt \ - --enable-libtheora \ - --enable-libvidstab \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libx264 \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libzimg \ - --enable-libzmq \ - --enable-nonfree \ - --enable-nvenc \ - --enable-openssl \ - --enable-postproc \ - --enable-shared \ - --enable-small \ - --enable-version3 \ - --extra-cflags="-I${PREFIX}/include -I${PREFIX}/include/ffnvcodec -I/usr/local/cuda/include/" \ - --extra-ldflags="-L${PREFIX}/lib -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib32/" \ - --extra-libs=-ldl \ - --extra-libs=-lpthread \ - --prefix="${PREFIX}" && \ - make clean && \ - make && \ - make install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ - -## cleanup -RUN \ - LD_LIBRARY_PATH="${PREFIX}/lib:${PREFIX}/lib64:${LD_LIBRARY_PATH}" ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/* /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - - - -FROM runtime-base AS release -LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ - org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -# copy only needed files, without copying nvidia dev files -COPY --from=build /usr/local/bin /usr/local/bin/ -COPY --from=build /usr/local/share /usr/local/share/ -COPY --from=build /usr/local/lib /usr/local/lib/ -COPY --from=build /usr/local/include /usr/local/include/ - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output diff --git a/docker-images/5.1/ubuntu2204/Dockerfile b/docker-images/5.1/ubuntu2204/Dockerfile deleted file mode 100644 index 35ba7092b..000000000 --- a/docker-images/5.1/ubuntu2204/Dockerfile +++ /dev/null @@ -1,590 +0,0 @@ -# ffmpeg - http://ffmpeg.org/download.html -# -# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# -FROM ubuntu:20.04 AS base - -WORKDIR /tmp/workdir - -RUN apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 && \ - apt-get autoremove -y && \ - apt-get clean -y - -FROM base as build - -ENV FFMPEG_VERSION=5.1.6 \ - AOM_VERSION=v3.8.1 \ - CHROMAPRINT_VERSION=1.5.0 \ - FDKAAC_VERSION=0.1.5 \ - FONTCONFIG_VERSION=2.12.4 \ - FREETYPE_VERSION=2.10.4 \ - FRIBIDI_VERSION=0.19.7 \ - KVAZAAR_VERSION=2.0.0 \ - LAME_VERSION=3.100 \ - LIBASS_VERSION=0.13.7 \ - LIBPTHREAD_STUBS_VERSION=0.4 \ - LIBVIDSTAB_VERSION=1.1.0 \ - LIBXCB_VERSION=1.13.1 \ - XCBPROTO_VERSION=1.13 \ - OGG_VERSION=1.3.2 \ - OPENCOREAMR_VERSION=0.1.5 \ - OPUS_VERSION=1.2 \ - OPENJPEG_VERSION=2.1.2 \ - PYTHON=python3 \ - THEORA_VERSION=1.1.1 \ - VORBIS_VERSION=1.3.5 \ - VPX_VERSION=1.8.0 \ - WEBP_VERSION=1.0.2 \ - X264_VERSION=20170226-2245-stable \ - X265_VERSION=3.4 \ - XAU_VERSION=1.0.9 \ - XORG_MACROS_VERSION=1.19.2 \ - XPROTO_VERSION=7.0.31 \ - XVID_VERSION=1.3.4 \ - LIBXML2_VERSION=2.9.12 \ - LIBBLURAY_VERSION=1.1.2 \ - LIBZMQ_VERSION=4.3.2 \ - LIBSRT_VERSION=1.4.1 \ - LIBARIBB24_VERSION=1.0.3 \ - LIBPNG_VERSION=1.6.9 \ - LIBVMAF_VERSION=2.1.1 \ - ZIMG_VERSION=3.0.5 \ - SRC=/usr/local - -ARG FREETYPE_SHA256SUM="5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac freetype-2.10.4.tar.gz" -ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz" -ARG LIBASS_SHA256SUM="8fadf294bf701300d4605e6f1d92929304187fca4b8d8a47889315526adbafd7 0.13.7.tar.gz" -ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz" -ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" -ARG LIBBLURAY_SHA256SUM="a3dd452239b100dc9da0d01b30e1692693e2a332a7d29917bf84bb10ea7c0b42 libbluray-1.1.2.tar.bz2" -ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz" -ARG LIBARIBB24_SHA256SUM="f61560738926e57f9173510389634d8c06cabedfa857db4b28fb7704707ff128 v1.0.3.tar.gz" - - -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" -ARG PREFIX="/opt/ffmpeg" -ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64" - - -ARG DEBIAN_FRONTEND=noninteractive - -RUN buildDeps="autoconf \ - automake \ - cmake \ - curl \ - bzip2 \ - libexpat1-dev \ - g++ \ - gcc \ - git \ - gperf \ - libtool \ - make \ - meson \ - nasm \ - perl \ - pkg-config \ - python \ - libssl-dev \ - yasm \ - zlib1g-dev" && \ - apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ${buildDeps} -## libvmaf https://github.com/Netflix/vmaf -RUN \ - if which meson || false; then \ - echo "Building VMAF." && \ - DIR=/tmp/vmaf && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Netflix/vmaf/archive/v${LIBVMAF_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBVMAF_VERSION}.tar.gz && \ - cd /tmp/vmaf/libvmaf && \ - meson build --buildtype release --prefix=${PREFIX} && \ - ninja -vC build && \ - ninja -vC build install && \ - mkdir -p ${PREFIX}/share/model/ && \ - cp -r /tmp/vmaf/model/* ${PREFIX}/share/model/ && \ - rm -rf ${DIR}; \ - else \ - echo "VMAF skipped."; \ - fi - -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make && \ - make install && \ - rm -rf ${DIR} -### x265 http://x265.org/ -RUN \ - DIR=/tmp/x265 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/videolan/x265/archive/refs/tags/${X265_VERSION}.tar.gz | \ - tar -zx && \ - cd x265-${X265_VERSION}/build/linux && \ - sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ - sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ - ./multilib.sh && \ - make -C 8bit install && \ - rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make && \ - make install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/lame/files/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make && \ - make install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make && \ - make install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make && \ - make install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make install && \ - rm -rf ${DIR} -## fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ -RUN \ - DIR=/tmp/fontconfig && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libass https://github.com/libass/libass -RUN \ - DIR=/tmp/libass && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/libass/libass/archive/${LIBASS_VERSION}.tar.gz && \ - echo ${LIBASS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${LIBASS_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/aom && \ - git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ - cd ${DIR} ; \ - rm -rf CMakeCache.txt CMakeFiles ; \ - mkdir -p ./aom_build ; \ - cd ./aom_build ; \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ - make ; \ - make install ; \ - rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - - -## libxml2 - for libbluray -RUN \ - DIR=/tmp/libxml2 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/GNOME/libxml2/archive/refs/tags/v${LIBXML2_VERSION}.tar.gz | \ - tar -xz --strip-components=1 && \ - ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libbluray - Requires libxml, freetype, and fontconfig -RUN \ - DIR=/tmp/libbluray && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.videolan.org/pub/videolan/libbluray/${LIBBLURAY_VERSION}/libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - echo ${LIBBLURAY_SHA256SUM} | sha256sum --check && \ - tar -jx --strip-components=1 -f libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libsrt https://github.com/Haivision/srt -RUN \ - DIR=/tmp/srt && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Haivision/srt/archive/v${LIBSRT_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBSRT_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libpng -RUN \ - DIR=/tmp/png && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - git clone https://git.code.sf.net/p/libpng/code ${DIR} -b v${LIBPNG_VERSION} --depth 1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libaribb24 -RUN \ - DIR=/tmp/b24 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/nkoriyama/aribb24/archive/v${LIBARIBB24_VERSION}.tar.gz && \ - echo ${LIBARIBB24_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBARIBB24_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -# zimg https://github.com/sekrit-twc/zimg -RUN \ - DIR=/tmp/zimg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/sekrit-twc/zimg/archive/refs/tags/release-${ZIMG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## Download ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - ./configure --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --extra-libs=-ldl && \ - make ; make install - - - - - -## Build ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && cd ${DIR} && \ - ./configure \ - --disable-debug \ - --disable-doc \ - --disable-ffplay \ - --enable-fontconfig \ - --enable-gpl \ - --enable-libaom \ - --enable-libaribb24 \ - --enable-libass \ - --enable-libbluray \ - --enable-libfdk_aac \ - --enable-libfreetype \ - --enable-libkvazaar \ - --enable-libmp3lame \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-libopenjpeg \ - --enable-libopus \ - --enable-libsrt \ - --enable-libtheora \ - --enable-libvidstab \ - --enable-libvmaf \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libx264 \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libzimg \ - --enable-libzmq \ - --enable-nonfree \ - --enable-openssl \ - --enable-postproc \ - --enable-shared \ - --enable-small \ - --enable-version3 \ - --extra-cflags="-I${PREFIX}/include" \ - --extra-ldflags="-L${PREFIX}/lib" \ - --extra-libs=-ldl \ - --extra-libs=-lpthread \ - --prefix="${PREFIX}" && \ - make clean && \ - make && \ - make install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ - -## cleanup -RUN \ - ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - -FROM base AS release -LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ - org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -COPY --from=build /usr/local /usr/local/ - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output diff --git a/docker-images/5.1/vaapi2204/Dockerfile b/docker-images/5.1/vaapi2204/Dockerfile deleted file mode 100644 index 384e64f41..000000000 --- a/docker-images/5.1/vaapi2204/Dockerfile +++ /dev/null @@ -1,596 +0,0 @@ -# ffmpeg - http://ffmpeg.org/download.html -# -# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# -FROM ubuntu:22.04 AS base - -WORKDIR /tmp/workdir - -RUN apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 && \ - apt-get autoremove -y && \ - apt-get clean -y - -FROM base as build - -ENV FFMPEG_VERSION=5.1.6 \ - AOM_VERSION=v3.8.1 \ - CHROMAPRINT_VERSION=1.5.0 \ - FDKAAC_VERSION=0.1.5 \ - FONTCONFIG_VERSION=2.12.4 \ - FREETYPE_VERSION=2.10.4 \ - FRIBIDI_VERSION=0.19.7 \ - KVAZAAR_VERSION=2.0.0 \ - LAME_VERSION=3.100 \ - LIBASS_VERSION=0.13.7 \ - LIBPTHREAD_STUBS_VERSION=0.4 \ - LIBVIDSTAB_VERSION=1.1.0 \ - LIBXCB_VERSION=1.13.1 \ - XCBPROTO_VERSION=1.13 \ - OGG_VERSION=1.3.2 \ - OPENCOREAMR_VERSION=0.1.5 \ - OPUS_VERSION=1.2 \ - OPENJPEG_VERSION=2.1.2 \ - PYTHON=python3 \ - THEORA_VERSION=1.1.1 \ - VORBIS_VERSION=1.3.5 \ - VPX_VERSION=1.8.0 \ - WEBP_VERSION=1.0.2 \ - X264_VERSION=20170226-2245-stable \ - X265_VERSION=3.4 \ - XAU_VERSION=1.0.9 \ - XORG_MACROS_VERSION=1.19.2 \ - XPROTO_VERSION=7.0.31 \ - XVID_VERSION=1.3.4 \ - LIBXML2_VERSION=2.9.12 \ - LIBBLURAY_VERSION=1.1.2 \ - LIBZMQ_VERSION=4.3.2 \ - LIBSRT_VERSION=1.4.1 \ - LIBARIBB24_VERSION=1.0.3 \ - LIBPNG_VERSION=1.6.9 \ - LIBVMAF_VERSION=2.1.1 \ - ZIMG_VERSION=3.0.5 \ - SRC=/usr/local - -ARG FREETYPE_SHA256SUM="5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac freetype-2.10.4.tar.gz" -ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz" -ARG LIBASS_SHA256SUM="8fadf294bf701300d4605e6f1d92929304187fca4b8d8a47889315526adbafd7 0.13.7.tar.gz" -ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz" -ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" -ARG LIBBLURAY_SHA256SUM="a3dd452239b100dc9da0d01b30e1692693e2a332a7d29917bf84bb10ea7c0b42 libbluray-1.1.2.tar.bz2" -ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz" -ARG LIBARIBB24_SHA256SUM="f61560738926e57f9173510389634d8c06cabedfa857db4b28fb7704707ff128 v1.0.3.tar.gz" - - -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" -ARG PREFIX="/opt/ffmpeg" -ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64" - - -ARG DEBIAN_FRONTEND=noninteractive - -RUN buildDeps="autoconf \ - automake \ - cmake \ - curl \ - bzip2 \ - libexpat1-dev \ - g++ \ - gcc \ - git \ - gperf \ - libtool \ - make \ - meson \ - nasm \ - perl \ - pkg-config \ - libssl-dev \ - yasm \ - libva-dev \ - zlib1g-dev" && \ - apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ${buildDeps} -## libvmaf https://github.com/Netflix/vmaf -RUN \ - if which meson || false; then \ - echo "Building VMAF." && \ - DIR=/tmp/vmaf && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Netflix/vmaf/archive/v${LIBVMAF_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBVMAF_VERSION}.tar.gz && \ - cd /tmp/vmaf/libvmaf && \ - meson build --buildtype release --prefix=${PREFIX} && \ - ninja -vC build && \ - ninja -vC build install && \ - mkdir -p ${PREFIX}/share/model/ && \ - cp -r /tmp/vmaf/model/* ${PREFIX}/share/model/ && \ - rm -rf ${DIR}; \ - else \ - echo "VMAF skipped."; \ - fi - -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make && \ - make install && \ - rm -rf ${DIR} -### x265 http://x265.org/ -RUN \ - DIR=/tmp/x265 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/videolan/x265/archive/refs/tags/${X265_VERSION}.tar.gz | \ - tar -zx && \ - cd x265-${X265_VERSION}/build/linux && \ - sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ - sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ - ./multilib.sh && \ - make -C 8bit install && \ - rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make && \ - make install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/lame/files/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make && \ - make install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make && \ - make install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make && \ - make install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make install && \ - rm -rf ${DIR} -## fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ -RUN \ - DIR=/tmp/fontconfig && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libass https://github.com/libass/libass -RUN \ - DIR=/tmp/libass && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/libass/libass/archive/${LIBASS_VERSION}.tar.gz && \ - echo ${LIBASS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${LIBASS_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/aom && \ - git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ - cd ${DIR} ; \ - rm -rf CMakeCache.txt CMakeFiles ; \ - mkdir -p ./aom_build ; \ - cd ./aom_build ; \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ - make ; \ - make install ; \ - rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - - -## libxml2 - for libbluray -RUN \ - DIR=/tmp/libxml2 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/GNOME/libxml2/archive/refs/tags/v${LIBXML2_VERSION}.tar.gz | \ - tar -xz --strip-components=1 && \ - ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libbluray - Requires libxml, freetype, and fontconfig -RUN \ - DIR=/tmp/libbluray && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.videolan.org/pub/videolan/libbluray/${LIBBLURAY_VERSION}/libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - echo ${LIBBLURAY_SHA256SUM} | sha256sum --check && \ - tar -jx --strip-components=1 -f libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libsrt https://github.com/Haivision/srt -RUN \ - DIR=/tmp/srt && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Haivision/srt/archive/v${LIBSRT_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBSRT_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libpng -RUN \ - DIR=/tmp/png && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - git clone https://git.code.sf.net/p/libpng/code ${DIR} -b v${LIBPNG_VERSION} --depth 1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libaribb24 -RUN \ - DIR=/tmp/b24 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/nkoriyama/aribb24/archive/v${LIBARIBB24_VERSION}.tar.gz && \ - echo ${LIBARIBB24_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBARIBB24_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -# zimg https://github.com/sekrit-twc/zimg -RUN \ - DIR=/tmp/zimg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/sekrit-twc/zimg/archive/refs/tags/release-${ZIMG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## Download ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - ./configure --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --extra-libs=-ldl && \ - make ; make install - - - - - -## Build ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && cd ${DIR} && \ - ./configure \ - --disable-debug \ - --disable-doc \ - --disable-ffplay \ - --enable-fontconfig \ - --enable-gpl \ - --enable-libaom \ - --enable-libaribb24 \ - --enable-libass \ - --enable-libbluray \ - --enable-libfdk_aac \ - --enable-libfreetype \ - --enable-libkvazaar \ - --enable-libmp3lame \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-libopenjpeg \ - --enable-libopus \ - --enable-libsrt \ - --enable-libtheora \ - --enable-libvidstab \ - --enable-libvmaf \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libx264 \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libzimg \ - --enable-libzmq \ - --enable-nonfree \ - --enable-openssl \ - --enable-postproc \ - --enable-shared \ - --enable-small \ - --enable-vaapi \ - --enable-version3 \ - --extra-cflags="-I${PREFIX}/include" \ - --extra-ldflags="-L${PREFIX}/lib" \ - --extra-libs=-ldl \ - --extra-libs=-lpthread \ - --prefix="${PREFIX}" && \ - make clean && \ - make && \ - make install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ - -## cleanup -RUN \ - ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - -FROM base AS release -LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ - org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -COPY --from=build /usr/local /usr/local/ - -RUN \ - apt-get update -y && \ - apt-get install -y --no-install-recommends libva-drm2 libva2 i965-va-driver && \ - rm -rf /var/lib/apt/lists/* - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output diff --git a/docker-images/6.1/alpine320/Dockerfile b/docker-images/6.1/alpine320/Dockerfile new file mode 100644 index 000000000..c45ada3ce --- /dev/null +++ b/docker-images/6.1/alpine320/Dockerfile @@ -0,0 +1,210 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# + +FROM alpine:3.20 AS builder + +RUN apk add --no-cache --update libgcc libstdc++ ca-certificates openssl expat git less tree file vim bash + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + +RUN chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +ENV FFMPEG_VERSION=6.1.2 + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" + + +RUN libDeps="libgomp \ + # https://github.com/zeromq/libzmq/ + zeromq \ + zeromq-dev \ + # https://sourceforge.net/projects/opencore-amr/ + opencore-amr \ + opencore-amr-dev \ + # https://www.xiph.org/ogg/ + libogg \ + libogg-static \ + libogg-dev \ + # libtheora http://www.theora.org/ + libtheora \ + libtheora-static \ + libtheora-dev \ + # http://www.videolan.org/developers/x264.html + x264 \ + x264-libs \ + x264-dev \ + # http://x265.org/ + x265 \ + x265-libs \ + x265-dev \ + # https://www.opus-codec.org/ + opus \ + opus-tools \ + opus-dev \ + # https://xiph.org/vorbis/ + libvorbis \ + libvorbis-static \ + libvorbis-dev \ + # https://www.webmproject.org/code/ + libvpx \ + libvpx-utils \ + libvpx-dev \ + # https://developers.google.com/speed/webp/ + libwebp \ + libwebp-dev \ + libwebp-static \ + libwebp-tools \ + # http://lame.sourceforge.net/ + lame \ + lame-libs \ + lame-dev \ + # https://www.xvid.com/ + xvidcore \ + xvidcore-static \ + xvidcore-dev \ + # https://github.com/mstorsjo/fdk-aac + fdk-aac \ + fdk-aac-dev \ + # https://github.com/uclouvain/openjpeg + openjpeg \ + openjpeg-tools \ + openjpeg-dev \ + # https://www.freetype.org/ + freetype \ + freetype-static \ + freetype-dev \ + # https://github.com/georgmartius/vid.stab + vidstab \ + vidstab-dev \ + ## https://www.fribidi.org/ + fribidi \ + fribidi-static \ + fribidi-dev \ + # fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ + fontconfig \ + fontconfig-static \ + fontconfig-dev \ + # https://github.com/libass/libass + libass \ + libass-dev \ + # https://aomedia.googlesource.com/aom + aom \ + aom-libs \ + aom-dev \ + # https://xcb.freedesktop.org/ + # https://www.x.org/archive//individual/util/util-macros- + util-macros \ + # https://www.x.org/archive/individual/proto/ + xorgproto \ + # https://www.x.org/archive/individual/lib/libXau- + libxau \ + libxau-dev \ + # https://github.com/GNOME/libxml2/ + libxml2 \ + libxml2-static \ + libxml2-utils \ + libxml2-dev \ + # https://github.com/Haivision/srt + libsrt \ + libsrt-progs \ + libsrt-dev \ + # https://git.code.sf.net/p/libpng/code + libpng \ + libpng-static \ + libpng-utils \ + libpng-dev \ + # https://github.com/sekrit-twc/zimg + zimg \ + zimg-dev \ + dav1d \ + libdav1d \ + dav1d-dev \ + svt-av1 \ + svt-av1-dev \ + libSvtAv1Enc \ + libSvtAv1Dec" && \ + apk add --no-cache --update ${libDeps} + + +RUN buildDeps="autoconf \ + automake \ + bash \ + binutils \ + bzip2 \ + cmake \ + coreutils \ + curl \ + wget \ + jq \ + diffutils \ + expat-dev \ + file \ + g++ \ + gcc \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + openssl-dev \ + python3 \ + tar \ + xz \ + xcb-proto \ + yasm \ + zlib-dev \ + alpine-sdk \ + linux-headers" && \ + apk add --no-cache --update ${buildDeps} + +# Note: pass '--library-list lib1,lib2,lib3 for more control. +# Here we have 3 libs that we have to build from source +# vmaf +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar,libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# # libevent && libevent-dev has usr/lib/libevent_pthreads ??? +# ## libbluray - Requires libxml, freetype, and fontconfig +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libpthread-stubs,libbluray,libaribb24 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-6.1 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# when debugging you can pass in || true to the end of the command +# to keep the build going even if one of the steps fails +RUN /tmp/workdir/install_ffmpeg.sh + + +### Release Stage +FROM alpine:3.20 AS release +# RUN apk add --no-cache --update bash less tree file vim +COPY --from=builder /usr/local /usr/local +COPY --from=builder /tmp/fakeroot/ / + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["/bin/ffmpeg"] diff --git a/docker-images/6.1/alpine320/build_source.sh b/docker-images/6.1/alpine320/build_source.sh new file mode 100644 index 000000000..e5d8f57e4 --- /dev/null +++ b/docker-images/6.1/alpine320/build_source.sh @@ -0,0 +1,427 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure --disable-debug \ + --disable-doc \ + --disable-ffplay \ + --enable-fontconfig \ + --enable-gpl \ + --enable-libaom \ + --enable-libaribb24 \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-libfreetype \ + --enable-libkvazaar \ + --enable-libmp3lame \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-libsrt \ + --enable-libsvtav1 \ + --enable-libtheora \ + --enable-libvidstab \ + --enable-libvmaf \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-libzmq \ + --enable-nonfree \ + --enable-openssl \ + --enable-postproc \ + --enable-shared \ + --enable-small \ + --enable-version3 \ + --extra-cflags="-I${PREFIX}/include -I/usr/include/x86_64-linux-gnu" \ + --extra-ldflags="-L${PREFIX}/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib" \ + --extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu \ + --extra-libs=-ldl \ + --extra-libs=-lm \ + --extra-libs=-lpthread \ + --ld=g++ \ + --prefix="${PREFIX}" && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/6.1/alpine320/download_tarballs.sh b/docker-images/6.1/alpine320/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/docker-images/6.1/alpine320/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/docker-images/6.1/alpine320/generate-source-of-truth-ffmpeg-versions.py b/docker-images/6.1/alpine320/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/docker-images/6.1/alpine320/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/docker-images/6.1/alpine320/install_ffmpeg.sh b/docker-images/6.1/alpine320/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/docker-images/6.1/alpine320/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/docker-images/6.1/nvidia2204/Dockerfile b/docker-images/6.1/nvidia2204/Dockerfile deleted file mode 100644 index 4bd0ad8df..000000000 --- a/docker-images/6.1/nvidia2204/Dockerfile +++ /dev/null @@ -1,622 +0,0 @@ -# ffmpeg - http://ffmpeg.org/download.html -# -# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# - -FROM nvcr.io/nvidia/cuda:12.3.1-devel-ubuntu22.04 AS devel-base -ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,video -ENV DEBIAN_FRONTEND=noninteractive -WORKDIR /tmp/workdir - -RUN apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 python3 && \ - apt-get autoremove -y && \ - apt-get clean -y - -FROM nvcr.io/nvidia/cuda:12.3.1-runtime-ubuntu22.04 AS runtime-base - -ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,video -ENV DEBIAN_FRONTEND=nonintercative -WORKDIR /tmp/workdir - -RUN apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 libxcb-shape0-dev && \ - apt-get autoremove -y && \ - apt-get clean -y - - -FROM devel-base as build - -ENV NVIDIA_HEADERS_VERSION=11.1.5.3 - -ENV FFMPEG_VERSION=6.1.2 \ - AOM_VERSION=v3.8.1 \ - CHROMAPRINT_VERSION=1.5.0 \ - FDKAAC_VERSION=0.1.5 \ - FONTCONFIG_VERSION=2.12.4 \ - FREETYPE_VERSION=2.10.4 \ - FRIBIDI_VERSION=0.19.7 \ - KVAZAAR_VERSION=2.0.0 \ - LAME_VERSION=3.100 \ - LIBASS_VERSION=0.13.7 \ - LIBPTHREAD_STUBS_VERSION=0.4 \ - LIBVIDSTAB_VERSION=1.1.0 \ - LIBXCB_VERSION=1.13.1 \ - XCBPROTO_VERSION=1.13 \ - OGG_VERSION=1.3.2 \ - OPENCOREAMR_VERSION=0.1.5 \ - OPUS_VERSION=1.2 \ - OPENJPEG_VERSION=2.1.2 \ - PYTHON=python3 \ - THEORA_VERSION=1.1.1 \ - VORBIS_VERSION=1.3.5 \ - VPX_VERSION=1.8.0 \ - WEBP_VERSION=1.0.2 \ - X264_VERSION=20170226-2245-stable \ - X265_VERSION=3.4 \ - XAU_VERSION=1.0.9 \ - XORG_MACROS_VERSION=1.19.2 \ - XPROTO_VERSION=7.0.31 \ - XVID_VERSION=1.3.4 \ - LIBXML2_VERSION=2.9.12 \ - LIBBLURAY_VERSION=1.1.2 \ - LIBZMQ_VERSION=4.3.2 \ - LIBSRT_VERSION=1.4.1 \ - LIBARIBB24_VERSION=1.0.3 \ - LIBPNG_VERSION=1.6.9 \ - LIBVMAF_VERSION=2.1.1 \ - ZIMG_VERSION=3.0.5 \ - SRC=/usr/local - -ARG FREETYPE_SHA256SUM="5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac freetype-2.10.4.tar.gz" -ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz" -ARG LIBASS_SHA256SUM="8fadf294bf701300d4605e6f1d92929304187fca4b8d8a47889315526adbafd7 0.13.7.tar.gz" -ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz" -ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" -ARG LIBBLURAY_SHA256SUM="a3dd452239b100dc9da0d01b30e1692693e2a332a7d29917bf84bb10ea7c0b42 libbluray-1.1.2.tar.bz2" -ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz" -ARG LIBARIBB24_SHA256SUM="f61560738926e57f9173510389634d8c06cabedfa857db4b28fb7704707ff128 v1.0.3.tar.gz" - - -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" -ARG PREFIX="/opt/ffmpeg" -ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64" - - -RUN buildDeps="autoconf \ - automake \ - cmake \ - curl \ - bzip2 \ - libexpat1-dev \ - g++ \ - gcc \ - git \ - gperf \ - libtool \ - make \ - nasm \ - perl \ - pkg-config \ - python3 \ - libssl-dev \ - yasm \ - zlib1g-dev" && \ - apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ${buildDeps} - -RUN \ - DIR=/tmp/nv-codec-headers && \ - git clone https://github.com/FFmpeg/nv-codec-headers ${DIR} && \ - cd ${DIR} && \ - git checkout n${NVIDIA_HEADERS_VERSION} && \ - make PREFIX="${PREFIX}" && \ - make install PREFIX="${PREFIX}" && \ - rm -rf ${DIR} - -## libvmaf https://github.com/Netflix/vmaf -RUN \ - if which meson || false; then \ - echo "Building VMAF." && \ - DIR=/tmp/vmaf && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Netflix/vmaf/archive/v${LIBVMAF_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBVMAF_VERSION}.tar.gz && \ - cd /tmp/vmaf/libvmaf && \ - meson build --buildtype release --prefix=${PREFIX} && \ - ninja -vC build && \ - ninja -vC build install && \ - mkdir -p ${PREFIX}/share/model/ && \ - cp -r /tmp/vmaf/model/* ${PREFIX}/share/model/ && \ - rm -rf ${DIR}; \ - else \ - echo "VMAF skipped."; \ - fi - -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make && \ - make install && \ - rm -rf ${DIR} -### x265 http://x265.org/ -RUN \ - DIR=/tmp/x265 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/videolan/x265/archive/refs/tags/${X265_VERSION}.tar.gz | \ - tar -zx && \ - cd x265-${X265_VERSION}/build/linux && \ - sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ - sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ - ./multilib.sh && \ - make -C 8bit install && \ - rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make && \ - make install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/lame/files/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make && \ - make install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make && \ - make install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make && \ - make install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make install && \ - rm -rf ${DIR} -## fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ -RUN \ - DIR=/tmp/fontconfig && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libass https://github.com/libass/libass -RUN \ - DIR=/tmp/libass && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/libass/libass/archive/${LIBASS_VERSION}.tar.gz && \ - echo ${LIBASS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${LIBASS_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/aom && \ - git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ - cd ${DIR} ; \ - rm -rf CMakeCache.txt CMakeFiles ; \ - mkdir -p ./aom_build ; \ - cd ./aom_build ; \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ - make ; \ - make install ; \ - rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - - -## libxml2 - for libbluray -RUN \ - DIR=/tmp/libxml2 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/GNOME/libxml2/archive/refs/tags/v${LIBXML2_VERSION}.tar.gz | \ - tar -xz --strip-components=1 && \ - ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libbluray - Requires libxml, freetype, and fontconfig -RUN \ - DIR=/tmp/libbluray && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.videolan.org/pub/videolan/libbluray/${LIBBLURAY_VERSION}/libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - echo ${LIBBLURAY_SHA256SUM} | sha256sum --check && \ - tar -jx --strip-components=1 -f libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libsrt https://github.com/Haivision/srt -RUN \ - DIR=/tmp/srt && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Haivision/srt/archive/v${LIBSRT_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBSRT_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libpng -RUN \ - DIR=/tmp/png && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - git clone https://git.code.sf.net/p/libpng/code ${DIR} -b v${LIBPNG_VERSION} --depth 1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libaribb24 -RUN \ - DIR=/tmp/b24 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/nkoriyama/aribb24/archive/v${LIBARIBB24_VERSION}.tar.gz && \ - echo ${LIBARIBB24_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBARIBB24_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -# zimg https://github.com/sekrit-twc/zimg -RUN \ - DIR=/tmp/zimg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/sekrit-twc/zimg/archive/refs/tags/release-${ZIMG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## Download ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - ./configure --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --extra-libs=-ldl && \ - make ; make install - - - - - -## Build ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && cd ${DIR} && \ - ./configure \ - --disable-debug \ - --disable-doc \ - --disable-ffplay \ - --enable-cuda \ - --enable-cuvid \ - --enable-fontconfig \ - --enable-gpl \ - --enable-libaom \ - --enable-libaribb24 \ - --enable-libass \ - --enable-libbluray \ - --enable-libfdk_aac \ - --enable-libfreetype \ - --enable-libkvazaar \ - --enable-libmp3lame \ - --enable-libnpp \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-libopenjpeg \ - --enable-libopus \ - --enable-libsrt \ - --enable-libtheora \ - --enable-libvidstab \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libx264 \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libzimg \ - --enable-libzmq \ - --enable-nonfree \ - --enable-nvenc \ - --enable-openssl \ - --enable-postproc \ - --enable-shared \ - --enable-small \ - --enable-version3 \ - --extra-cflags="-I${PREFIX}/include -I${PREFIX}/include/ffnvcodec -I/usr/local/cuda/include/" \ - --extra-ldflags="-L${PREFIX}/lib -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib32/" \ - --extra-libs=-ldl \ - --extra-libs=-lpthread \ - --prefix="${PREFIX}" && \ - make clean && \ - make && \ - make install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ - -## cleanup -RUN \ - LD_LIBRARY_PATH="${PREFIX}/lib:${PREFIX}/lib64:${LD_LIBRARY_PATH}" ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/* /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - - - -FROM runtime-base AS release -LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ - org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -# copy only needed files, without copying nvidia dev files -COPY --from=build /usr/local/bin /usr/local/bin/ -COPY --from=build /usr/local/share /usr/local/share/ -COPY --from=build /usr/local/lib /usr/local/lib/ -COPY --from=build /usr/local/include /usr/local/include/ - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output diff --git a/docker-images/6.1/ubuntu2204/Dockerfile b/docker-images/6.1/ubuntu2204/Dockerfile deleted file mode 100644 index a65985730..000000000 --- a/docker-images/6.1/ubuntu2204/Dockerfile +++ /dev/null @@ -1,590 +0,0 @@ -# ffmpeg - http://ffmpeg.org/download.html -# -# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# -FROM ubuntu:20.04 AS base - -WORKDIR /tmp/workdir - -RUN apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 && \ - apt-get autoremove -y && \ - apt-get clean -y - -FROM base as build - -ENV FFMPEG_VERSION=6.1.2 \ - AOM_VERSION=v3.8.1 \ - CHROMAPRINT_VERSION=1.5.0 \ - FDKAAC_VERSION=0.1.5 \ - FONTCONFIG_VERSION=2.12.4 \ - FREETYPE_VERSION=2.10.4 \ - FRIBIDI_VERSION=0.19.7 \ - KVAZAAR_VERSION=2.0.0 \ - LAME_VERSION=3.100 \ - LIBASS_VERSION=0.13.7 \ - LIBPTHREAD_STUBS_VERSION=0.4 \ - LIBVIDSTAB_VERSION=1.1.0 \ - LIBXCB_VERSION=1.13.1 \ - XCBPROTO_VERSION=1.13 \ - OGG_VERSION=1.3.2 \ - OPENCOREAMR_VERSION=0.1.5 \ - OPUS_VERSION=1.2 \ - OPENJPEG_VERSION=2.1.2 \ - PYTHON=python3 \ - THEORA_VERSION=1.1.1 \ - VORBIS_VERSION=1.3.5 \ - VPX_VERSION=1.8.0 \ - WEBP_VERSION=1.0.2 \ - X264_VERSION=20170226-2245-stable \ - X265_VERSION=3.4 \ - XAU_VERSION=1.0.9 \ - XORG_MACROS_VERSION=1.19.2 \ - XPROTO_VERSION=7.0.31 \ - XVID_VERSION=1.3.4 \ - LIBXML2_VERSION=2.9.12 \ - LIBBLURAY_VERSION=1.1.2 \ - LIBZMQ_VERSION=4.3.2 \ - LIBSRT_VERSION=1.4.1 \ - LIBARIBB24_VERSION=1.0.3 \ - LIBPNG_VERSION=1.6.9 \ - LIBVMAF_VERSION=2.1.1 \ - ZIMG_VERSION=3.0.5 \ - SRC=/usr/local - -ARG FREETYPE_SHA256SUM="5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac freetype-2.10.4.tar.gz" -ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz" -ARG LIBASS_SHA256SUM="8fadf294bf701300d4605e6f1d92929304187fca4b8d8a47889315526adbafd7 0.13.7.tar.gz" -ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz" -ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" -ARG LIBBLURAY_SHA256SUM="a3dd452239b100dc9da0d01b30e1692693e2a332a7d29917bf84bb10ea7c0b42 libbluray-1.1.2.tar.bz2" -ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz" -ARG LIBARIBB24_SHA256SUM="f61560738926e57f9173510389634d8c06cabedfa857db4b28fb7704707ff128 v1.0.3.tar.gz" - - -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" -ARG PREFIX="/opt/ffmpeg" -ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64" - - -ARG DEBIAN_FRONTEND=noninteractive - -RUN buildDeps="autoconf \ - automake \ - cmake \ - curl \ - bzip2 \ - libexpat1-dev \ - g++ \ - gcc \ - git \ - gperf \ - libtool \ - make \ - meson \ - nasm \ - perl \ - pkg-config \ - python \ - libssl-dev \ - yasm \ - zlib1g-dev" && \ - apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ${buildDeps} -## libvmaf https://github.com/Netflix/vmaf -RUN \ - if which meson || false; then \ - echo "Building VMAF." && \ - DIR=/tmp/vmaf && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Netflix/vmaf/archive/v${LIBVMAF_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBVMAF_VERSION}.tar.gz && \ - cd /tmp/vmaf/libvmaf && \ - meson build --buildtype release --prefix=${PREFIX} && \ - ninja -vC build && \ - ninja -vC build install && \ - mkdir -p ${PREFIX}/share/model/ && \ - cp -r /tmp/vmaf/model/* ${PREFIX}/share/model/ && \ - rm -rf ${DIR}; \ - else \ - echo "VMAF skipped."; \ - fi - -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make && \ - make install && \ - rm -rf ${DIR} -### x265 http://x265.org/ -RUN \ - DIR=/tmp/x265 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/videolan/x265/archive/refs/tags/${X265_VERSION}.tar.gz | \ - tar -zx && \ - cd x265-${X265_VERSION}/build/linux && \ - sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ - sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ - ./multilib.sh && \ - make -C 8bit install && \ - rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make && \ - make install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/lame/files/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make && \ - make install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make && \ - make install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make && \ - make install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make install && \ - rm -rf ${DIR} -## fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ -RUN \ - DIR=/tmp/fontconfig && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libass https://github.com/libass/libass -RUN \ - DIR=/tmp/libass && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/libass/libass/archive/${LIBASS_VERSION}.tar.gz && \ - echo ${LIBASS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${LIBASS_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/aom && \ - git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ - cd ${DIR} ; \ - rm -rf CMakeCache.txt CMakeFiles ; \ - mkdir -p ./aom_build ; \ - cd ./aom_build ; \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ - make ; \ - make install ; \ - rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - - -## libxml2 - for libbluray -RUN \ - DIR=/tmp/libxml2 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/GNOME/libxml2/archive/refs/tags/v${LIBXML2_VERSION}.tar.gz | \ - tar -xz --strip-components=1 && \ - ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libbluray - Requires libxml, freetype, and fontconfig -RUN \ - DIR=/tmp/libbluray && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.videolan.org/pub/videolan/libbluray/${LIBBLURAY_VERSION}/libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - echo ${LIBBLURAY_SHA256SUM} | sha256sum --check && \ - tar -jx --strip-components=1 -f libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libsrt https://github.com/Haivision/srt -RUN \ - DIR=/tmp/srt && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Haivision/srt/archive/v${LIBSRT_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBSRT_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libpng -RUN \ - DIR=/tmp/png && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - git clone https://git.code.sf.net/p/libpng/code ${DIR} -b v${LIBPNG_VERSION} --depth 1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libaribb24 -RUN \ - DIR=/tmp/b24 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/nkoriyama/aribb24/archive/v${LIBARIBB24_VERSION}.tar.gz && \ - echo ${LIBARIBB24_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBARIBB24_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -# zimg https://github.com/sekrit-twc/zimg -RUN \ - DIR=/tmp/zimg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/sekrit-twc/zimg/archive/refs/tags/release-${ZIMG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## Download ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - ./configure --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --extra-libs=-ldl && \ - make ; make install - - - - - -## Build ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && cd ${DIR} && \ - ./configure \ - --disable-debug \ - --disable-doc \ - --disable-ffplay \ - --enable-fontconfig \ - --enable-gpl \ - --enable-libaom \ - --enable-libaribb24 \ - --enable-libass \ - --enable-libbluray \ - --enable-libfdk_aac \ - --enable-libfreetype \ - --enable-libkvazaar \ - --enable-libmp3lame \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-libopenjpeg \ - --enable-libopus \ - --enable-libsrt \ - --enable-libtheora \ - --enable-libvidstab \ - --enable-libvmaf \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libx264 \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libzimg \ - --enable-libzmq \ - --enable-nonfree \ - --enable-openssl \ - --enable-postproc \ - --enable-shared \ - --enable-small \ - --enable-version3 \ - --extra-cflags="-I${PREFIX}/include" \ - --extra-ldflags="-L${PREFIX}/lib" \ - --extra-libs=-ldl \ - --extra-libs=-lpthread \ - --prefix="${PREFIX}" && \ - make clean && \ - make && \ - make install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ - -## cleanup -RUN \ - ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - -FROM base AS release -LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ - org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -COPY --from=build /usr/local /usr/local/ - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output diff --git a/docker-images/6.1/ubuntu2404-edge/Dockerfile b/docker-images/6.1/ubuntu2404-edge/Dockerfile new file mode 100644 index 000000000..ebec09261 --- /dev/null +++ b/docker-images/6.1/ubuntu2404-edge/Dockerfile @@ -0,0 +1,209 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# +# Stage 1: Build +FROM ubuntu:24.04 AS builder + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + + +ENV FFMPEG_VERSION=6.1.2 + +# fribidi +ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0" +# libass +ARG LIBASS_PKGS="libass-dev libass9" +# xorg-macros +ARG XORG_MACROS_PKGS="libxcb-shm0-dev libxcb-shm0 libxcb-xfixes0 libxcb-xfixes0-dev" +# libxau +ARG XAU_PKGS="libxau-dev libxau6" +# libpthread-stubs +ARG PTHREADS_STUBS_PKGS="libpthread-stubs0-dev" +# libxml2 ( started giving me download problems, so I went back to the debian package's version ) +ARG XML2_PKGS="libxml2-dev libxml2" +# libpng +ARG PNG_PKGS="libpng-dev libpng16-16t64" + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" + + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + + +RUN buildDeps="autoconf \ + automake \ + cmake \ + build-essential \ + texinfo \ + curl \ + wget \ + tar \ + bzip2 \ + libexpat1-dev \ + gcc \ + git \ + git-core \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + perl \ + pkg-config \ + python3 \ + yasm \ + zlib1g-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libsdl2-dev \ + libva-dev \ + libvdpau-dev \ + libnuma-dev \ + libdav1d-dev \ + openssl \ + libssl-dev \ + expat \ + libgomp1" && \ + apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ${buildDeps} + +# Note: pass '--library-list' to 'generate-source-of-truth-ffmpeg-versions.py' +# ex: '--library-list lib1,lib2,lib3' +# for more control over the build process, and how the docker layers are cached + +# RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libopencore-amr,libx264,libx265,libogg,libopus,libvorbis,libvpx,libwebp,libmp3lame,libxvid,libfdk-aac,openjpeg,freetype,libvidstab,fribidi,fontconfig,libass,kvazaar,aom,libsvtav1,xorg-macros,xproto,libxau,libpthread-stubs,libxml2,libbluray,libzmq,libpng,libaribb24,zimg,libtheora,libsrt,libvmaf,ffmpeg +# dont do this 👆 where all of the libs are built at one time. +# by splitting them up into batches we allow docker to cache the layers ( which is a lifesaver when debugging ) +# I left this line in here, as it shows the proper order of the libraries that need to be built. ( what worked ) +# there are only a few build deps. I remember that libtheora needed libogg. + +RUN \ + echo "Installing dependencies..." && \ + apt-get install -yq --no-install-recommends ${FRIBIDI_PKGS} ${LIBASS_PKGS} ${XORG_MACROS_PKGS} ${XAU_PKGS} ${XML2_PKGS} ${PNG_PKGS} + # apt-get install -yq --no-install-recommends ${FRIBIDI_PKGS} ${LIBASS_PKGS} ${XORG_MACROS_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${PNG_PKGS} + + +# First batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libopencore-amr,\ +libx264,\ +libx265,\ +libogg,\ +libopus +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libvorbis,\ +libvpx,\ +libwebp,\ +libmp3lame +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libxvid,libpthread-stubs +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libfdk-aac,\ +openjpeg,\ +freetype,\ +libvidstab +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list fontconfig +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +aom,\ +libsvtav1 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list xproto +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libbluray,\ +libzmq +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libaribb24,\ +zimg,\ +libtheora +# Note: libtheora is dependant on libogg +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libsrt,\ +libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# This is a slow one, put it on its own container layer to speed up the build (allowing it to be cached) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-6.1 +## when debugging you can pass in || true to the end of the next 3 commands +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/install_ffmpeg.sh + + + +# Stage 2: Final Image ( shrink the size back down ) +FROM ubuntu:24.04 AS runtime + +COPY --from=builder /usr/local /usr/local/ + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["ffmpeg"] diff --git a/docker-images/6.1/ubuntu2404-edge/build_source.sh b/docker-images/6.1/ubuntu2404-edge/build_source.sh new file mode 100644 index 000000000..e5d8f57e4 --- /dev/null +++ b/docker-images/6.1/ubuntu2404-edge/build_source.sh @@ -0,0 +1,427 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure --disable-debug \ + --disable-doc \ + --disable-ffplay \ + --enable-fontconfig \ + --enable-gpl \ + --enable-libaom \ + --enable-libaribb24 \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-libfreetype \ + --enable-libkvazaar \ + --enable-libmp3lame \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-libsrt \ + --enable-libsvtav1 \ + --enable-libtheora \ + --enable-libvidstab \ + --enable-libvmaf \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-libzmq \ + --enable-nonfree \ + --enable-openssl \ + --enable-postproc \ + --enable-shared \ + --enable-small \ + --enable-version3 \ + --extra-cflags="-I${PREFIX}/include -I/usr/include/x86_64-linux-gnu" \ + --extra-ldflags="-L${PREFIX}/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib" \ + --extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu \ + --extra-libs=-ldl \ + --extra-libs=-lm \ + --extra-libs=-lpthread \ + --ld=g++ \ + --prefix="${PREFIX}" && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/6.1/ubuntu2404-edge/download_tarballs.sh b/docker-images/6.1/ubuntu2404-edge/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/docker-images/6.1/ubuntu2404-edge/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/docker-images/6.1/ubuntu2404-edge/generate-source-of-truth-ffmpeg-versions.py b/docker-images/6.1/ubuntu2404-edge/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/docker-images/6.1/ubuntu2404-edge/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/docker-images/6.1/ubuntu2404-edge/install_ffmpeg.sh b/docker-images/6.1/ubuntu2404-edge/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/docker-images/6.1/ubuntu2404-edge/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/docker-images/6.1/ubuntu2404/Dockerfile b/docker-images/6.1/ubuntu2404/Dockerfile new file mode 100644 index 000000000..301e1eb38 --- /dev/null +++ b/docker-images/6.1/ubuntu2404/Dockerfile @@ -0,0 +1,200 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# +# Stage 1: Build +FROM ubuntu:24.04 AS builder + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + + +ENV FFMPEG_VERSION=6.1.2 + +## opencore-amr - https://sourceforge.net/projects/opencore-amr/ +## x264 - http://www.videolan.org/developers/x264.html +## x265 - http://x265.org/ ( videolan ) +## libogg - https://www.xiph.org/ogg/ ( xiph ) +## libopus - https://www.opus-codec.org/ ( xiph ) +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus +## libvorbis - https://xiph.org/vorbis/ ( xiph ) +## libvpx - https://www.webmproject.org/code/ +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx +## libwebp - https://developers.google.com/speed/webp/ +## libmp3lame - http://lame.sourceforge.net/ +## xvid - https://www.xvid.com/ (xvidcore) +## fdk-aac - https://github.com/mstorsjo/fdk-aac +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac +## openjpeg - https://github.com/uclouvain/openjpeg +## freetype - https://www.freetype.org/ +## consider passing --no-install-recommends for this one its globbie (if you do, pass in libfreetype6) +## libvidstab - https://github.com/georgmartius/vid.stab +## fridibi - https://www.fribidi.org/ +## fontconfig - https://www.freedesktop.org/wiki/Software/fontconfig/ +## libass - https://github.com/libass/libass +## lib aom - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libaom +## libsvtav1 - https://gitlab.com/AOMediaCodec/SVT-AV1.git +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libsvtav1 +## libdav1d - https://code.videolan.org/videolan/dav1d +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libdav1d +## util-macros - (x.org) (and supporting libraries) for screen capture https://xcb.freedesktop.org/ +## xproto - (x.org) +## libXau - +## libpthread - libpthread-stubs +## libxml2 - for libbluray +## libbluray - Requires libxml, freetype, and fontconfig +## libzmq - https://github.com/zeromq/libzmq/ +## this one pulls in a bunch of dependencies +## libpng - this one also pulls in a bunch of stuff +## libaribb24 - +## zimg - https://github.com/sekrit-twc/zimg +## libtheora - http://www.theora.org/ ( xiph ) +## - https://stackoverflow.com/questions/4810996/how-to-resolve-configure-guessing-build-type-failure +## libsrt - https://github.com/Haivision/srt +## Secure Reliable Transport UDP streaming library +## multiple flavors (OpenSSL flavour) and ( GnuTLS flavour) +ARG OPENCORE_PKGS="libopencore-amrnb-dev libopencore-amrnb0 libopencore-amrwb-dev libopencore-amrwb0" +ARG X264_PKGS="libx264-164 libx264-dev" +ARG X265_PKGS="libnuma1 libx265-199 libx265-dev" +# libnuma-dev +ARG OGG_PKGS="libogg-dev libogg0" +ARG OPUS_PKGS="libopus-dev libopus0" +ARG VORBIS_PKGS="libvorbis-dev libvorbis0a libvorbisenc2 libvorbisfile3" +ARG VPX_PKGS="libvpx-dev libvpx9" +ARG WEBP_PKGS="libsharpyuv-dev libsharpyuv0 libwebp-dev libwebp7 libwebpdecoder3 libwebpdemux2 libwebpmux3" +ARG MP3LAME_PKGS="libmp3lame-dev libmp3lame0" +ARG XVIDCORE_PKGS="libxvidcore-dev libxvidcore4" +ARG FDKAAC_PKGS="libfdk-aac-dev libfdk-aac2" +ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev" +# bzip2-doc fontconfig-config fonts-dejavu-core fonts-dejavu-mono libaom3 libbrotli-dev +# libbrotli1 libbsd0 libbz2-dev libc-dev-bin libc-devtools libc6-dev libcrypt-dev libde265-0 +# libdeflate0 libfontconfig1 libfreetype6 libgd3 libheif-plugin-aomdec +# libheif-plugin-aomenc libheif-plugin-libde265 libheif1 libjbig0 libjpeg-turbo8 +# libjpeg8 liblerc4 libpng-dev libpng-tools libpng16-16t64 libsharpyuv0 libtiff6 +# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev +# manpages manpages-dev rpcsvc-proto zlib1g-dev +ARG FREETYPE_PKGS="libfreetype6-dev" +ARG FONTCONFIG_PKGS="libfontconfig-dev libfontconfig1 fontconfig-config fontconfig-config fonts-dejavu-core fonts-dejavu-mono" +ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1" +ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0" +# libass-dev wanted to install a boat-load of packages +ARG LIBASS_PKGS="libass-dev libass9" +ARG AOM_PKGS="libaom-dev libaom3" +ARG SVTAV1_PKGS="libsvtav1-dev libsvtav1enc-dev libsvtav1enc1d1 libsvtav1dec-dev libsvtav1dec0" +ARG DAV1D_PKGS="libdav1d-dev libdav1d7" +# LIBDRM_PKGS picks ups some of the XORG_MACROS_PKGS as well +ARG XORG_MACROS_PKGS="libxcb-shm0-dev libxcb-shm0 libxcb-xfixes0 libxcb-xfixes0-dev" +ARG XPROTO_PKGS="x11proto-core-dev x11proto-dev" +ARG XAU_PKGS="libxau-dev libxau6" +ARG PTHREADS_STUBS_PKGS="libpthread-stubs0-dev" +ARG XML2_PKGS="libxml2-dev libxml2" +ARG BLURAY_PKGS="libbluray-dev libbluray2" +ARG ZMQ_PKGS="libzmq3-dev libzmq5" +# libpng-tools +ARG PNG_PKGS="libpng-dev libpng16-16t64" +ARG ARIBB24_PKGS="libaribb24-dev" +ARG ZIMG_PKGS="libzimg-dev libzimg2" +ARG THEORA_PKGS="libtheora-dev libtheora0" +ARG SRT_PKGS="libssl-dev libsrt-openssl-dev libsrt1.5-openssl" +ARG LIBDRM_PKGS="libbsd0 libdrm-dev libdrm2 libxcb1-dev libxcb1" + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" + + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +RUN buildDeps="autoconf \ + automake \ + cmake \ + build-essential \ + texinfo \ + curl \ + wget \ + tar \ + bzip2 \ + libexpat1-dev \ + gcc \ + git \ + git-core \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + perl \ + pkg-config \ + python3 \ + yasm \ + zlib1g-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libsdl2-dev \ + libva-dev \ + libvdpau-dev \ + libnuma-dev \ + libdav1d-dev \ + openssl \ + libssl-dev \ + expat \ + libgomp1" && \ + apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ${buildDeps} + +RUN \ + echo "Installing dependencies..." && \ + apt-get install -yq --no-install-recommends ${OPENCORE_PKGS} ${X264_PKGS} ${X265_PKGS} ${OGG_PKGS} ${OPUS_PKGS} ${VORBIS_PKGS} ${VPX_PKGS} ${WEBP_PKGS} ${MP3LAME_PKGS} ${XVIDCORE_PKGS} ${FDKAAC_PKGS} ${OPENJP_PKGS} ${FREETYPE_PKGS} ${VIDSTAB_PKGS} ${FRIBIDI_PKGS} ${FONTCONFIG_PKGS} ${LIBASS_PKGS} ${AOM_PKGS} ${SVTAV1_PKGS} ${DAV1D_PKGS} ${XORG_MACROS_PKGS} ${XPROTO_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${BLURAY_PKGS} ${ZMQ_PKGS} ${PNG_PKGS} ${ARIBB24_PKGS} ${ZIMG_PKGS} ${THEORA_PKGS} ${SRT_PKGS} ${LIBDRM_PKGS} + + # apt install libdrm-dev + +## libvmaf https://github.com/Netflix/vmaf +## https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 +RUN \ + echo "Adding g++ for VMAF build" && \ + apt-get install -yq g++ + +# Note: pass '--library-list lib1,lib2,lib3 for more control. +# Here we have 3 libs that we have to build from source +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar,libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-6.1 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +## when debugging you can pass in || true to the end of the command +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/install_ffmpeg.sh + + + +# Stage 2: Final Image ( shrink the size back down ) +FROM ubuntu:24.04 AS runtime +COPY --from=builder /usr/local /usr/local/ + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["ffmpeg"] diff --git a/docker-images/6.1/ubuntu2404/build_source.sh b/docker-images/6.1/ubuntu2404/build_source.sh new file mode 100644 index 000000000..e5d8f57e4 --- /dev/null +++ b/docker-images/6.1/ubuntu2404/build_source.sh @@ -0,0 +1,427 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure --disable-debug \ + --disable-doc \ + --disable-ffplay \ + --enable-fontconfig \ + --enable-gpl \ + --enable-libaom \ + --enable-libaribb24 \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-libfreetype \ + --enable-libkvazaar \ + --enable-libmp3lame \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-libsrt \ + --enable-libsvtav1 \ + --enable-libtheora \ + --enable-libvidstab \ + --enable-libvmaf \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-libzmq \ + --enable-nonfree \ + --enable-openssl \ + --enable-postproc \ + --enable-shared \ + --enable-small \ + --enable-version3 \ + --extra-cflags="-I${PREFIX}/include -I/usr/include/x86_64-linux-gnu" \ + --extra-ldflags="-L${PREFIX}/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib" \ + --extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu \ + --extra-libs=-ldl \ + --extra-libs=-lm \ + --extra-libs=-lpthread \ + --ld=g++ \ + --prefix="${PREFIX}" && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/6.1/ubuntu2404/download_tarballs.sh b/docker-images/6.1/ubuntu2404/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/docker-images/6.1/ubuntu2404/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/docker-images/6.1/ubuntu2404/generate-source-of-truth-ffmpeg-versions.py b/docker-images/6.1/ubuntu2404/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/docker-images/6.1/ubuntu2404/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/docker-images/6.1/ubuntu2404/install_ffmpeg.sh b/docker-images/6.1/ubuntu2404/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/docker-images/6.1/ubuntu2404/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/docker-images/6.1/vaapi2204/Dockerfile b/docker-images/6.1/vaapi2204/Dockerfile deleted file mode 100644 index 6f71ccc5b..000000000 --- a/docker-images/6.1/vaapi2204/Dockerfile +++ /dev/null @@ -1,596 +0,0 @@ -# ffmpeg - http://ffmpeg.org/download.html -# -# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# -FROM ubuntu:22.04 AS base - -WORKDIR /tmp/workdir - -RUN apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 && \ - apt-get autoremove -y && \ - apt-get clean -y - -FROM base as build - -ENV FFMPEG_VERSION=6.1.2 \ - AOM_VERSION=v3.8.1 \ - CHROMAPRINT_VERSION=1.5.0 \ - FDKAAC_VERSION=0.1.5 \ - FONTCONFIG_VERSION=2.12.4 \ - FREETYPE_VERSION=2.10.4 \ - FRIBIDI_VERSION=0.19.7 \ - KVAZAAR_VERSION=2.0.0 \ - LAME_VERSION=3.100 \ - LIBASS_VERSION=0.13.7 \ - LIBPTHREAD_STUBS_VERSION=0.4 \ - LIBVIDSTAB_VERSION=1.1.0 \ - LIBXCB_VERSION=1.13.1 \ - XCBPROTO_VERSION=1.13 \ - OGG_VERSION=1.3.2 \ - OPENCOREAMR_VERSION=0.1.5 \ - OPUS_VERSION=1.2 \ - OPENJPEG_VERSION=2.1.2 \ - PYTHON=python3 \ - THEORA_VERSION=1.1.1 \ - VORBIS_VERSION=1.3.5 \ - VPX_VERSION=1.8.0 \ - WEBP_VERSION=1.0.2 \ - X264_VERSION=20170226-2245-stable \ - X265_VERSION=3.4 \ - XAU_VERSION=1.0.9 \ - XORG_MACROS_VERSION=1.19.2 \ - XPROTO_VERSION=7.0.31 \ - XVID_VERSION=1.3.4 \ - LIBXML2_VERSION=2.9.12 \ - LIBBLURAY_VERSION=1.1.2 \ - LIBZMQ_VERSION=4.3.2 \ - LIBSRT_VERSION=1.4.1 \ - LIBARIBB24_VERSION=1.0.3 \ - LIBPNG_VERSION=1.6.9 \ - LIBVMAF_VERSION=2.1.1 \ - ZIMG_VERSION=3.0.5 \ - SRC=/usr/local - -ARG FREETYPE_SHA256SUM="5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac freetype-2.10.4.tar.gz" -ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz" -ARG LIBASS_SHA256SUM="8fadf294bf701300d4605e6f1d92929304187fca4b8d8a47889315526adbafd7 0.13.7.tar.gz" -ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz" -ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" -ARG LIBBLURAY_SHA256SUM="a3dd452239b100dc9da0d01b30e1692693e2a332a7d29917bf84bb10ea7c0b42 libbluray-1.1.2.tar.bz2" -ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz" -ARG LIBARIBB24_SHA256SUM="f61560738926e57f9173510389634d8c06cabedfa857db4b28fb7704707ff128 v1.0.3.tar.gz" - - -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" -ARG PREFIX="/opt/ffmpeg" -ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64" - - -ARG DEBIAN_FRONTEND=noninteractive - -RUN buildDeps="autoconf \ - automake \ - cmake \ - curl \ - bzip2 \ - libexpat1-dev \ - g++ \ - gcc \ - git \ - gperf \ - libtool \ - make \ - meson \ - nasm \ - perl \ - pkg-config \ - libssl-dev \ - yasm \ - libva-dev \ - zlib1g-dev" && \ - apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ${buildDeps} -## libvmaf https://github.com/Netflix/vmaf -RUN \ - if which meson || false; then \ - echo "Building VMAF." && \ - DIR=/tmp/vmaf && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Netflix/vmaf/archive/v${LIBVMAF_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBVMAF_VERSION}.tar.gz && \ - cd /tmp/vmaf/libvmaf && \ - meson build --buildtype release --prefix=${PREFIX} && \ - ninja -vC build && \ - ninja -vC build install && \ - mkdir -p ${PREFIX}/share/model/ && \ - cp -r /tmp/vmaf/model/* ${PREFIX}/share/model/ && \ - rm -rf ${DIR}; \ - else \ - echo "VMAF skipped."; \ - fi - -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make && \ - make install && \ - rm -rf ${DIR} -### x265 http://x265.org/ -RUN \ - DIR=/tmp/x265 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/videolan/x265/archive/refs/tags/${X265_VERSION}.tar.gz | \ - tar -zx && \ - cd x265-${X265_VERSION}/build/linux && \ - sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ - sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ - ./multilib.sh && \ - make -C 8bit install && \ - rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make && \ - make install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/lame/files/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make && \ - make install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make && \ - make install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make && \ - make install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make install && \ - rm -rf ${DIR} -## fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ -RUN \ - DIR=/tmp/fontconfig && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libass https://github.com/libass/libass -RUN \ - DIR=/tmp/libass && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/libass/libass/archive/${LIBASS_VERSION}.tar.gz && \ - echo ${LIBASS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${LIBASS_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/aom && \ - git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ - cd ${DIR} ; \ - rm -rf CMakeCache.txt CMakeFiles ; \ - mkdir -p ./aom_build ; \ - cd ./aom_build ; \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ - make ; \ - make install ; \ - rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - - -## libxml2 - for libbluray -RUN \ - DIR=/tmp/libxml2 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/GNOME/libxml2/archive/refs/tags/v${LIBXML2_VERSION}.tar.gz | \ - tar -xz --strip-components=1 && \ - ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libbluray - Requires libxml, freetype, and fontconfig -RUN \ - DIR=/tmp/libbluray && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.videolan.org/pub/videolan/libbluray/${LIBBLURAY_VERSION}/libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - echo ${LIBBLURAY_SHA256SUM} | sha256sum --check && \ - tar -jx --strip-components=1 -f libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libsrt https://github.com/Haivision/srt -RUN \ - DIR=/tmp/srt && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Haivision/srt/archive/v${LIBSRT_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBSRT_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libpng -RUN \ - DIR=/tmp/png && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - git clone https://git.code.sf.net/p/libpng/code ${DIR} -b v${LIBPNG_VERSION} --depth 1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libaribb24 -RUN \ - DIR=/tmp/b24 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/nkoriyama/aribb24/archive/v${LIBARIBB24_VERSION}.tar.gz && \ - echo ${LIBARIBB24_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBARIBB24_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -# zimg https://github.com/sekrit-twc/zimg -RUN \ - DIR=/tmp/zimg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/sekrit-twc/zimg/archive/refs/tags/release-${ZIMG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## Download ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - ./configure --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --extra-libs=-ldl && \ - make ; make install - - - - - -## Build ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && cd ${DIR} && \ - ./configure \ - --disable-debug \ - --disable-doc \ - --disable-ffplay \ - --enable-fontconfig \ - --enable-gpl \ - --enable-libaom \ - --enable-libaribb24 \ - --enable-libass \ - --enable-libbluray \ - --enable-libfdk_aac \ - --enable-libfreetype \ - --enable-libkvazaar \ - --enable-libmp3lame \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-libopenjpeg \ - --enable-libopus \ - --enable-libsrt \ - --enable-libtheora \ - --enable-libvidstab \ - --enable-libvmaf \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libx264 \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libzimg \ - --enable-libzmq \ - --enable-nonfree \ - --enable-openssl \ - --enable-postproc \ - --enable-shared \ - --enable-small \ - --enable-vaapi \ - --enable-version3 \ - --extra-cflags="-I${PREFIX}/include" \ - --extra-ldflags="-L${PREFIX}/lib" \ - --extra-libs=-ldl \ - --extra-libs=-lpthread \ - --prefix="${PREFIX}" && \ - make clean && \ - make && \ - make install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ - -## cleanup -RUN \ - ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - -FROM base AS release -LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ - org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -COPY --from=build /usr/local /usr/local/ - -RUN \ - apt-get update -y && \ - apt-get install -y --no-install-recommends libva-drm2 libva2 i965-va-driver && \ - rm -rf /var/lib/apt/lists/* - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output diff --git a/docker-images/6.1/vaapi2404/Dockerfile b/docker-images/6.1/vaapi2404/Dockerfile new file mode 100644 index 000000000..8a47e1f52 --- /dev/null +++ b/docker-images/6.1/vaapi2404/Dockerfile @@ -0,0 +1,205 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# +# Stage 1: Build +FROM ubuntu:24.04 AS builder + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + + +ENV FFMPEG_VERSION=6.1.2 + +## opencore-amr - https://sourceforge.net/projects/opencore-amr/ +## x264 - http://www.videolan.org/developers/x264.html +## x265 - http://x265.org/ ( videolan ) +## libogg - https://www.xiph.org/ogg/ ( xiph ) +## libopus - https://www.opus-codec.org/ ( xiph ) +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus +## libvorbis - https://xiph.org/vorbis/ ( xiph ) +## libvpx - https://www.webmproject.org/code/ +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx +## libwebp - https://developers.google.com/speed/webp/ +## libmp3lame - http://lame.sourceforge.net/ +## xvid - https://www.xvid.com/ (xvidcore) +## fdk-aac - https://github.com/mstorsjo/fdk-aac +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac +## openjpeg - https://github.com/uclouvain/openjpeg +## freetype - https://www.freetype.org/ +## consider passing --no-install-recommends for this one its globbie (if you do, pass in libfreetype6) +## libvidstab - https://github.com/georgmartius/vid.stab +## fridibi - https://www.fribidi.org/ +## fontconfig - https://www.freedesktop.org/wiki/Software/fontconfig/ +## libass - https://github.com/libass/libass +## lib aom - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libaom +## libsvtav1 - https://gitlab.com/AOMediaCodec/SVT-AV1.git +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libsvtav1 +## libdav1d - https://code.videolan.org/videolan/dav1d +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libdav1d +## util-macros - (x.org) (and supporting libraries) for screen capture https://xcb.freedesktop.org/ +## xproto - (x.org) +## libXau - +## libpthread - libpthread-stubs +## libxml2 - for libbluray +## libbluray - Requires libxml, freetype, and fontconfig +## libzmq - https://github.com/zeromq/libzmq/ +## this one pulls in a bunch of dependencies +## libpng - this one also pulls in a bunch of stuff +## libaribb24 - +## zimg - https://github.com/sekrit-twc/zimg +## libtheora - http://www.theora.org/ ( xiph ) +## - https://stackoverflow.com/questions/4810996/how-to-resolve-configure-guessing-build-type-failure +## libsrt - https://github.com/Haivision/srt +## Secure Reliable Transport UDP streaming library +## multiple flavors (OpenSSL flavour) and ( GnuTLS flavour) +ARG OPENCORE_PKGS="libopencore-amrnb-dev libopencore-amrnb0 libopencore-amrwb-dev libopencore-amrwb0" +ARG X264_PKGS="libx264-164 libx264-dev" +ARG X265_PKGS="libnuma1 libx265-199 libx265-dev" +# libnuma-dev +ARG OGG_PKGS="libogg-dev libogg0" +ARG OPUS_PKGS="libopus-dev libopus0" +ARG VORBIS_PKGS="libvorbis-dev libvorbis0a libvorbisenc2 libvorbisfile3" +ARG VPX_PKGS="libvpx-dev libvpx9" +ARG WEBP_PKGS="libsharpyuv-dev libsharpyuv0 libwebp-dev libwebp7 libwebpdecoder3 libwebpdemux2 libwebpmux3" +ARG MP3LAME_PKGS="libmp3lame-dev libmp3lame0" +ARG XVIDCORE_PKGS="libxvidcore-dev libxvidcore4" +ARG FDKAAC_PKGS="libfdk-aac-dev libfdk-aac2" +ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev" +# bzip2-doc fontconfig-config fonts-dejavu-core fonts-dejavu-mono libaom3 libbrotli-dev +# libbrotli1 libbsd0 libbz2-dev libc-dev-bin libc-devtools libc6-dev libcrypt-dev libde265-0 +# libdeflate0 libfontconfig1 libfreetype6 libgd3 libheif-plugin-aomdec +# libheif-plugin-aomenc libheif-plugin-libde265 libheif1 libjbig0 libjpeg-turbo8 +# libjpeg8 liblerc4 libpng-dev libpng-tools libpng16-16t64 libsharpyuv0 libtiff6 +# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev +# manpages manpages-dev rpcsvc-proto zlib1g-dev +ARG FREETYPE_PKGS="libfreetype6-dev" +ARG FONTCONFIG_PKGS="libfontconfig-dev libfontconfig1 fontconfig-config fontconfig-config fonts-dejavu-core fonts-dejavu-mono" +ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1" +ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0" +# libass-dev wanted to install a boat-load of packages +ARG LIBASS_PKGS="libass-dev libass9" +ARG AOM_PKGS="libaom-dev libaom3" +ARG SVTAV1_PKGS="libsvtav1-dev libsvtav1enc-dev libsvtav1enc1d1 libsvtav1dec-dev libsvtav1dec0" +ARG DAV1D_PKGS="libdav1d-dev libdav1d7" +# LIBDRM_PKGS picks ups some of the XORG_MACROS_PKGS as well +ARG XORG_MACROS_PKGS="libxcb-shm0-dev libxcb-shm0 libxcb-xfixes0 libxcb-xfixes0-dev" +ARG XPROTO_PKGS="x11proto-core-dev x11proto-dev" +ARG XAU_PKGS="libxau-dev libxau6" +ARG PTHREADS_STUBS_PKGS="libpthread-stubs0-dev" +ARG XML2_PKGS="libxml2-dev libxml2" +ARG BLURAY_PKGS="libbluray-dev libbluray2" +ARG ZMQ_PKGS="libzmq3-dev libzmq5" +# libpng-tools +ARG PNG_PKGS="libpng-dev libpng16-16t64" +ARG ARIBB24_PKGS="libaribb24-dev" +ARG ZIMG_PKGS="libzimg-dev libzimg2" +ARG THEORA_PKGS="libtheora-dev libtheora0" +ARG SRT_PKGS="libssl-dev libsrt-openssl-dev libsrt1.5-openssl" +ARG LIBDRM_PKGS="libbsd0 libdrm-dev libdrm2 libxcb1-dev libxcb1" + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" + + +ARG DEBIAN_FRONTEND=noninteractive + +# Before autoremove and clean: Image was 217.01MB +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +RUN buildDeps="autoconf \ + automake \ + cmake \ + build-essential \ + texinfo \ + curl \ + wget \ + tar \ + bzip2 \ + libexpat1-dev \ + gcc \ + git \ + git-core \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + perl \ + pkg-config \ + python3 \ + yasm \ + zlib1g-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libsdl2-dev \ + libva-dev \ + libvdpau-dev \ + libnuma-dev \ + libdav1d-dev \ + openssl \ + libssl-dev \ + expat \ + libgomp1" && \ + apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ${buildDeps} + +RUN \ + echo "Installing dependencies..." && \ + apt-get install -yq --no-install-recommends ${OPENCORE_PKGS} ${X264_PKGS} ${X265_PKGS} ${OGG_PKGS} ${OPUS_PKGS} ${VORBIS_PKGS} ${VPX_PKGS} ${WEBP_PKGS} ${MP3LAME_PKGS} ${XVIDCORE_PKGS} ${FDKAAC_PKGS} ${OPENJP_PKGS} ${FREETYPE_PKGS} ${VIDSTAB_PKGS} ${FRIBIDI_PKGS} ${FONTCONFIG_PKGS} ${LIBASS_PKGS} ${AOM_PKGS} ${SVTAV1_PKGS} ${DAV1D_PKGS} ${XORG_MACROS_PKGS} ${XPROTO_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${BLURAY_PKGS} ${ZMQ_PKGS} ${PNG_PKGS} ${ARIBB24_PKGS} ${ZIMG_PKGS} ${THEORA_PKGS} ${SRT_PKGS} ${LIBDRM_PKGS} + +RUN \ + apt-get install -y --no-install-recommends libva-drm2 libva2 i965-va-driver + + # apt install libdrm-dev + +## libvmaf https://github.com/Netflix/vmaf +## https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 +RUN \ + echo "Adding g++ for VMAF build" && \ + apt-get install -yq g++ + +# Note: pass '--library-list lib1,lib2,lib3 for more control. +# Here we have 3 libs that we have to build from source +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar,libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-6.1 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +## when debugging you can pass in || true to the end of the command +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/install_ffmpeg.sh + + + +# Stage 2: Final Image ( shrink the size back down ) +FROM ubuntu:24.04 +COPY --from=builder /usr/local /usr/local/ + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["ffmpeg"] diff --git a/docker-images/6.1/vaapi2404/build_source.sh b/docker-images/6.1/vaapi2404/build_source.sh new file mode 100644 index 000000000..05da92ac0 --- /dev/null +++ b/docker-images/6.1/vaapi2404/build_source.sh @@ -0,0 +1,428 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure --disable-debug \ + --disable-doc \ + --disable-ffplay \ + --enable-fontconfig \ + --enable-gpl \ + --enable-libaom \ + --enable-libaribb24 \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-libfreetype \ + --enable-libkvazaar \ + --enable-libmp3lame \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-libsrt \ + --enable-libsvtav1 \ + --enable-libtheora \ + --enable-libvidstab \ + --enable-libvmaf \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-libzmq \ + --enable-nonfree \ + --enable-openssl \ + --enable-postproc \ + --enable-shared \ + --enable-small \ + --enable-vaapi \ + --enable-version3 \ + --extra-cflags="-I${PREFIX}/include -I/usr/include/x86_64-linux-gnu" \ + --extra-ldflags="-L${PREFIX}/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib" \ + --extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu \ + --extra-libs=-ldl \ + --extra-libs=-lm \ + --extra-libs=-lpthread \ + --ld=g++ \ + --prefix="${PREFIX}" && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/6.1/vaapi2404/download_tarballs.sh b/docker-images/6.1/vaapi2404/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/docker-images/6.1/vaapi2404/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/docker-images/6.1/vaapi2404/generate-source-of-truth-ffmpeg-versions.py b/docker-images/6.1/vaapi2404/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/docker-images/6.1/vaapi2404/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/docker-images/6.1/vaapi2404/install_ffmpeg.sh b/docker-images/6.1/vaapi2404/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/docker-images/6.1/vaapi2404/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/docker-images/7.0/alpine313/Dockerfile b/docker-images/7.0/alpine313/Dockerfile deleted file mode 100644 index e9b75eac3..000000000 --- a/docker-images/7.0/alpine313/Dockerfile +++ /dev/null @@ -1,588 +0,0 @@ -# ffmpeg - http://ffmpeg.org/download.html -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# - -FROM alpine:3.13 AS base - -RUN apk add --no-cache --update libgcc libstdc++ ca-certificates libcrypto1.1 libssl1.1 libgomp expat git - - -FROM base AS build - -WORKDIR /tmp/workdir - -ENV FFMPEG_VERSION=7.0.2 \ - AOM_VERSION=v3.8.1 \ - CHROMAPRINT_VERSION=1.5.0 \ - FDKAAC_VERSION=0.1.5 \ - FONTCONFIG_VERSION=2.12.4 \ - FREETYPE_VERSION=2.10.4 \ - FRIBIDI_VERSION=0.19.7 \ - KVAZAAR_VERSION=2.0.0 \ - LAME_VERSION=3.100 \ - LIBASS_VERSION=0.13.7 \ - LIBPTHREAD_STUBS_VERSION=0.4 \ - LIBVIDSTAB_VERSION=1.1.0 \ - LIBXCB_VERSION=1.13.1 \ - XCBPROTO_VERSION=1.13 \ - OGG_VERSION=1.3.2 \ - OPENCOREAMR_VERSION=0.1.5 \ - OPUS_VERSION=1.2 \ - OPENJPEG_VERSION=2.1.2 \ - PYTHON=python3 \ - THEORA_VERSION=1.1.1 \ - VORBIS_VERSION=1.3.5 \ - VPX_VERSION=1.8.0 \ - WEBP_VERSION=1.0.2 \ - X264_VERSION=20170226-2245-stable \ - X265_VERSION=3.4 \ - XAU_VERSION=1.0.9 \ - XORG_MACROS_VERSION=1.19.2 \ - XPROTO_VERSION=7.0.31 \ - XVID_VERSION=1.3.4 \ - LIBXML2_VERSION=2.9.12 \ - LIBBLURAY_VERSION=1.1.2 \ - LIBZMQ_VERSION=4.3.2 \ - LIBSRT_VERSION=1.4.1 \ - LIBARIBB24_VERSION=1.0.3 \ - LIBPNG_VERSION=1.6.9 \ - LIBVMAF_VERSION=2.1.1 \ - ZIMG_VERSION=3.0.5 \ - SRC=/usr/local - -ARG FREETYPE_SHA256SUM="5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac freetype-2.10.4.tar.gz" -ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz" -ARG LIBASS_SHA256SUM="8fadf294bf701300d4605e6f1d92929304187fca4b8d8a47889315526adbafd7 0.13.7.tar.gz" -ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz" -ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" -ARG LIBBLURAY_SHA256SUM="a3dd452239b100dc9da0d01b30e1692693e2a332a7d29917bf84bb10ea7c0b42 libbluray-1.1.2.tar.bz2" -ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz" -ARG LIBARIBB24_SHA256SUM="f61560738926e57f9173510389634d8c06cabedfa857db4b28fb7704707ff128 v1.0.3.tar.gz" - - -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" -ARG PREFIX="/opt/ffmpeg" -ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64" - - -RUN buildDeps="autoconf \ - automake \ - bash \ - binutils \ - bzip2 \ - cmake \ - coreutils \ - curl \ - diffutils \ - expat-dev \ - file \ - g++ \ - gcc \ - gperf \ - libtool \ - make \ - nasm \ - openssl-dev \ - python3 \ - tar \ - xcb-proto \ - yasm \ - zlib-dev" && \ - apk add --no-cache --update ${buildDeps} -## libvmaf https://github.com/Netflix/vmaf -RUN \ - if which meson || false; then \ - echo "Building VMAF." && \ - DIR=/tmp/vmaf && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Netflix/vmaf/archive/v${LIBVMAF_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBVMAF_VERSION}.tar.gz && \ - cd /tmp/vmaf/libvmaf && \ - meson build --buildtype release --prefix=${PREFIX} && \ - ninja -vC build && \ - ninja -vC build install && \ - mkdir -p ${PREFIX}/share/model/ && \ - cp -r /tmp/vmaf/model/* ${PREFIX}/share/model/ && \ - rm -rf ${DIR}; \ - else \ - echo "VMAF skipped."; \ - fi - -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make && \ - make install && \ - rm -rf ${DIR} -### x265 http://x265.org/ -RUN \ - DIR=/tmp/x265 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/videolan/x265/archive/refs/tags/${X265_VERSION}.tar.gz | \ - tar -zx && \ - cd x265-${X265_VERSION}/build/linux && \ - sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ - sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ - ./multilib.sh && \ - make -C 8bit install && \ - rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make && \ - make install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/lame/files/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make && \ - make install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make && \ - make install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make && \ - make install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make install && \ - rm -rf ${DIR} -## fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ -RUN \ - DIR=/tmp/fontconfig && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libass https://github.com/libass/libass -RUN \ - DIR=/tmp/libass && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/libass/libass/archive/${LIBASS_VERSION}.tar.gz && \ - echo ${LIBASS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${LIBASS_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/aom && \ - git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ - cd ${DIR} ; \ - rm -rf CMakeCache.txt CMakeFiles ; \ - mkdir -p ./aom_build ; \ - cd ./aom_build ; \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ - make ; \ - make install ; \ - rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - - -## libxml2 - for libbluray -RUN \ - DIR=/tmp/libxml2 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/GNOME/libxml2/archive/refs/tags/v${LIBXML2_VERSION}.tar.gz | \ - tar -xz --strip-components=1 && \ - ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libbluray - Requires libxml, freetype, and fontconfig -RUN \ - DIR=/tmp/libbluray && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.videolan.org/pub/videolan/libbluray/${LIBBLURAY_VERSION}/libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - echo ${LIBBLURAY_SHA256SUM} | sha256sum --check && \ - tar -jx --strip-components=1 -f libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libsrt https://github.com/Haivision/srt -RUN \ - DIR=/tmp/srt && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Haivision/srt/archive/v${LIBSRT_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBSRT_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libpng -RUN \ - DIR=/tmp/png && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - git clone https://git.code.sf.net/p/libpng/code ${DIR} -b v${LIBPNG_VERSION} --depth 1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libaribb24 -RUN \ - DIR=/tmp/b24 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/nkoriyama/aribb24/archive/v${LIBARIBB24_VERSION}.tar.gz && \ - echo ${LIBARIBB24_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBARIBB24_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -# zimg https://github.com/sekrit-twc/zimg -RUN \ - DIR=/tmp/zimg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/sekrit-twc/zimg/archive/refs/tags/release-${ZIMG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## Download ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - ./configure --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --extra-libs=-ldl && \ - make ; make install - - - - - -## Build ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && cd ${DIR} && \ - ./configure \ - --disable-debug \ - --disable-doc \ - --disable-ffplay \ - --enable-fontconfig \ - --enable-gpl \ - --enable-libaom \ - --enable-libaribb24 \ - --enable-libass \ - --enable-libbluray \ - --enable-libfdk_aac \ - --enable-libfreetype \ - --enable-libkvazaar \ - --enable-libmp3lame \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-libopenjpeg \ - --enable-libopus \ - --enable-libsrt \ - --enable-libtheora \ - --enable-libvidstab \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libx264 \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libzimg \ - --enable-libzmq \ - --enable-nonfree \ - --enable-openssl \ - --enable-postproc \ - --enable-shared \ - --enable-small \ - --enable-version3 \ - --extra-cflags="-I${PREFIX}/include" \ - --extra-ldflags="-L${PREFIX}/lib" \ - --extra-libs=-ldl \ - --extra-libs=-lpthread \ - --prefix="${PREFIX}" && \ - make clean && \ - make && \ - make install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ - - -RUN \ - ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - mkdir -p /usr/local/include && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - -### Release Stage -FROM base AS release -LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ - org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -COPY --from=build /usr/local /usr/local - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output diff --git a/docker-images/7.0/alpine320/Dockerfile b/docker-images/7.0/alpine320/Dockerfile new file mode 100644 index 000000000..52d1e6b9f --- /dev/null +++ b/docker-images/7.0/alpine320/Dockerfile @@ -0,0 +1,210 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# + +FROM alpine:3.20 AS builder + +RUN apk add --no-cache --update libgcc libstdc++ ca-certificates openssl expat git less tree file vim bash + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + +RUN chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +ENV FFMPEG_VERSION=7.0.2 + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" + + +RUN libDeps="libgomp \ + # https://github.com/zeromq/libzmq/ + zeromq \ + zeromq-dev \ + # https://sourceforge.net/projects/opencore-amr/ + opencore-amr \ + opencore-amr-dev \ + # https://www.xiph.org/ogg/ + libogg \ + libogg-static \ + libogg-dev \ + # libtheora http://www.theora.org/ + libtheora \ + libtheora-static \ + libtheora-dev \ + # http://www.videolan.org/developers/x264.html + x264 \ + x264-libs \ + x264-dev \ + # http://x265.org/ + x265 \ + x265-libs \ + x265-dev \ + # https://www.opus-codec.org/ + opus \ + opus-tools \ + opus-dev \ + # https://xiph.org/vorbis/ + libvorbis \ + libvorbis-static \ + libvorbis-dev \ + # https://www.webmproject.org/code/ + libvpx \ + libvpx-utils \ + libvpx-dev \ + # https://developers.google.com/speed/webp/ + libwebp \ + libwebp-dev \ + libwebp-static \ + libwebp-tools \ + # http://lame.sourceforge.net/ + lame \ + lame-libs \ + lame-dev \ + # https://www.xvid.com/ + xvidcore \ + xvidcore-static \ + xvidcore-dev \ + # https://github.com/mstorsjo/fdk-aac + fdk-aac \ + fdk-aac-dev \ + # https://github.com/uclouvain/openjpeg + openjpeg \ + openjpeg-tools \ + openjpeg-dev \ + # https://www.freetype.org/ + freetype \ + freetype-static \ + freetype-dev \ + # https://github.com/georgmartius/vid.stab + vidstab \ + vidstab-dev \ + ## https://www.fribidi.org/ + fribidi \ + fribidi-static \ + fribidi-dev \ + # fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ + fontconfig \ + fontconfig-static \ + fontconfig-dev \ + # https://github.com/libass/libass + libass \ + libass-dev \ + # https://aomedia.googlesource.com/aom + aom \ + aom-libs \ + aom-dev \ + # https://xcb.freedesktop.org/ + # https://www.x.org/archive//individual/util/util-macros- + util-macros \ + # https://www.x.org/archive/individual/proto/ + xorgproto \ + # https://www.x.org/archive/individual/lib/libXau- + libxau \ + libxau-dev \ + # https://github.com/GNOME/libxml2/ + libxml2 \ + libxml2-static \ + libxml2-utils \ + libxml2-dev \ + # https://github.com/Haivision/srt + libsrt \ + libsrt-progs \ + libsrt-dev \ + # https://git.code.sf.net/p/libpng/code + libpng \ + libpng-static \ + libpng-utils \ + libpng-dev \ + # https://github.com/sekrit-twc/zimg + zimg \ + zimg-dev \ + dav1d \ + libdav1d \ + dav1d-dev \ + svt-av1 \ + svt-av1-dev \ + libSvtAv1Enc \ + libSvtAv1Dec" && \ + apk add --no-cache --update ${libDeps} + + +RUN buildDeps="autoconf \ + automake \ + bash \ + binutils \ + bzip2 \ + cmake \ + coreutils \ + curl \ + wget \ + jq \ + diffutils \ + expat-dev \ + file \ + g++ \ + gcc \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + openssl-dev \ + python3 \ + tar \ + xz \ + xcb-proto \ + yasm \ + zlib-dev \ + alpine-sdk \ + linux-headers" && \ + apk add --no-cache --update ${buildDeps} + +# Note: pass '--library-list lib1,lib2,lib3 for more control. +# Here we have 3 libs that we have to build from source +# vmaf +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar,libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# # libevent && libevent-dev has usr/lib/libevent_pthreads ??? +# ## libbluray - Requires libxml, freetype, and fontconfig +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libpthread-stubs,libbluray,libaribb24 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-7.0 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# when debugging you can pass in || true to the end of the command +# to keep the build going even if one of the steps fails +RUN /tmp/workdir/install_ffmpeg.sh + + +### Release Stage +FROM alpine:3.20 AS release +# RUN apk add --no-cache --update bash less tree file vim +COPY --from=builder /usr/local /usr/local +COPY --from=builder /tmp/fakeroot/ / + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["/bin/ffmpeg"] diff --git a/docker-images/7.0/alpine320/build_source.sh b/docker-images/7.0/alpine320/build_source.sh new file mode 100644 index 000000000..e5d8f57e4 --- /dev/null +++ b/docker-images/7.0/alpine320/build_source.sh @@ -0,0 +1,427 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure --disable-debug \ + --disable-doc \ + --disable-ffplay \ + --enable-fontconfig \ + --enable-gpl \ + --enable-libaom \ + --enable-libaribb24 \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-libfreetype \ + --enable-libkvazaar \ + --enable-libmp3lame \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-libsrt \ + --enable-libsvtav1 \ + --enable-libtheora \ + --enable-libvidstab \ + --enable-libvmaf \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-libzmq \ + --enable-nonfree \ + --enable-openssl \ + --enable-postproc \ + --enable-shared \ + --enable-small \ + --enable-version3 \ + --extra-cflags="-I${PREFIX}/include -I/usr/include/x86_64-linux-gnu" \ + --extra-ldflags="-L${PREFIX}/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib" \ + --extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu \ + --extra-libs=-ldl \ + --extra-libs=-lm \ + --extra-libs=-lpthread \ + --ld=g++ \ + --prefix="${PREFIX}" && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/7.0/alpine320/download_tarballs.sh b/docker-images/7.0/alpine320/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/docker-images/7.0/alpine320/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/docker-images/7.0/alpine320/generate-source-of-truth-ffmpeg-versions.py b/docker-images/7.0/alpine320/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/docker-images/7.0/alpine320/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/docker-images/7.0/alpine320/install_ffmpeg.sh b/docker-images/7.0/alpine320/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/docker-images/7.0/alpine320/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/docker-images/7.0/nvidia2204/Dockerfile b/docker-images/7.0/nvidia2204/Dockerfile deleted file mode 100644 index be7029051..000000000 --- a/docker-images/7.0/nvidia2204/Dockerfile +++ /dev/null @@ -1,622 +0,0 @@ -# ffmpeg - http://ffmpeg.org/download.html -# -# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# - -FROM nvcr.io/nvidia/cuda:12.3.1-devel-ubuntu22.04 AS devel-base -ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,video -ENV DEBIAN_FRONTEND=noninteractive -WORKDIR /tmp/workdir - -RUN apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 python3 && \ - apt-get autoremove -y && \ - apt-get clean -y - -FROM nvcr.io/nvidia/cuda:12.3.1-runtime-ubuntu22.04 AS runtime-base - -ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,video -ENV DEBIAN_FRONTEND=nonintercative -WORKDIR /tmp/workdir - -RUN apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 libxcb-shape0-dev && \ - apt-get autoremove -y && \ - apt-get clean -y - - -FROM devel-base as build - -ENV NVIDIA_HEADERS_VERSION=11.1.5.3 - -ENV FFMPEG_VERSION=7.0.2 \ - AOM_VERSION=v3.8.1 \ - CHROMAPRINT_VERSION=1.5.0 \ - FDKAAC_VERSION=0.1.5 \ - FONTCONFIG_VERSION=2.12.4 \ - FREETYPE_VERSION=2.10.4 \ - FRIBIDI_VERSION=0.19.7 \ - KVAZAAR_VERSION=2.0.0 \ - LAME_VERSION=3.100 \ - LIBASS_VERSION=0.13.7 \ - LIBPTHREAD_STUBS_VERSION=0.4 \ - LIBVIDSTAB_VERSION=1.1.0 \ - LIBXCB_VERSION=1.13.1 \ - XCBPROTO_VERSION=1.13 \ - OGG_VERSION=1.3.2 \ - OPENCOREAMR_VERSION=0.1.5 \ - OPUS_VERSION=1.2 \ - OPENJPEG_VERSION=2.1.2 \ - PYTHON=python3 \ - THEORA_VERSION=1.1.1 \ - VORBIS_VERSION=1.3.5 \ - VPX_VERSION=1.8.0 \ - WEBP_VERSION=1.0.2 \ - X264_VERSION=20170226-2245-stable \ - X265_VERSION=3.4 \ - XAU_VERSION=1.0.9 \ - XORG_MACROS_VERSION=1.19.2 \ - XPROTO_VERSION=7.0.31 \ - XVID_VERSION=1.3.4 \ - LIBXML2_VERSION=2.9.12 \ - LIBBLURAY_VERSION=1.1.2 \ - LIBZMQ_VERSION=4.3.2 \ - LIBSRT_VERSION=1.4.1 \ - LIBARIBB24_VERSION=1.0.3 \ - LIBPNG_VERSION=1.6.9 \ - LIBVMAF_VERSION=2.1.1 \ - ZIMG_VERSION=3.0.5 \ - SRC=/usr/local - -ARG FREETYPE_SHA256SUM="5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac freetype-2.10.4.tar.gz" -ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz" -ARG LIBASS_SHA256SUM="8fadf294bf701300d4605e6f1d92929304187fca4b8d8a47889315526adbafd7 0.13.7.tar.gz" -ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz" -ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" -ARG LIBBLURAY_SHA256SUM="a3dd452239b100dc9da0d01b30e1692693e2a332a7d29917bf84bb10ea7c0b42 libbluray-1.1.2.tar.bz2" -ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz" -ARG LIBARIBB24_SHA256SUM="f61560738926e57f9173510389634d8c06cabedfa857db4b28fb7704707ff128 v1.0.3.tar.gz" - - -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" -ARG PREFIX="/opt/ffmpeg" -ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64" - - -RUN buildDeps="autoconf \ - automake \ - cmake \ - curl \ - bzip2 \ - libexpat1-dev \ - g++ \ - gcc \ - git \ - gperf \ - libtool \ - make \ - nasm \ - perl \ - pkg-config \ - python3 \ - libssl-dev \ - yasm \ - zlib1g-dev" && \ - apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ${buildDeps} - -RUN \ - DIR=/tmp/nv-codec-headers && \ - git clone https://github.com/FFmpeg/nv-codec-headers ${DIR} && \ - cd ${DIR} && \ - git checkout n${NVIDIA_HEADERS_VERSION} && \ - make PREFIX="${PREFIX}" && \ - make install PREFIX="${PREFIX}" && \ - rm -rf ${DIR} - -## libvmaf https://github.com/Netflix/vmaf -RUN \ - if which meson || false; then \ - echo "Building VMAF." && \ - DIR=/tmp/vmaf && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Netflix/vmaf/archive/v${LIBVMAF_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBVMAF_VERSION}.tar.gz && \ - cd /tmp/vmaf/libvmaf && \ - meson build --buildtype release --prefix=${PREFIX} && \ - ninja -vC build && \ - ninja -vC build install && \ - mkdir -p ${PREFIX}/share/model/ && \ - cp -r /tmp/vmaf/model/* ${PREFIX}/share/model/ && \ - rm -rf ${DIR}; \ - else \ - echo "VMAF skipped."; \ - fi - -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make && \ - make install && \ - rm -rf ${DIR} -### x265 http://x265.org/ -RUN \ - DIR=/tmp/x265 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/videolan/x265/archive/refs/tags/${X265_VERSION}.tar.gz | \ - tar -zx && \ - cd x265-${X265_VERSION}/build/linux && \ - sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ - sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ - ./multilib.sh && \ - make -C 8bit install && \ - rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make && \ - make install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/lame/files/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make && \ - make install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make && \ - make install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make && \ - make install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make install && \ - rm -rf ${DIR} -## fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ -RUN \ - DIR=/tmp/fontconfig && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libass https://github.com/libass/libass -RUN \ - DIR=/tmp/libass && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/libass/libass/archive/${LIBASS_VERSION}.tar.gz && \ - echo ${LIBASS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${LIBASS_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/aom && \ - git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ - cd ${DIR} ; \ - rm -rf CMakeCache.txt CMakeFiles ; \ - mkdir -p ./aom_build ; \ - cd ./aom_build ; \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ - make ; \ - make install ; \ - rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - - -## libxml2 - for libbluray -RUN \ - DIR=/tmp/libxml2 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/GNOME/libxml2/archive/refs/tags/v${LIBXML2_VERSION}.tar.gz | \ - tar -xz --strip-components=1 && \ - ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libbluray - Requires libxml, freetype, and fontconfig -RUN \ - DIR=/tmp/libbluray && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.videolan.org/pub/videolan/libbluray/${LIBBLURAY_VERSION}/libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - echo ${LIBBLURAY_SHA256SUM} | sha256sum --check && \ - tar -jx --strip-components=1 -f libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libsrt https://github.com/Haivision/srt -RUN \ - DIR=/tmp/srt && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Haivision/srt/archive/v${LIBSRT_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBSRT_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libpng -RUN \ - DIR=/tmp/png && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - git clone https://git.code.sf.net/p/libpng/code ${DIR} -b v${LIBPNG_VERSION} --depth 1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libaribb24 -RUN \ - DIR=/tmp/b24 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/nkoriyama/aribb24/archive/v${LIBARIBB24_VERSION}.tar.gz && \ - echo ${LIBARIBB24_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBARIBB24_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -# zimg https://github.com/sekrit-twc/zimg -RUN \ - DIR=/tmp/zimg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/sekrit-twc/zimg/archive/refs/tags/release-${ZIMG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## Download ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - ./configure --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --extra-libs=-ldl && \ - make ; make install - - - - - -## Build ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && cd ${DIR} && \ - ./configure \ - --disable-debug \ - --disable-doc \ - --disable-ffplay \ - --enable-cuda \ - --enable-cuvid \ - --enable-fontconfig \ - --enable-gpl \ - --enable-libaom \ - --enable-libaribb24 \ - --enable-libass \ - --enable-libbluray \ - --enable-libfdk_aac \ - --enable-libfreetype \ - --enable-libkvazaar \ - --enable-libmp3lame \ - --enable-libnpp \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-libopenjpeg \ - --enable-libopus \ - --enable-libsrt \ - --enable-libtheora \ - --enable-libvidstab \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libx264 \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libzimg \ - --enable-libzmq \ - --enable-nonfree \ - --enable-nvenc \ - --enable-openssl \ - --enable-postproc \ - --enable-shared \ - --enable-small \ - --enable-version3 \ - --extra-cflags="-I${PREFIX}/include -I${PREFIX}/include/ffnvcodec -I/usr/local/cuda/include/" \ - --extra-ldflags="-L${PREFIX}/lib -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib32/" \ - --extra-libs=-ldl \ - --extra-libs=-lpthread \ - --prefix="${PREFIX}" && \ - make clean && \ - make && \ - make install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ - -## cleanup -RUN \ - LD_LIBRARY_PATH="${PREFIX}/lib:${PREFIX}/lib64:${LD_LIBRARY_PATH}" ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/* /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - - - -FROM runtime-base AS release -LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ - org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -# copy only needed files, without copying nvidia dev files -COPY --from=build /usr/local/bin /usr/local/bin/ -COPY --from=build /usr/local/share /usr/local/share/ -COPY --from=build /usr/local/lib /usr/local/lib/ -COPY --from=build /usr/local/include /usr/local/include/ - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output diff --git a/docker-images/7.0/nvidia2404/Dockerfile b/docker-images/7.0/nvidia2404/Dockerfile new file mode 100644 index 000000000..9aa44a7dc --- /dev/null +++ b/docker-images/7.0/nvidia2404/Dockerfile @@ -0,0 +1,231 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# +# Stage 1: Build ( https://hub.docker.com/r/nvidia/cuda ) +FROM nvidia/cuda:12.6.2-devel-ubuntu24.04 AS builder + +ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,video +ENV DEBIAN_FRONTEND=noninteractive + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + +ENV ENV FFMPEG_VERSION=7.0.2 + +ENV NVIDIA_HEADERS_VERSION=11.1.5.3 + +## opencore-amr - https://sourceforge.net/projects/opencore-amr/ +## x264 - http://www.videolan.org/developers/x264.html +## x265 - http://x265.org/ ( videolan ) +## libogg - https://www.xiph.org/ogg/ ( xiph ) +## libopus - https://www.opus-codec.org/ ( xiph ) +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus +## libvorbis - https://xiph.org/vorbis/ ( xiph ) +## libvpx - https://www.webmproject.org/code/ +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx +## libwebp - https://developers.google.com/speed/webp/ +## libmp3lame - http://lame.sourceforge.net/ +## xvid - https://www.xvid.com/ (xvidcore) +## fdk-aac - https://github.com/mstorsjo/fdk-aac +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac +## openjpeg - https://github.com/uclouvain/openjpeg +## freetype - https://www.freetype.org/ +## consider passing --no-install-recommends for this one its globbie (if you do, pass in libfreetype6) +## libvidstab - https://github.com/georgmartius/vid.stab +## fridibi - https://www.fribidi.org/ +## fontconfig - https://www.freedesktop.org/wiki/Software/fontconfig/ +## libass - https://github.com/libass/libass +## lib aom - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libaom +## libsvtav1 - https://gitlab.com/AOMediaCodec/SVT-AV1.git +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libsvtav1 +## libdav1d - https://code.videolan.org/videolan/dav1d +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libdav1d +## util-macros - (x.org) (and supporting libraries) for screen capture https://xcb.freedesktop.org/ +## xproto - (x.org) +## libXau - +## libpthread - libpthread-stubs +## libxml2 - for libbluray +## libbluray - Requires libxml, freetype, and fontconfig +## libzmq - https://github.com/zeromq/libzmq/ +## this one pulls in a bunch of dependencies +## libpng - this one also pulls in a bunch of stuff +## libaribb24 - +## zimg - https://github.com/sekrit-twc/zimg +## libtheora - http://www.theora.org/ ( xiph ) +## - https://stackoverflow.com/questions/4810996/how-to-resolve-configure-guessing-build-type-failure +## libsrt - https://github.com/Haivision/srt +## Secure Reliable Transport UDP streaming library +## multiple flavors (OpenSSL flavour) and ( GnuTLS flavour) +ARG OPENCORE_PKGS="libopencore-amrnb-dev libopencore-amrnb0 libopencore-amrwb-dev libopencore-amrwb0" +ARG X264_PKGS="libx264-164 libx264-dev" +ARG X265_PKGS="libnuma1 libx265-199 libx265-dev" +# libnuma-dev +ARG OGG_PKGS="libogg-dev libogg0" +ARG OPUS_PKGS="libopus-dev libopus0" +ARG VORBIS_PKGS="libvorbis-dev libvorbis0a libvorbisenc2 libvorbisfile3" +ARG VPX_PKGS="libvpx-dev libvpx9" +ARG WEBP_PKGS="libsharpyuv-dev libsharpyuv0 libwebp-dev libwebp7 libwebpdecoder3 libwebpdemux2 libwebpmux3" +ARG MP3LAME_PKGS="libmp3lame-dev libmp3lame0" +ARG XVIDCORE_PKGS="libxvidcore-dev libxvidcore4" +ARG FDKAAC_PKGS="libfdk-aac-dev libfdk-aac2" +ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev" +# bzip2-doc fontconfig-config fonts-dejavu-core fonts-dejavu-mono libaom3 libbrotli-dev +# libbrotli1 libbsd0 libbz2-dev libc-dev-bin libc-devtools libc6-dev libcrypt-dev libde265-0 +# libdeflate0 libfontconfig1 libfreetype6 libgd3 libheif-plugin-aomdec +# libheif-plugin-aomenc libheif-plugin-libde265 libheif1 libjbig0 libjpeg-turbo8 +# libjpeg8 liblerc4 libpng-dev libpng-tools libpng16-16t64 libsharpyuv0 libtiff6 +# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev +# manpages manpages-dev rpcsvc-proto zlib1g-dev +ARG FREETYPE_PKGS="libfreetype6-dev" +ARG FONTCONFIG_PKGS="libfontconfig-dev libfontconfig1 fontconfig-config fontconfig-config fonts-dejavu-core fonts-dejavu-mono" +ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1" +ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0" +# libass-dev wanted to install a boat-load of packages +ARG LIBASS_PKGS="libass-dev libass9" +ARG AOM_PKGS="libaom-dev libaom3" +ARG SVTAV1_PKGS="libsvtav1-dev libsvtav1enc-dev libsvtav1enc1d1 libsvtav1dec-dev libsvtav1dec0" +ARG DAV1D_PKGS="libdav1d-dev libdav1d7" +# LIBDRM_PKGS picks ups some of the XORG_MACROS_PKGS as well +ARG XORG_MACROS_PKGS="libxcb-shm0-dev libxcb-shm0 libxcb-xfixes0 libxcb-xfixes0-dev" +ARG XPROTO_PKGS="x11proto-core-dev x11proto-dev" +ARG XAU_PKGS="libxau-dev libxau6" +ARG PTHREADS_STUBS_PKGS="libpthread-stubs0-dev" +ARG XML2_PKGS="libxml2-dev libxml2" +ARG BLURAY_PKGS="libbluray-dev libbluray2" +ARG ZMQ_PKGS="libzmq3-dev libzmq5" +# libpng-tools +ARG PNG_PKGS="libpng-dev libpng16-16t64" +ARG ARIBB24_PKGS="libaribb24-dev" +ARG ZIMG_PKGS="libzimg-dev libzimg2" +ARG THEORA_PKGS="libtheora-dev libtheora0" +ARG SRT_PKGS="libssl-dev libsrt-openssl-dev libsrt1.5-openssl" +ARG LIBDRM_PKGS="libbsd0 libdrm-dev libdrm2 libxcb1-dev libxcb1" + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" + + +# Note: I don't think we need 'ca-certificates' +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +RUN buildDeps="autoconf \ + automake \ + cmake \ + build-essential \ + texinfo \ + curl \ + wget \ + tar \ + bzip2 \ + libexpat1-dev \ + gcc \ + git \ + git-core \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + perl \ + pkg-config \ + python3 \ + yasm \ + zlib1g-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libsdl2-dev \ + libva-dev \ + libvdpau-dev \ + libnuma-dev \ + libdav1d-dev \ + openssl \ + libssl-dev \ + expat \ + libgomp1 \ + ca-certificates \ + libxcb-shape0-dev \ + libavformat-dev" && \ + apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ${buildDeps} + +RUN \ + echo "Installing dependencies..." && \ + apt-get install -yq --no-install-recommends ${OPENCORE_PKGS} ${X264_PKGS} ${X265_PKGS} ${OGG_PKGS} ${OPUS_PKGS} ${VORBIS_PKGS} ${VPX_PKGS} ${WEBP_PKGS} ${MP3LAME_PKGS} ${XVIDCORE_PKGS} ${FDKAAC_PKGS} ${OPENJP_PKGS} ${FREETYPE_PKGS} ${VIDSTAB_PKGS} ${FRIBIDI_PKGS} ${FONTCONFIG_PKGS} ${LIBASS_PKGS} ${AOM_PKGS} ${SVTAV1_PKGS} ${DAV1D_PKGS} ${XORG_MACROS_PKGS} ${XPROTO_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${BLURAY_PKGS} ${ZMQ_PKGS} ${PNG_PKGS} ${ARIBB24_PKGS} ${ZIMG_PKGS} ${THEORA_PKGS} ${SRT_PKGS} ${LIBDRM_PKGS} + + # apt install libdrm-dev + +## libvmaf https://github.com/Netflix/vmaf +## https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 +RUN \ + echo "Adding g++ for VMAF build" && \ + apt-get install -yq g++ + +# Note: pass '--library-list lib1,lib2,lib3 for more control. +# Here we have 3 libs that we have to build from source +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar,libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list nvidia-codec-headers +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-7.0 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +## when debugging you can pass in || true to the end of the command +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/install_ffmpeg.sh + + + +# Stage 2: Final Image ( shrink the size back down ) +# FROM nvidia/cuda:12.6.2-runtime-ubuntu24.04 +FROM nvidia/cuda:12.6.2-base-ubuntu24.04 AS runtime +# We used to use runtime, but I switched us to base, as it is significantly-smaller. +# (~ 80Megs ) base: Includes the CUDA runtime (cudart) +# (~ 1.4Gigs) runtime: Builds on the base and includes the CUDA math libraries⁠, and NCCL⁠. +# (~ 4 Gigs ) devel: Builds on the runtime and includes headers, development tools for building CUDA images. + +# COPY --from=builder /usr/local /usr/local/ +# copy only needed files, without copying nvidia dev files +COPY --from=builder /usr/local/bin /usr/local/bin/ +COPY --from=builder /usr/local/share /usr/local/share/ +COPY --from=builder /usr/local/lib /usr/local/lib/ +COPY --from=builder /usr/local/include /usr/local/include/ + +ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,video +ENV DEBIAN_FRONTEND=nonintercative +WORKDIR /tmp/workdir + +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 libxcb-shape0-dev && \ + apt-get autoremove -y && \ + apt-get clean -y + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["ffmpeg"] diff --git a/docker-images/7.0/nvidia2404/build_source.sh b/docker-images/7.0/nvidia2404/build_source.sh new file mode 100644 index 000000000..04275b3d1 --- /dev/null +++ b/docker-images/7.0/nvidia2404/build_source.sh @@ -0,0 +1,432 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure --disable-debug \ + --disable-doc \ + --disable-ffplay \ + --enable-cuda \ + --enable-cuvid \ + --enable-fontconfig \ + --enable-gpl \ + --enable-libaom \ + --enable-libaribb24 \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-libfreetype \ + --enable-libharfbuzz \ + --enable-libkvazaar \ + --enable-libmp3lame \ + --enable-libnpp \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-libsrt \ + --enable-libsvtav1 \ + --enable-libtheora \ + --enable-libvidstab \ + --enable-libvmaf \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-libzmq \ + --enable-nonfree \ + --enable-nvenc \ + --enable-openssl \ + --enable-postproc \ + --enable-shared \ + --enable-small \ + --enable-version3 \ + --extra-cflags="-I${PREFIX}/include -I${PREFIX}/include/ffnvcodec -I/usr/local/cuda/include/ -I/usr/include/x86_64-linux-gnu" \ + --extra-ldflags="-L${PREFIX}/lib -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib32/ -L/usr/lib/x86_64-linux-gnu -L/usr/lib" \ + --extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu \ + --extra-libs=-ldl \ + --extra-libs=-lm \ + --extra-libs=-lpthread \ + --ld=g++ \ + --prefix="${PREFIX}" && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/7.0/nvidia2404/download_tarballs.sh b/docker-images/7.0/nvidia2404/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/docker-images/7.0/nvidia2404/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/docker-images/7.0/nvidia2404/generate-source-of-truth-ffmpeg-versions.py b/docker-images/7.0/nvidia2404/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/docker-images/7.0/nvidia2404/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/docker-images/7.0/nvidia2404/install_ffmpeg.sh b/docker-images/7.0/nvidia2404/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/docker-images/7.0/nvidia2404/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/docker-images/7.0/scratch313/Dockerfile b/docker-images/7.0/scratch313/Dockerfile deleted file mode 100644 index bf616ec8b..000000000 --- a/docker-images/7.0/scratch313/Dockerfile +++ /dev/null @@ -1,585 +0,0 @@ -# ffmpeg - http://ffmpeg.org/download.html -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# - -FROM alpine:3.13 AS build - -WORKDIR /tmp/workdir - -ENV FFMPEG_VERSION=7.0.2 \ - AOM_VERSION=v3.8.1 \ - CHROMAPRINT_VERSION=1.5.0 \ - FDKAAC_VERSION=0.1.5 \ - FONTCONFIG_VERSION=2.12.4 \ - FREETYPE_VERSION=2.10.4 \ - FRIBIDI_VERSION=0.19.7 \ - KVAZAAR_VERSION=2.0.0 \ - LAME_VERSION=3.100 \ - LIBASS_VERSION=0.13.7 \ - LIBPTHREAD_STUBS_VERSION=0.4 \ - LIBVIDSTAB_VERSION=1.1.0 \ - LIBXCB_VERSION=1.13.1 \ - XCBPROTO_VERSION=1.13 \ - OGG_VERSION=1.3.2 \ - OPENCOREAMR_VERSION=0.1.5 \ - OPUS_VERSION=1.2 \ - OPENJPEG_VERSION=2.1.2 \ - PYTHON=python3 \ - THEORA_VERSION=1.1.1 \ - VORBIS_VERSION=1.3.5 \ - VPX_VERSION=1.8.0 \ - WEBP_VERSION=1.0.2 \ - X264_VERSION=20170226-2245-stable \ - X265_VERSION=3.4 \ - XAU_VERSION=1.0.9 \ - XORG_MACROS_VERSION=1.19.2 \ - XPROTO_VERSION=7.0.31 \ - XVID_VERSION=1.3.4 \ - LIBXML2_VERSION=2.9.12 \ - LIBBLURAY_VERSION=1.1.2 \ - LIBZMQ_VERSION=4.3.2 \ - LIBSRT_VERSION=1.4.1 \ - LIBARIBB24_VERSION=1.0.3 \ - LIBPNG_VERSION=1.6.9 \ - LIBVMAF_VERSION=2.1.1 \ - ZIMG_VERSION=3.0.5 \ - SRC=/usr/local - -ARG FREETYPE_SHA256SUM="5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac freetype-2.10.4.tar.gz" -ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz" -ARG LIBASS_SHA256SUM="8fadf294bf701300d4605e6f1d92929304187fca4b8d8a47889315526adbafd7 0.13.7.tar.gz" -ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz" -ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" -ARG LIBBLURAY_SHA256SUM="a3dd452239b100dc9da0d01b30e1692693e2a332a7d29917bf84bb10ea7c0b42 libbluray-1.1.2.tar.bz2" -ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz" -ARG LIBARIBB24_SHA256SUM="f61560738926e57f9173510389634d8c06cabedfa857db4b28fb7704707ff128 v1.0.3.tar.gz" - - -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" -ARG PREFIX="/opt/ffmpeg" -ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64" - - -RUN buildDeps="autoconf \ - automake \ - bash \ - binutils \ - bzip2 \ - ca-certificates \ - cmake \ - coreutils \ - curl \ - diffutils \ - expat-dev \ - file \ - g++ \ - gcc \ - git \ - gperf \ - libcrypto1.1 \ - libgcc \ - libssl1.1 \ - libstdc++ \ - libtool \ - make \ - nasm \ - openssl-dev \ - python3 \ - tar \ - xcb-proto \ - yasm \ - zlib-dev" && \ - apk add --update ${buildDeps} - -## libvmaf https://github.com/Netflix/vmaf -RUN \ - if which meson || false; then \ - echo "Building VMAF." && \ - DIR=/tmp/vmaf && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Netflix/vmaf/archive/v${LIBVMAF_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBVMAF_VERSION}.tar.gz && \ - cd /tmp/vmaf/libvmaf && \ - meson build --buildtype release --prefix=${PREFIX} && \ - ninja -vC build && \ - ninja -vC build install && \ - mkdir -p ${PREFIX}/share/model/ && \ - cp -r /tmp/vmaf/model/* ${PREFIX}/share/model/ && \ - rm -rf ${DIR}; \ - else \ - echo "VMAF skipped."; \ - fi - -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make && \ - make install && \ - rm -rf ${DIR} -### x265 http://x265.org/ -RUN \ - DIR=/tmp/x265 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/videolan/x265/archive/refs/tags/${X265_VERSION}.tar.gz | \ - tar -zx && \ - cd x265-${X265_VERSION}/build/linux && \ - sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ - sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ - ./multilib.sh && \ - make -C 8bit install && \ - rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make && \ - make install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/lame/files/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make && \ - make install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make && \ - make install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make && \ - make install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make install && \ - rm -rf ${DIR} -## fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ -RUN \ - DIR=/tmp/fontconfig && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libass https://github.com/libass/libass -RUN \ - DIR=/tmp/libass && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/libass/libass/archive/${LIBASS_VERSION}.tar.gz && \ - echo ${LIBASS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${LIBASS_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/aom && \ - git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ - cd ${DIR} ; \ - rm -rf CMakeCache.txt CMakeFiles ; \ - mkdir -p ./aom_build ; \ - cd ./aom_build ; \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ - make ; \ - make install ; \ - rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - - -## libxml2 - for libbluray -RUN \ - DIR=/tmp/libxml2 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/GNOME/libxml2/archive/refs/tags/v${LIBXML2_VERSION}.tar.gz | \ - tar -xz --strip-components=1 && \ - ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libbluray - Requires libxml, freetype, and fontconfig -RUN \ - DIR=/tmp/libbluray && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.videolan.org/pub/videolan/libbluray/${LIBBLURAY_VERSION}/libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - echo ${LIBBLURAY_SHA256SUM} | sha256sum --check && \ - tar -jx --strip-components=1 -f libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libsrt https://github.com/Haivision/srt -RUN \ - DIR=/tmp/srt && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Haivision/srt/archive/v${LIBSRT_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBSRT_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libpng -RUN \ - DIR=/tmp/png && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - git clone https://git.code.sf.net/p/libpng/code ${DIR} -b v${LIBPNG_VERSION} --depth 1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libaribb24 -RUN \ - DIR=/tmp/b24 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/nkoriyama/aribb24/archive/v${LIBARIBB24_VERSION}.tar.gz && \ - echo ${LIBARIBB24_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBARIBB24_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -# zimg https://github.com/sekrit-twc/zimg -RUN \ - DIR=/tmp/zimg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/sekrit-twc/zimg/archive/refs/tags/release-${ZIMG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## Download ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - ./configure --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --extra-libs=-ldl && \ - make ; make install - - - - - -## Build ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && cd ${DIR} && \ - ./configure \ - --disable-debug \ - --disable-doc \ - --disable-ffplay \ - --enable-fontconfig \ - --enable-gpl \ - --enable-libaom \ - --enable-libaribb24 \ - --enable-libass \ - --enable-libbluray \ - --enable-libfdk_aac \ - --enable-libfreetype \ - --enable-libkvazaar \ - --enable-libmp3lame \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-libopenjpeg \ - --enable-libopus \ - --enable-libsrt \ - --enable-libtheora \ - --enable-libvidstab \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libx264 \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libzimg \ - --enable-libzmq \ - --enable-nonfree \ - --enable-openssl \ - --enable-postproc \ - --enable-shared \ - --enable-small \ - --enable-version3 \ - --extra-cflags="-I${PREFIX}/include" \ - --extra-ldflags="-L${PREFIX}/lib" \ - --extra-libs=-ldl \ - --extra-libs=-lpthread \ - --prefix="${PREFIX}" && \ - make clean && \ - make && \ - make install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ - - -RUN \ - mkdir -p /tmp/fakeroot/lib && \ - ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ && \ - for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done && \ - cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ && \ - LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf - -### Release Stage -FROM scratch AS release -LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ - org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["/bin/ffmpeg"] - -COPY --from=build /tmp/fakeroot/ / - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output diff --git a/docker-images/7.0/scratch320/Dockerfile b/docker-images/7.0/scratch320/Dockerfile new file mode 100644 index 000000000..53fd73013 --- /dev/null +++ b/docker-images/7.0/scratch320/Dockerfile @@ -0,0 +1,209 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# + +FROM alpine:3.20 AS builder + +RUN apk add --no-cache --update libgcc libstdc++ ca-certificates openssl expat git libgomp less tree file vim bash +# apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + +RUN chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +ENV FFMPEG_VERSION=7.0.2 + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" + + + +RUN buildDeps="autoconf \ + automake \ + bash \ + binutils \ + bzip2 \ + cmake \ + coreutils \ + curl \ + jq \ + diffutils \ + expat-dev \ + file \ + g++ \ + gcc \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + openssl-dev \ + python3 \ + tar \ + xz \ + bzip2 \ + xcb-proto \ + yasm \ + zlib-dev \ + alpine-sdk \ + linux-headers\ + ## https://www.fribidi.org/ + fribidi \ + fribidi-static \ + fribidi-dev\ + # https://github.com/libass/libass + libass \ + libass-dev\ + # https://www.x.org/archive/individual/proto/ + xorgproto \ + # https://git.code.sf.net/p/libpng/code + libpng \ + libpng-static \ + libpng-utils \ + libpng-dev\ + dav1d \ + libdav1d \ + dav1d-dev" && \ + apk add --no-cache --update ${buildDeps} + +# Note: pass '--library-list' to 'generate-source-of-truth-ffmpeg-versions.py' +# ex: '--library-list lib1,lib2,lib3' +# for more control over the build process, and how the docker layers are cached + +# RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libopencore-amr,libx264,libx265,libogg,libopus,libvorbis,libvpx,libwebp,libmp3lame,libxvid,libfdk-aac,openjpeg,freetype,libvidstab,fribidi,fontconfig,libass,kvazaar,aom,libsvtav1,xorg-macros,xproto,libxau,libpthread-stubs,libxml2,libbluray,libzmq,libpng,libaribb24,zimg,libtheora,libsrt,libvmaf,ffmpeg +# dont do this 👆 where all of the libs are built at one time. +# by splitting them up into batches we allow docker to cache the layers ( which is a lifesaver when debugging ) +# I left this line in here, as it shows the proper order of the libraries that need to be built. ( what worked ) +# there are only a few build deps. I remember that libtheora needed libogg. + +# RUN \ +# echo "Installing dependencies..." && \ +# apt-get install -yq --no-install-recommends ${FRIBIDI_PKGS} ${LIBASS_PKGS} ${XORG_MACROS_PKGS} ${XAU_PKGS} ${XML2_PKGS} ${PNG_PKGS} + # apt-get install -yq --no-install-recommends ${FRIBIDI_PKGS} ${LIBASS_PKGS} ${XORG_MACROS_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${PNG_PKGS} + + +# First batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libopencore-amr,\ +libx264,\ +libx265,\ +libogg,\ +libopus +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libvorbis,\ +libvpx,\ +libwebp,\ +libmp3lame +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libxvid,libpthread-stubs +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libfdk-aac,\ +openjpeg,\ +freetype,\ +libvidstab +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list fontconfig +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +aom,\ +xorg-macros,\ +libsvtav1 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +# note: took out 'xproto' because of the configure.guess error +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libxau +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libxml2,\ +libbluray,\ +libzmq +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libaribb24,\ +zimg +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libtheora +# Note: libtheora is dependant on libogg +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# # additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libsrt,\ +libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# This is a slow one, put it on its own container layer to speed up the build (allowing it to be cached) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-7.0 +## when debugging you can pass in || true to the end of the next 3 commands +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# TODO add a strip and fakeroot argument +RUN /tmp/workdir/install_ffmpeg.sh --strip + + +### Release Stage +FROM alpine:3.20 AS release +# RUN apk add --no-cache --update bash less tree file vim +COPY --from=builder /usr/local /usr/local +COPY --from=builder /tmp/fakeroot/ / + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["/bin/ffmpeg"] diff --git a/docker-images/7.0/scratch320/build_source.sh b/docker-images/7.0/scratch320/build_source.sh new file mode 100644 index 000000000..e5d8f57e4 --- /dev/null +++ b/docker-images/7.0/scratch320/build_source.sh @@ -0,0 +1,427 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure --disable-debug \ + --disable-doc \ + --disable-ffplay \ + --enable-fontconfig \ + --enable-gpl \ + --enable-libaom \ + --enable-libaribb24 \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-libfreetype \ + --enable-libkvazaar \ + --enable-libmp3lame \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-libsrt \ + --enable-libsvtav1 \ + --enable-libtheora \ + --enable-libvidstab \ + --enable-libvmaf \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-libzmq \ + --enable-nonfree \ + --enable-openssl \ + --enable-postproc \ + --enable-shared \ + --enable-small \ + --enable-version3 \ + --extra-cflags="-I${PREFIX}/include -I/usr/include/x86_64-linux-gnu" \ + --extra-ldflags="-L${PREFIX}/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib" \ + --extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu \ + --extra-libs=-ldl \ + --extra-libs=-lm \ + --extra-libs=-lpthread \ + --ld=g++ \ + --prefix="${PREFIX}" && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/7.0/scratch320/download_tarballs.sh b/docker-images/7.0/scratch320/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/docker-images/7.0/scratch320/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/docker-images/7.0/scratch320/generate-source-of-truth-ffmpeg-versions.py b/docker-images/7.0/scratch320/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/docker-images/7.0/scratch320/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/docker-images/7.0/scratch320/install_ffmpeg.sh b/docker-images/7.0/scratch320/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/docker-images/7.0/scratch320/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/docker-images/7.0/ubuntu2204/Dockerfile b/docker-images/7.0/ubuntu2204/Dockerfile deleted file mode 100644 index 872566dfe..000000000 --- a/docker-images/7.0/ubuntu2204/Dockerfile +++ /dev/null @@ -1,590 +0,0 @@ -# ffmpeg - http://ffmpeg.org/download.html -# -# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# -FROM ubuntu:20.04 AS base - -WORKDIR /tmp/workdir - -RUN apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 && \ - apt-get autoremove -y && \ - apt-get clean -y - -FROM base as build - -ENV FFMPEG_VERSION=7.0.2 \ - AOM_VERSION=v3.8.1 \ - CHROMAPRINT_VERSION=1.5.0 \ - FDKAAC_VERSION=0.1.5 \ - FONTCONFIG_VERSION=2.12.4 \ - FREETYPE_VERSION=2.10.4 \ - FRIBIDI_VERSION=0.19.7 \ - KVAZAAR_VERSION=2.0.0 \ - LAME_VERSION=3.100 \ - LIBASS_VERSION=0.13.7 \ - LIBPTHREAD_STUBS_VERSION=0.4 \ - LIBVIDSTAB_VERSION=1.1.0 \ - LIBXCB_VERSION=1.13.1 \ - XCBPROTO_VERSION=1.13 \ - OGG_VERSION=1.3.2 \ - OPENCOREAMR_VERSION=0.1.5 \ - OPUS_VERSION=1.2 \ - OPENJPEG_VERSION=2.1.2 \ - PYTHON=python3 \ - THEORA_VERSION=1.1.1 \ - VORBIS_VERSION=1.3.5 \ - VPX_VERSION=1.8.0 \ - WEBP_VERSION=1.0.2 \ - X264_VERSION=20170226-2245-stable \ - X265_VERSION=3.4 \ - XAU_VERSION=1.0.9 \ - XORG_MACROS_VERSION=1.19.2 \ - XPROTO_VERSION=7.0.31 \ - XVID_VERSION=1.3.4 \ - LIBXML2_VERSION=2.9.12 \ - LIBBLURAY_VERSION=1.1.2 \ - LIBZMQ_VERSION=4.3.2 \ - LIBSRT_VERSION=1.4.1 \ - LIBARIBB24_VERSION=1.0.3 \ - LIBPNG_VERSION=1.6.9 \ - LIBVMAF_VERSION=2.1.1 \ - ZIMG_VERSION=3.0.5 \ - SRC=/usr/local - -ARG FREETYPE_SHA256SUM="5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac freetype-2.10.4.tar.gz" -ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz" -ARG LIBASS_SHA256SUM="8fadf294bf701300d4605e6f1d92929304187fca4b8d8a47889315526adbafd7 0.13.7.tar.gz" -ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz" -ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" -ARG LIBBLURAY_SHA256SUM="a3dd452239b100dc9da0d01b30e1692693e2a332a7d29917bf84bb10ea7c0b42 libbluray-1.1.2.tar.bz2" -ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz" -ARG LIBARIBB24_SHA256SUM="f61560738926e57f9173510389634d8c06cabedfa857db4b28fb7704707ff128 v1.0.3.tar.gz" - - -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" -ARG PREFIX="/opt/ffmpeg" -ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64" - - -ARG DEBIAN_FRONTEND=noninteractive - -RUN buildDeps="autoconf \ - automake \ - cmake \ - curl \ - bzip2 \ - libexpat1-dev \ - g++ \ - gcc \ - git \ - gperf \ - libtool \ - make \ - meson \ - nasm \ - perl \ - pkg-config \ - python \ - libssl-dev \ - yasm \ - zlib1g-dev" && \ - apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ${buildDeps} -## libvmaf https://github.com/Netflix/vmaf -RUN \ - if which meson || false; then \ - echo "Building VMAF." && \ - DIR=/tmp/vmaf && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Netflix/vmaf/archive/v${LIBVMAF_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBVMAF_VERSION}.tar.gz && \ - cd /tmp/vmaf/libvmaf && \ - meson build --buildtype release --prefix=${PREFIX} && \ - ninja -vC build && \ - ninja -vC build install && \ - mkdir -p ${PREFIX}/share/model/ && \ - cp -r /tmp/vmaf/model/* ${PREFIX}/share/model/ && \ - rm -rf ${DIR}; \ - else \ - echo "VMAF skipped."; \ - fi - -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make && \ - make install && \ - rm -rf ${DIR} -### x265 http://x265.org/ -RUN \ - DIR=/tmp/x265 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/videolan/x265/archive/refs/tags/${X265_VERSION}.tar.gz | \ - tar -zx && \ - cd x265-${X265_VERSION}/build/linux && \ - sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ - sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ - ./multilib.sh && \ - make -C 8bit install && \ - rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make && \ - make install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/lame/files/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make && \ - make install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make && \ - make install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make && \ - make install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make install && \ - rm -rf ${DIR} -## fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ -RUN \ - DIR=/tmp/fontconfig && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libass https://github.com/libass/libass -RUN \ - DIR=/tmp/libass && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/libass/libass/archive/${LIBASS_VERSION}.tar.gz && \ - echo ${LIBASS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${LIBASS_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/aom && \ - git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ - cd ${DIR} ; \ - rm -rf CMakeCache.txt CMakeFiles ; \ - mkdir -p ./aom_build ; \ - cd ./aom_build ; \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ - make ; \ - make install ; \ - rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - - -## libxml2 - for libbluray -RUN \ - DIR=/tmp/libxml2 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/GNOME/libxml2/archive/refs/tags/v${LIBXML2_VERSION}.tar.gz | \ - tar -xz --strip-components=1 && \ - ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libbluray - Requires libxml, freetype, and fontconfig -RUN \ - DIR=/tmp/libbluray && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.videolan.org/pub/videolan/libbluray/${LIBBLURAY_VERSION}/libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - echo ${LIBBLURAY_SHA256SUM} | sha256sum --check && \ - tar -jx --strip-components=1 -f libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libsrt https://github.com/Haivision/srt -RUN \ - DIR=/tmp/srt && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Haivision/srt/archive/v${LIBSRT_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBSRT_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libpng -RUN \ - DIR=/tmp/png && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - git clone https://git.code.sf.net/p/libpng/code ${DIR} -b v${LIBPNG_VERSION} --depth 1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libaribb24 -RUN \ - DIR=/tmp/b24 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/nkoriyama/aribb24/archive/v${LIBARIBB24_VERSION}.tar.gz && \ - echo ${LIBARIBB24_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBARIBB24_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -# zimg https://github.com/sekrit-twc/zimg -RUN \ - DIR=/tmp/zimg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/sekrit-twc/zimg/archive/refs/tags/release-${ZIMG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## Download ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - ./configure --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --extra-libs=-ldl && \ - make ; make install - - - - - -## Build ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && cd ${DIR} && \ - ./configure \ - --disable-debug \ - --disable-doc \ - --disable-ffplay \ - --enable-fontconfig \ - --enable-gpl \ - --enable-libaom \ - --enable-libaribb24 \ - --enable-libass \ - --enable-libbluray \ - --enable-libfdk_aac \ - --enable-libfreetype \ - --enable-libkvazaar \ - --enable-libmp3lame \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-libopenjpeg \ - --enable-libopus \ - --enable-libsrt \ - --enable-libtheora \ - --enable-libvidstab \ - --enable-libvmaf \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libx264 \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libzimg \ - --enable-libzmq \ - --enable-nonfree \ - --enable-openssl \ - --enable-postproc \ - --enable-shared \ - --enable-small \ - --enable-version3 \ - --extra-cflags="-I${PREFIX}/include" \ - --extra-ldflags="-L${PREFIX}/lib" \ - --extra-libs=-ldl \ - --extra-libs=-lpthread \ - --prefix="${PREFIX}" && \ - make clean && \ - make && \ - make install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ - -## cleanup -RUN \ - ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - -FROM base AS release -LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ - org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -COPY --from=build /usr/local /usr/local/ - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output diff --git a/docker-images/7.0/ubuntu2404-edge/Dockerfile b/docker-images/7.0/ubuntu2404-edge/Dockerfile new file mode 100644 index 000000000..f4ac629f8 --- /dev/null +++ b/docker-images/7.0/ubuntu2404-edge/Dockerfile @@ -0,0 +1,209 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# +# Stage 1: Build +FROM ubuntu:24.04 AS builder + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + + +ENV FFMPEG_VERSION=7.0.2 + +# fribidi +ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0" +# libass +ARG LIBASS_PKGS="libass-dev libass9" +# xorg-macros +ARG XORG_MACROS_PKGS="libxcb-shm0-dev libxcb-shm0 libxcb-xfixes0 libxcb-xfixes0-dev" +# libxau +ARG XAU_PKGS="libxau-dev libxau6" +# libpthread-stubs +ARG PTHREADS_STUBS_PKGS="libpthread-stubs0-dev" +# libxml2 ( started giving me download problems, so I went back to the debian package's version ) +ARG XML2_PKGS="libxml2-dev libxml2" +# libpng +ARG PNG_PKGS="libpng-dev libpng16-16t64" + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" + + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + + +RUN buildDeps="autoconf \ + automake \ + cmake \ + build-essential \ + texinfo \ + curl \ + wget \ + tar \ + bzip2 \ + libexpat1-dev \ + gcc \ + git \ + git-core \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + perl \ + pkg-config \ + python3 \ + yasm \ + zlib1g-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libsdl2-dev \ + libva-dev \ + libvdpau-dev \ + libnuma-dev \ + libdav1d-dev \ + openssl \ + libssl-dev \ + expat \ + libgomp1" && \ + apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ${buildDeps} + +# Note: pass '--library-list' to 'generate-source-of-truth-ffmpeg-versions.py' +# ex: '--library-list lib1,lib2,lib3' +# for more control over the build process, and how the docker layers are cached + +# RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libopencore-amr,libx264,libx265,libogg,libopus,libvorbis,libvpx,libwebp,libmp3lame,libxvid,libfdk-aac,openjpeg,freetype,libvidstab,fribidi,fontconfig,libass,kvazaar,aom,libsvtav1,xorg-macros,xproto,libxau,libpthread-stubs,libxml2,libbluray,libzmq,libpng,libaribb24,zimg,libtheora,libsrt,libvmaf,ffmpeg +# dont do this 👆 where all of the libs are built at one time. +# by splitting them up into batches we allow docker to cache the layers ( which is a lifesaver when debugging ) +# I left this line in here, as it shows the proper order of the libraries that need to be built. ( what worked ) +# there are only a few build deps. I remember that libtheora needed libogg. + +RUN \ + echo "Installing dependencies..." && \ + apt-get install -yq --no-install-recommends ${FRIBIDI_PKGS} ${LIBASS_PKGS} ${XORG_MACROS_PKGS} ${XAU_PKGS} ${XML2_PKGS} ${PNG_PKGS} + # apt-get install -yq --no-install-recommends ${FRIBIDI_PKGS} ${LIBASS_PKGS} ${XORG_MACROS_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${PNG_PKGS} + + +# First batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libopencore-amr,\ +libx264,\ +libx265,\ +libogg,\ +libopus +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libvorbis,\ +libvpx,\ +libwebp,\ +libmp3lame +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libxvid,libpthread-stubs +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libfdk-aac,\ +openjpeg,\ +freetype,\ +libvidstab +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list fontconfig +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +aom,\ +libsvtav1 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list xproto +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libbluray,\ +libzmq +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libaribb24,\ +zimg,\ +libtheora +# Note: libtheora is dependant on libogg +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libsrt,\ +libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# This is a slow one, put it on its own container layer to speed up the build (allowing it to be cached) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-7.0 +## when debugging you can pass in || true to the end of the next 3 commands +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/install_ffmpeg.sh + + + +# Stage 2: Final Image ( shrink the size back down ) +FROM ubuntu:24.04 AS runtime + +COPY --from=builder /usr/local /usr/local/ + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["ffmpeg"] diff --git a/docker-images/7.0/ubuntu2404-edge/build_source.sh b/docker-images/7.0/ubuntu2404-edge/build_source.sh new file mode 100644 index 000000000..e5d8f57e4 --- /dev/null +++ b/docker-images/7.0/ubuntu2404-edge/build_source.sh @@ -0,0 +1,427 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure --disable-debug \ + --disable-doc \ + --disable-ffplay \ + --enable-fontconfig \ + --enable-gpl \ + --enable-libaom \ + --enable-libaribb24 \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-libfreetype \ + --enable-libkvazaar \ + --enable-libmp3lame \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-libsrt \ + --enable-libsvtav1 \ + --enable-libtheora \ + --enable-libvidstab \ + --enable-libvmaf \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-libzmq \ + --enable-nonfree \ + --enable-openssl \ + --enable-postproc \ + --enable-shared \ + --enable-small \ + --enable-version3 \ + --extra-cflags="-I${PREFIX}/include -I/usr/include/x86_64-linux-gnu" \ + --extra-ldflags="-L${PREFIX}/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib" \ + --extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu \ + --extra-libs=-ldl \ + --extra-libs=-lm \ + --extra-libs=-lpthread \ + --ld=g++ \ + --prefix="${PREFIX}" && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/7.0/ubuntu2404-edge/download_tarballs.sh b/docker-images/7.0/ubuntu2404-edge/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/docker-images/7.0/ubuntu2404-edge/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/docker-images/7.0/ubuntu2404-edge/generate-source-of-truth-ffmpeg-versions.py b/docker-images/7.0/ubuntu2404-edge/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/docker-images/7.0/ubuntu2404-edge/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/docker-images/7.0/ubuntu2404-edge/install_ffmpeg.sh b/docker-images/7.0/ubuntu2404-edge/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/docker-images/7.0/ubuntu2404-edge/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/docker-images/7.0/ubuntu2404/Dockerfile b/docker-images/7.0/ubuntu2404/Dockerfile new file mode 100644 index 000000000..7f5cb619e --- /dev/null +++ b/docker-images/7.0/ubuntu2404/Dockerfile @@ -0,0 +1,200 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# +# Stage 1: Build +FROM ubuntu:24.04 AS builder + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + + +ENV FFMPEG_VERSION=7.0.2 + +## opencore-amr - https://sourceforge.net/projects/opencore-amr/ +## x264 - http://www.videolan.org/developers/x264.html +## x265 - http://x265.org/ ( videolan ) +## libogg - https://www.xiph.org/ogg/ ( xiph ) +## libopus - https://www.opus-codec.org/ ( xiph ) +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus +## libvorbis - https://xiph.org/vorbis/ ( xiph ) +## libvpx - https://www.webmproject.org/code/ +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx +## libwebp - https://developers.google.com/speed/webp/ +## libmp3lame - http://lame.sourceforge.net/ +## xvid - https://www.xvid.com/ (xvidcore) +## fdk-aac - https://github.com/mstorsjo/fdk-aac +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac +## openjpeg - https://github.com/uclouvain/openjpeg +## freetype - https://www.freetype.org/ +## consider passing --no-install-recommends for this one its globbie (if you do, pass in libfreetype6) +## libvidstab - https://github.com/georgmartius/vid.stab +## fridibi - https://www.fribidi.org/ +## fontconfig - https://www.freedesktop.org/wiki/Software/fontconfig/ +## libass - https://github.com/libass/libass +## lib aom - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libaom +## libsvtav1 - https://gitlab.com/AOMediaCodec/SVT-AV1.git +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libsvtav1 +## libdav1d - https://code.videolan.org/videolan/dav1d +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libdav1d +## util-macros - (x.org) (and supporting libraries) for screen capture https://xcb.freedesktop.org/ +## xproto - (x.org) +## libXau - +## libpthread - libpthread-stubs +## libxml2 - for libbluray +## libbluray - Requires libxml, freetype, and fontconfig +## libzmq - https://github.com/zeromq/libzmq/ +## this one pulls in a bunch of dependencies +## libpng - this one also pulls in a bunch of stuff +## libaribb24 - +## zimg - https://github.com/sekrit-twc/zimg +## libtheora - http://www.theora.org/ ( xiph ) +## - https://stackoverflow.com/questions/4810996/how-to-resolve-configure-guessing-build-type-failure +## libsrt - https://github.com/Haivision/srt +## Secure Reliable Transport UDP streaming library +## multiple flavors (OpenSSL flavour) and ( GnuTLS flavour) +ARG OPENCORE_PKGS="libopencore-amrnb-dev libopencore-amrnb0 libopencore-amrwb-dev libopencore-amrwb0" +ARG X264_PKGS="libx264-164 libx264-dev" +ARG X265_PKGS="libnuma1 libx265-199 libx265-dev" +# libnuma-dev +ARG OGG_PKGS="libogg-dev libogg0" +ARG OPUS_PKGS="libopus-dev libopus0" +ARG VORBIS_PKGS="libvorbis-dev libvorbis0a libvorbisenc2 libvorbisfile3" +ARG VPX_PKGS="libvpx-dev libvpx9" +ARG WEBP_PKGS="libsharpyuv-dev libsharpyuv0 libwebp-dev libwebp7 libwebpdecoder3 libwebpdemux2 libwebpmux3" +ARG MP3LAME_PKGS="libmp3lame-dev libmp3lame0" +ARG XVIDCORE_PKGS="libxvidcore-dev libxvidcore4" +ARG FDKAAC_PKGS="libfdk-aac-dev libfdk-aac2" +ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev" +# bzip2-doc fontconfig-config fonts-dejavu-core fonts-dejavu-mono libaom3 libbrotli-dev +# libbrotli1 libbsd0 libbz2-dev libc-dev-bin libc-devtools libc6-dev libcrypt-dev libde265-0 +# libdeflate0 libfontconfig1 libfreetype6 libgd3 libheif-plugin-aomdec +# libheif-plugin-aomenc libheif-plugin-libde265 libheif1 libjbig0 libjpeg-turbo8 +# libjpeg8 liblerc4 libpng-dev libpng-tools libpng16-16t64 libsharpyuv0 libtiff6 +# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev +# manpages manpages-dev rpcsvc-proto zlib1g-dev +ARG FREETYPE_PKGS="libfreetype6-dev" +ARG FONTCONFIG_PKGS="libfontconfig-dev libfontconfig1 fontconfig-config fontconfig-config fonts-dejavu-core fonts-dejavu-mono" +ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1" +ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0" +# libass-dev wanted to install a boat-load of packages +ARG LIBASS_PKGS="libass-dev libass9" +ARG AOM_PKGS="libaom-dev libaom3" +ARG SVTAV1_PKGS="libsvtav1-dev libsvtav1enc-dev libsvtav1enc1d1 libsvtav1dec-dev libsvtav1dec0" +ARG DAV1D_PKGS="libdav1d-dev libdav1d7" +# LIBDRM_PKGS picks ups some of the XORG_MACROS_PKGS as well +ARG XORG_MACROS_PKGS="libxcb-shm0-dev libxcb-shm0 libxcb-xfixes0 libxcb-xfixes0-dev" +ARG XPROTO_PKGS="x11proto-core-dev x11proto-dev" +ARG XAU_PKGS="libxau-dev libxau6" +ARG PTHREADS_STUBS_PKGS="libpthread-stubs0-dev" +ARG XML2_PKGS="libxml2-dev libxml2" +ARG BLURAY_PKGS="libbluray-dev libbluray2" +ARG ZMQ_PKGS="libzmq3-dev libzmq5" +# libpng-tools +ARG PNG_PKGS="libpng-dev libpng16-16t64" +ARG ARIBB24_PKGS="libaribb24-dev" +ARG ZIMG_PKGS="libzimg-dev libzimg2" +ARG THEORA_PKGS="libtheora-dev libtheora0" +ARG SRT_PKGS="libssl-dev libsrt-openssl-dev libsrt1.5-openssl" +ARG LIBDRM_PKGS="libbsd0 libdrm-dev libdrm2 libxcb1-dev libxcb1" + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" + + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +RUN buildDeps="autoconf \ + automake \ + cmake \ + build-essential \ + texinfo \ + curl \ + wget \ + tar \ + bzip2 \ + libexpat1-dev \ + gcc \ + git \ + git-core \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + perl \ + pkg-config \ + python3 \ + yasm \ + zlib1g-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libsdl2-dev \ + libva-dev \ + libvdpau-dev \ + libnuma-dev \ + libdav1d-dev \ + openssl \ + libssl-dev \ + expat \ + libgomp1" && \ + apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ${buildDeps} + +RUN \ + echo "Installing dependencies..." && \ + apt-get install -yq --no-install-recommends ${OPENCORE_PKGS} ${X264_PKGS} ${X265_PKGS} ${OGG_PKGS} ${OPUS_PKGS} ${VORBIS_PKGS} ${VPX_PKGS} ${WEBP_PKGS} ${MP3LAME_PKGS} ${XVIDCORE_PKGS} ${FDKAAC_PKGS} ${OPENJP_PKGS} ${FREETYPE_PKGS} ${VIDSTAB_PKGS} ${FRIBIDI_PKGS} ${FONTCONFIG_PKGS} ${LIBASS_PKGS} ${AOM_PKGS} ${SVTAV1_PKGS} ${DAV1D_PKGS} ${XORG_MACROS_PKGS} ${XPROTO_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${BLURAY_PKGS} ${ZMQ_PKGS} ${PNG_PKGS} ${ARIBB24_PKGS} ${ZIMG_PKGS} ${THEORA_PKGS} ${SRT_PKGS} ${LIBDRM_PKGS} + + # apt install libdrm-dev + +## libvmaf https://github.com/Netflix/vmaf +## https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 +RUN \ + echo "Adding g++ for VMAF build" && \ + apt-get install -yq g++ + +# Note: pass '--library-list lib1,lib2,lib3 for more control. +# Here we have 3 libs that we have to build from source +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar,libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-7.0 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +## when debugging you can pass in || true to the end of the command +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/install_ffmpeg.sh + + + +# Stage 2: Final Image ( shrink the size back down ) +FROM ubuntu:24.04 AS runtime +COPY --from=builder /usr/local /usr/local/ + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["ffmpeg"] diff --git a/docker-images/7.0/ubuntu2404/build_source.sh b/docker-images/7.0/ubuntu2404/build_source.sh new file mode 100644 index 000000000..e5d8f57e4 --- /dev/null +++ b/docker-images/7.0/ubuntu2404/build_source.sh @@ -0,0 +1,427 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure --disable-debug \ + --disable-doc \ + --disable-ffplay \ + --enable-fontconfig \ + --enable-gpl \ + --enable-libaom \ + --enable-libaribb24 \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-libfreetype \ + --enable-libkvazaar \ + --enable-libmp3lame \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-libsrt \ + --enable-libsvtav1 \ + --enable-libtheora \ + --enable-libvidstab \ + --enable-libvmaf \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-libzmq \ + --enable-nonfree \ + --enable-openssl \ + --enable-postproc \ + --enable-shared \ + --enable-small \ + --enable-version3 \ + --extra-cflags="-I${PREFIX}/include -I/usr/include/x86_64-linux-gnu" \ + --extra-ldflags="-L${PREFIX}/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib" \ + --extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu \ + --extra-libs=-ldl \ + --extra-libs=-lm \ + --extra-libs=-lpthread \ + --ld=g++ \ + --prefix="${PREFIX}" && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/7.0/ubuntu2404/download_tarballs.sh b/docker-images/7.0/ubuntu2404/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/docker-images/7.0/ubuntu2404/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/docker-images/7.0/ubuntu2404/generate-source-of-truth-ffmpeg-versions.py b/docker-images/7.0/ubuntu2404/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/docker-images/7.0/ubuntu2404/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/docker-images/7.0/ubuntu2404/install_ffmpeg.sh b/docker-images/7.0/ubuntu2404/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/docker-images/7.0/ubuntu2404/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/docker-images/7.0/vaapi2204/Dockerfile b/docker-images/7.0/vaapi2204/Dockerfile deleted file mode 100644 index 0c095521e..000000000 --- a/docker-images/7.0/vaapi2204/Dockerfile +++ /dev/null @@ -1,596 +0,0 @@ -# ffmpeg - http://ffmpeg.org/download.html -# -# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# -FROM ubuntu:22.04 AS base - -WORKDIR /tmp/workdir - -RUN apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 && \ - apt-get autoremove -y && \ - apt-get clean -y - -FROM base as build - -ENV FFMPEG_VERSION=7.0.2 \ - AOM_VERSION=v3.8.1 \ - CHROMAPRINT_VERSION=1.5.0 \ - FDKAAC_VERSION=0.1.5 \ - FONTCONFIG_VERSION=2.12.4 \ - FREETYPE_VERSION=2.10.4 \ - FRIBIDI_VERSION=0.19.7 \ - KVAZAAR_VERSION=2.0.0 \ - LAME_VERSION=3.100 \ - LIBASS_VERSION=0.13.7 \ - LIBPTHREAD_STUBS_VERSION=0.4 \ - LIBVIDSTAB_VERSION=1.1.0 \ - LIBXCB_VERSION=1.13.1 \ - XCBPROTO_VERSION=1.13 \ - OGG_VERSION=1.3.2 \ - OPENCOREAMR_VERSION=0.1.5 \ - OPUS_VERSION=1.2 \ - OPENJPEG_VERSION=2.1.2 \ - PYTHON=python3 \ - THEORA_VERSION=1.1.1 \ - VORBIS_VERSION=1.3.5 \ - VPX_VERSION=1.8.0 \ - WEBP_VERSION=1.0.2 \ - X264_VERSION=20170226-2245-stable \ - X265_VERSION=3.4 \ - XAU_VERSION=1.0.9 \ - XORG_MACROS_VERSION=1.19.2 \ - XPROTO_VERSION=7.0.31 \ - XVID_VERSION=1.3.4 \ - LIBXML2_VERSION=2.9.12 \ - LIBBLURAY_VERSION=1.1.2 \ - LIBZMQ_VERSION=4.3.2 \ - LIBSRT_VERSION=1.4.1 \ - LIBARIBB24_VERSION=1.0.3 \ - LIBPNG_VERSION=1.6.9 \ - LIBVMAF_VERSION=2.1.1 \ - ZIMG_VERSION=3.0.5 \ - SRC=/usr/local - -ARG FREETYPE_SHA256SUM="5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac freetype-2.10.4.tar.gz" -ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz" -ARG LIBASS_SHA256SUM="8fadf294bf701300d4605e6f1d92929304187fca4b8d8a47889315526adbafd7 0.13.7.tar.gz" -ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz" -ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" -ARG LIBBLURAY_SHA256SUM="a3dd452239b100dc9da0d01b30e1692693e2a332a7d29917bf84bb10ea7c0b42 libbluray-1.1.2.tar.bz2" -ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz" -ARG LIBARIBB24_SHA256SUM="f61560738926e57f9173510389634d8c06cabedfa857db4b28fb7704707ff128 v1.0.3.tar.gz" - - -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" -ARG PREFIX="/opt/ffmpeg" -ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64" - - -ARG DEBIAN_FRONTEND=noninteractive - -RUN buildDeps="autoconf \ - automake \ - cmake \ - curl \ - bzip2 \ - libexpat1-dev \ - g++ \ - gcc \ - git \ - gperf \ - libtool \ - make \ - meson \ - nasm \ - perl \ - pkg-config \ - libssl-dev \ - yasm \ - libva-dev \ - zlib1g-dev" && \ - apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ${buildDeps} -## libvmaf https://github.com/Netflix/vmaf -RUN \ - if which meson || false; then \ - echo "Building VMAF." && \ - DIR=/tmp/vmaf && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Netflix/vmaf/archive/v${LIBVMAF_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBVMAF_VERSION}.tar.gz && \ - cd /tmp/vmaf/libvmaf && \ - meson build --buildtype release --prefix=${PREFIX} && \ - ninja -vC build && \ - ninja -vC build install && \ - mkdir -p ${PREFIX}/share/model/ && \ - cp -r /tmp/vmaf/model/* ${PREFIX}/share/model/ && \ - rm -rf ${DIR}; \ - else \ - echo "VMAF skipped."; \ - fi - -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make && \ - make install && \ - rm -rf ${DIR} -### x265 http://x265.org/ -RUN \ - DIR=/tmp/x265 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/videolan/x265/archive/refs/tags/${X265_VERSION}.tar.gz | \ - tar -zx && \ - cd x265-${X265_VERSION}/build/linux && \ - sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ - sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ - ./multilib.sh && \ - make -C 8bit install && \ - rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make && \ - make install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/lame/files/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make && \ - make install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make && \ - make install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make && \ - make install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make install && \ - rm -rf ${DIR} -## fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ -RUN \ - DIR=/tmp/fontconfig && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libass https://github.com/libass/libass -RUN \ - DIR=/tmp/libass && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/libass/libass/archive/${LIBASS_VERSION}.tar.gz && \ - echo ${LIBASS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${LIBASS_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/aom && \ - git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ - cd ${DIR} ; \ - rm -rf CMakeCache.txt CMakeFiles ; \ - mkdir -p ./aom_build ; \ - cd ./aom_build ; \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ - make ; \ - make install ; \ - rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - - -## libxml2 - for libbluray -RUN \ - DIR=/tmp/libxml2 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/GNOME/libxml2/archive/refs/tags/v${LIBXML2_VERSION}.tar.gz | \ - tar -xz --strip-components=1 && \ - ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libbluray - Requires libxml, freetype, and fontconfig -RUN \ - DIR=/tmp/libbluray && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.videolan.org/pub/videolan/libbluray/${LIBBLURAY_VERSION}/libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - echo ${LIBBLURAY_SHA256SUM} | sha256sum --check && \ - tar -jx --strip-components=1 -f libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libsrt https://github.com/Haivision/srt -RUN \ - DIR=/tmp/srt && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Haivision/srt/archive/v${LIBSRT_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBSRT_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libpng -RUN \ - DIR=/tmp/png && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - git clone https://git.code.sf.net/p/libpng/code ${DIR} -b v${LIBPNG_VERSION} --depth 1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libaribb24 -RUN \ - DIR=/tmp/b24 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/nkoriyama/aribb24/archive/v${LIBARIBB24_VERSION}.tar.gz && \ - echo ${LIBARIBB24_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBARIBB24_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -# zimg https://github.com/sekrit-twc/zimg -RUN \ - DIR=/tmp/zimg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/sekrit-twc/zimg/archive/refs/tags/release-${ZIMG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## Download ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - ./configure --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --extra-libs=-ldl && \ - make ; make install - - - - - -## Build ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && cd ${DIR} && \ - ./configure \ - --disable-debug \ - --disable-doc \ - --disable-ffplay \ - --enable-fontconfig \ - --enable-gpl \ - --enable-libaom \ - --enable-libaribb24 \ - --enable-libass \ - --enable-libbluray \ - --enable-libfdk_aac \ - --enable-libfreetype \ - --enable-libkvazaar \ - --enable-libmp3lame \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-libopenjpeg \ - --enable-libopus \ - --enable-libsrt \ - --enable-libtheora \ - --enable-libvidstab \ - --enable-libvmaf \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libx264 \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libzimg \ - --enable-libzmq \ - --enable-nonfree \ - --enable-openssl \ - --enable-postproc \ - --enable-shared \ - --enable-small \ - --enable-vaapi \ - --enable-version3 \ - --extra-cflags="-I${PREFIX}/include" \ - --extra-ldflags="-L${PREFIX}/lib" \ - --extra-libs=-ldl \ - --extra-libs=-lpthread \ - --prefix="${PREFIX}" && \ - make clean && \ - make && \ - make install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ - -## cleanup -RUN \ - ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - -FROM base AS release -LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ - org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -COPY --from=build /usr/local /usr/local/ - -RUN \ - apt-get update -y && \ - apt-get install -y --no-install-recommends libva-drm2 libva2 i965-va-driver && \ - rm -rf /var/lib/apt/lists/* - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output diff --git a/docker-images/7.0/vaapi2404/Dockerfile b/docker-images/7.0/vaapi2404/Dockerfile new file mode 100644 index 000000000..44e8dabcc --- /dev/null +++ b/docker-images/7.0/vaapi2404/Dockerfile @@ -0,0 +1,205 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# +# Stage 1: Build +FROM ubuntu:24.04 AS builder + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + + +ENV FFMPEG_VERSION=7.0.2 + +## opencore-amr - https://sourceforge.net/projects/opencore-amr/ +## x264 - http://www.videolan.org/developers/x264.html +## x265 - http://x265.org/ ( videolan ) +## libogg - https://www.xiph.org/ogg/ ( xiph ) +## libopus - https://www.opus-codec.org/ ( xiph ) +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus +## libvorbis - https://xiph.org/vorbis/ ( xiph ) +## libvpx - https://www.webmproject.org/code/ +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx +## libwebp - https://developers.google.com/speed/webp/ +## libmp3lame - http://lame.sourceforge.net/ +## xvid - https://www.xvid.com/ (xvidcore) +## fdk-aac - https://github.com/mstorsjo/fdk-aac +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac +## openjpeg - https://github.com/uclouvain/openjpeg +## freetype - https://www.freetype.org/ +## consider passing --no-install-recommends for this one its globbie (if you do, pass in libfreetype6) +## libvidstab - https://github.com/georgmartius/vid.stab +## fridibi - https://www.fribidi.org/ +## fontconfig - https://www.freedesktop.org/wiki/Software/fontconfig/ +## libass - https://github.com/libass/libass +## lib aom - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libaom +## libsvtav1 - https://gitlab.com/AOMediaCodec/SVT-AV1.git +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libsvtav1 +## libdav1d - https://code.videolan.org/videolan/dav1d +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libdav1d +## util-macros - (x.org) (and supporting libraries) for screen capture https://xcb.freedesktop.org/ +## xproto - (x.org) +## libXau - +## libpthread - libpthread-stubs +## libxml2 - for libbluray +## libbluray - Requires libxml, freetype, and fontconfig +## libzmq - https://github.com/zeromq/libzmq/ +## this one pulls in a bunch of dependencies +## libpng - this one also pulls in a bunch of stuff +## libaribb24 - +## zimg - https://github.com/sekrit-twc/zimg +## libtheora - http://www.theora.org/ ( xiph ) +## - https://stackoverflow.com/questions/4810996/how-to-resolve-configure-guessing-build-type-failure +## libsrt - https://github.com/Haivision/srt +## Secure Reliable Transport UDP streaming library +## multiple flavors (OpenSSL flavour) and ( GnuTLS flavour) +ARG OPENCORE_PKGS="libopencore-amrnb-dev libopencore-amrnb0 libopencore-amrwb-dev libopencore-amrwb0" +ARG X264_PKGS="libx264-164 libx264-dev" +ARG X265_PKGS="libnuma1 libx265-199 libx265-dev" +# libnuma-dev +ARG OGG_PKGS="libogg-dev libogg0" +ARG OPUS_PKGS="libopus-dev libopus0" +ARG VORBIS_PKGS="libvorbis-dev libvorbis0a libvorbisenc2 libvorbisfile3" +ARG VPX_PKGS="libvpx-dev libvpx9" +ARG WEBP_PKGS="libsharpyuv-dev libsharpyuv0 libwebp-dev libwebp7 libwebpdecoder3 libwebpdemux2 libwebpmux3" +ARG MP3LAME_PKGS="libmp3lame-dev libmp3lame0" +ARG XVIDCORE_PKGS="libxvidcore-dev libxvidcore4" +ARG FDKAAC_PKGS="libfdk-aac-dev libfdk-aac2" +ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev" +# bzip2-doc fontconfig-config fonts-dejavu-core fonts-dejavu-mono libaom3 libbrotli-dev +# libbrotli1 libbsd0 libbz2-dev libc-dev-bin libc-devtools libc6-dev libcrypt-dev libde265-0 +# libdeflate0 libfontconfig1 libfreetype6 libgd3 libheif-plugin-aomdec +# libheif-plugin-aomenc libheif-plugin-libde265 libheif1 libjbig0 libjpeg-turbo8 +# libjpeg8 liblerc4 libpng-dev libpng-tools libpng16-16t64 libsharpyuv0 libtiff6 +# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev +# manpages manpages-dev rpcsvc-proto zlib1g-dev +ARG FREETYPE_PKGS="libfreetype6-dev" +ARG FONTCONFIG_PKGS="libfontconfig-dev libfontconfig1 fontconfig-config fontconfig-config fonts-dejavu-core fonts-dejavu-mono" +ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1" +ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0" +# libass-dev wanted to install a boat-load of packages +ARG LIBASS_PKGS="libass-dev libass9" +ARG AOM_PKGS="libaom-dev libaom3" +ARG SVTAV1_PKGS="libsvtav1-dev libsvtav1enc-dev libsvtav1enc1d1 libsvtav1dec-dev libsvtav1dec0" +ARG DAV1D_PKGS="libdav1d-dev libdav1d7" +# LIBDRM_PKGS picks ups some of the XORG_MACROS_PKGS as well +ARG XORG_MACROS_PKGS="libxcb-shm0-dev libxcb-shm0 libxcb-xfixes0 libxcb-xfixes0-dev" +ARG XPROTO_PKGS="x11proto-core-dev x11proto-dev" +ARG XAU_PKGS="libxau-dev libxau6" +ARG PTHREADS_STUBS_PKGS="libpthread-stubs0-dev" +ARG XML2_PKGS="libxml2-dev libxml2" +ARG BLURAY_PKGS="libbluray-dev libbluray2" +ARG ZMQ_PKGS="libzmq3-dev libzmq5" +# libpng-tools +ARG PNG_PKGS="libpng-dev libpng16-16t64" +ARG ARIBB24_PKGS="libaribb24-dev" +ARG ZIMG_PKGS="libzimg-dev libzimg2" +ARG THEORA_PKGS="libtheora-dev libtheora0" +ARG SRT_PKGS="libssl-dev libsrt-openssl-dev libsrt1.5-openssl" +ARG LIBDRM_PKGS="libbsd0 libdrm-dev libdrm2 libxcb1-dev libxcb1" + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" + + +ARG DEBIAN_FRONTEND=noninteractive + +# Before autoremove and clean: Image was 217.01MB +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +RUN buildDeps="autoconf \ + automake \ + cmake \ + build-essential \ + texinfo \ + curl \ + wget \ + tar \ + bzip2 \ + libexpat1-dev \ + gcc \ + git \ + git-core \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + perl \ + pkg-config \ + python3 \ + yasm \ + zlib1g-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libsdl2-dev \ + libva-dev \ + libvdpau-dev \ + libnuma-dev \ + libdav1d-dev \ + openssl \ + libssl-dev \ + expat \ + libgomp1" && \ + apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ${buildDeps} + +RUN \ + echo "Installing dependencies..." && \ + apt-get install -yq --no-install-recommends ${OPENCORE_PKGS} ${X264_PKGS} ${X265_PKGS} ${OGG_PKGS} ${OPUS_PKGS} ${VORBIS_PKGS} ${VPX_PKGS} ${WEBP_PKGS} ${MP3LAME_PKGS} ${XVIDCORE_PKGS} ${FDKAAC_PKGS} ${OPENJP_PKGS} ${FREETYPE_PKGS} ${VIDSTAB_PKGS} ${FRIBIDI_PKGS} ${FONTCONFIG_PKGS} ${LIBASS_PKGS} ${AOM_PKGS} ${SVTAV1_PKGS} ${DAV1D_PKGS} ${XORG_MACROS_PKGS} ${XPROTO_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${BLURAY_PKGS} ${ZMQ_PKGS} ${PNG_PKGS} ${ARIBB24_PKGS} ${ZIMG_PKGS} ${THEORA_PKGS} ${SRT_PKGS} ${LIBDRM_PKGS} + +RUN \ + apt-get install -y --no-install-recommends libva-drm2 libva2 i965-va-driver + + # apt install libdrm-dev + +## libvmaf https://github.com/Netflix/vmaf +## https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 +RUN \ + echo "Adding g++ for VMAF build" && \ + apt-get install -yq g++ + +# Note: pass '--library-list lib1,lib2,lib3 for more control. +# Here we have 3 libs that we have to build from source +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar,libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-7.0 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +## when debugging you can pass in || true to the end of the command +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/install_ffmpeg.sh + + + +# Stage 2: Final Image ( shrink the size back down ) +FROM ubuntu:24.04 +COPY --from=builder /usr/local /usr/local/ + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["ffmpeg"] diff --git a/docker-images/7.0/vaapi2404/build_source.sh b/docker-images/7.0/vaapi2404/build_source.sh new file mode 100644 index 000000000..05da92ac0 --- /dev/null +++ b/docker-images/7.0/vaapi2404/build_source.sh @@ -0,0 +1,428 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure --disable-debug \ + --disable-doc \ + --disable-ffplay \ + --enable-fontconfig \ + --enable-gpl \ + --enable-libaom \ + --enable-libaribb24 \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-libfreetype \ + --enable-libkvazaar \ + --enable-libmp3lame \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-libsrt \ + --enable-libsvtav1 \ + --enable-libtheora \ + --enable-libvidstab \ + --enable-libvmaf \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-libzmq \ + --enable-nonfree \ + --enable-openssl \ + --enable-postproc \ + --enable-shared \ + --enable-small \ + --enable-vaapi \ + --enable-version3 \ + --extra-cflags="-I${PREFIX}/include -I/usr/include/x86_64-linux-gnu" \ + --extra-ldflags="-L${PREFIX}/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib" \ + --extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu \ + --extra-libs=-ldl \ + --extra-libs=-lm \ + --extra-libs=-lpthread \ + --ld=g++ \ + --prefix="${PREFIX}" && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/7.0/vaapi2404/download_tarballs.sh b/docker-images/7.0/vaapi2404/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/docker-images/7.0/vaapi2404/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/docker-images/7.0/vaapi2404/generate-source-of-truth-ffmpeg-versions.py b/docker-images/7.0/vaapi2404/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/docker-images/7.0/vaapi2404/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/docker-images/7.0/vaapi2404/install_ffmpeg.sh b/docker-images/7.0/vaapi2404/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/docker-images/7.0/vaapi2404/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/docker-images/7.1/alpine320/Dockerfile b/docker-images/7.1/alpine320/Dockerfile new file mode 100644 index 000000000..087704ab3 --- /dev/null +++ b/docker-images/7.1/alpine320/Dockerfile @@ -0,0 +1,210 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# + +FROM alpine:3.20 AS builder + +RUN apk add --no-cache --update libgcc libstdc++ ca-certificates openssl expat git less tree file vim bash + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + +RUN chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +ENV FFMPEG_VERSION=7.1 + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" + + +RUN libDeps="libgomp \ + # https://github.com/zeromq/libzmq/ + zeromq \ + zeromq-dev \ + # https://sourceforge.net/projects/opencore-amr/ + opencore-amr \ + opencore-amr-dev \ + # https://www.xiph.org/ogg/ + libogg \ + libogg-static \ + libogg-dev \ + # libtheora http://www.theora.org/ + libtheora \ + libtheora-static \ + libtheora-dev \ + # http://www.videolan.org/developers/x264.html + x264 \ + x264-libs \ + x264-dev \ + # http://x265.org/ + x265 \ + x265-libs \ + x265-dev \ + # https://www.opus-codec.org/ + opus \ + opus-tools \ + opus-dev \ + # https://xiph.org/vorbis/ + libvorbis \ + libvorbis-static \ + libvorbis-dev \ + # https://www.webmproject.org/code/ + libvpx \ + libvpx-utils \ + libvpx-dev \ + # https://developers.google.com/speed/webp/ + libwebp \ + libwebp-dev \ + libwebp-static \ + libwebp-tools \ + # http://lame.sourceforge.net/ + lame \ + lame-libs \ + lame-dev \ + # https://www.xvid.com/ + xvidcore \ + xvidcore-static \ + xvidcore-dev \ + # https://github.com/mstorsjo/fdk-aac + fdk-aac \ + fdk-aac-dev \ + # https://github.com/uclouvain/openjpeg + openjpeg \ + openjpeg-tools \ + openjpeg-dev \ + # https://www.freetype.org/ + freetype \ + freetype-static \ + freetype-dev \ + # https://github.com/georgmartius/vid.stab + vidstab \ + vidstab-dev \ + ## https://www.fribidi.org/ + fribidi \ + fribidi-static \ + fribidi-dev \ + # fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ + fontconfig \ + fontconfig-static \ + fontconfig-dev \ + # https://github.com/libass/libass + libass \ + libass-dev \ + # https://aomedia.googlesource.com/aom + aom \ + aom-libs \ + aom-dev \ + # https://xcb.freedesktop.org/ + # https://www.x.org/archive//individual/util/util-macros- + util-macros \ + # https://www.x.org/archive/individual/proto/ + xorgproto \ + # https://www.x.org/archive/individual/lib/libXau- + libxau \ + libxau-dev \ + # https://github.com/GNOME/libxml2/ + libxml2 \ + libxml2-static \ + libxml2-utils \ + libxml2-dev \ + # https://github.com/Haivision/srt + libsrt \ + libsrt-progs \ + libsrt-dev \ + # https://git.code.sf.net/p/libpng/code + libpng \ + libpng-static \ + libpng-utils \ + libpng-dev \ + # https://github.com/sekrit-twc/zimg + zimg \ + zimg-dev \ + dav1d \ + libdav1d \ + dav1d-dev \ + svt-av1 \ + svt-av1-dev \ + libSvtAv1Enc \ + libSvtAv1Dec" && \ + apk add --no-cache --update ${libDeps} + + +RUN buildDeps="autoconf \ + automake \ + bash \ + binutils \ + bzip2 \ + cmake \ + coreutils \ + curl \ + wget \ + jq \ + diffutils \ + expat-dev \ + file \ + g++ \ + gcc \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + openssl-dev \ + python3 \ + tar \ + xz \ + xcb-proto \ + yasm \ + zlib-dev \ + alpine-sdk \ + linux-headers" && \ + apk add --no-cache --update ${buildDeps} + +# Note: pass '--library-list lib1,lib2,lib3 for more control. +# Here we have 3 libs that we have to build from source +# vmaf +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar,libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# # libevent && libevent-dev has usr/lib/libevent_pthreads ??? +# ## libbluray - Requires libxml, freetype, and fontconfig +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libpthread-stubs,libbluray,libaribb24 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-7.1 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# when debugging you can pass in || true to the end of the command +# to keep the build going even if one of the steps fails +RUN /tmp/workdir/install_ffmpeg.sh + + +### Release Stage +FROM alpine:3.20 AS release +# RUN apk add --no-cache --update bash less tree file vim +COPY --from=builder /usr/local /usr/local +COPY --from=builder /tmp/fakeroot/ / + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["/bin/ffmpeg"] diff --git a/docker-images/7.1/alpine320/build_source.sh b/docker-images/7.1/alpine320/build_source.sh new file mode 100644 index 000000000..e5d8f57e4 --- /dev/null +++ b/docker-images/7.1/alpine320/build_source.sh @@ -0,0 +1,427 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure --disable-debug \ + --disable-doc \ + --disable-ffplay \ + --enable-fontconfig \ + --enable-gpl \ + --enable-libaom \ + --enable-libaribb24 \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-libfreetype \ + --enable-libkvazaar \ + --enable-libmp3lame \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-libsrt \ + --enable-libsvtav1 \ + --enable-libtheora \ + --enable-libvidstab \ + --enable-libvmaf \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-libzmq \ + --enable-nonfree \ + --enable-openssl \ + --enable-postproc \ + --enable-shared \ + --enable-small \ + --enable-version3 \ + --extra-cflags="-I${PREFIX}/include -I/usr/include/x86_64-linux-gnu" \ + --extra-ldflags="-L${PREFIX}/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib" \ + --extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu \ + --extra-libs=-ldl \ + --extra-libs=-lm \ + --extra-libs=-lpthread \ + --ld=g++ \ + --prefix="${PREFIX}" && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/7.1/alpine320/download_tarballs.sh b/docker-images/7.1/alpine320/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/docker-images/7.1/alpine320/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/docker-images/7.1/alpine320/generate-source-of-truth-ffmpeg-versions.py b/docker-images/7.1/alpine320/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/docker-images/7.1/alpine320/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/docker-images/7.1/alpine320/install_ffmpeg.sh b/docker-images/7.1/alpine320/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/docker-images/7.1/alpine320/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/docker-images/7.1/nvidia2404/Dockerfile b/docker-images/7.1/nvidia2404/Dockerfile new file mode 100644 index 000000000..47b9532bd --- /dev/null +++ b/docker-images/7.1/nvidia2404/Dockerfile @@ -0,0 +1,231 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# +# Stage 1: Build ( https://hub.docker.com/r/nvidia/cuda ) +FROM nvidia/cuda:12.6.2-devel-ubuntu24.04 AS builder + +ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,video +ENV DEBIAN_FRONTEND=noninteractive + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + +ENV ENV FFMPEG_VERSION=7.1 + +ENV NVIDIA_HEADERS_VERSION=11.1.5.3 + +## opencore-amr - https://sourceforge.net/projects/opencore-amr/ +## x264 - http://www.videolan.org/developers/x264.html +## x265 - http://x265.org/ ( videolan ) +## libogg - https://www.xiph.org/ogg/ ( xiph ) +## libopus - https://www.opus-codec.org/ ( xiph ) +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus +## libvorbis - https://xiph.org/vorbis/ ( xiph ) +## libvpx - https://www.webmproject.org/code/ +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx +## libwebp - https://developers.google.com/speed/webp/ +## libmp3lame - http://lame.sourceforge.net/ +## xvid - https://www.xvid.com/ (xvidcore) +## fdk-aac - https://github.com/mstorsjo/fdk-aac +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac +## openjpeg - https://github.com/uclouvain/openjpeg +## freetype - https://www.freetype.org/ +## consider passing --no-install-recommends for this one its globbie (if you do, pass in libfreetype6) +## libvidstab - https://github.com/georgmartius/vid.stab +## fridibi - https://www.fribidi.org/ +## fontconfig - https://www.freedesktop.org/wiki/Software/fontconfig/ +## libass - https://github.com/libass/libass +## lib aom - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libaom +## libsvtav1 - https://gitlab.com/AOMediaCodec/SVT-AV1.git +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libsvtav1 +## libdav1d - https://code.videolan.org/videolan/dav1d +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libdav1d +## util-macros - (x.org) (and supporting libraries) for screen capture https://xcb.freedesktop.org/ +## xproto - (x.org) +## libXau - +## libpthread - libpthread-stubs +## libxml2 - for libbluray +## libbluray - Requires libxml, freetype, and fontconfig +## libzmq - https://github.com/zeromq/libzmq/ +## this one pulls in a bunch of dependencies +## libpng - this one also pulls in a bunch of stuff +## libaribb24 - +## zimg - https://github.com/sekrit-twc/zimg +## libtheora - http://www.theora.org/ ( xiph ) +## - https://stackoverflow.com/questions/4810996/how-to-resolve-configure-guessing-build-type-failure +## libsrt - https://github.com/Haivision/srt +## Secure Reliable Transport UDP streaming library +## multiple flavors (OpenSSL flavour) and ( GnuTLS flavour) +ARG OPENCORE_PKGS="libopencore-amrnb-dev libopencore-amrnb0 libopencore-amrwb-dev libopencore-amrwb0" +ARG X264_PKGS="libx264-164 libx264-dev" +ARG X265_PKGS="libnuma1 libx265-199 libx265-dev" +# libnuma-dev +ARG OGG_PKGS="libogg-dev libogg0" +ARG OPUS_PKGS="libopus-dev libopus0" +ARG VORBIS_PKGS="libvorbis-dev libvorbis0a libvorbisenc2 libvorbisfile3" +ARG VPX_PKGS="libvpx-dev libvpx9" +ARG WEBP_PKGS="libsharpyuv-dev libsharpyuv0 libwebp-dev libwebp7 libwebpdecoder3 libwebpdemux2 libwebpmux3" +ARG MP3LAME_PKGS="libmp3lame-dev libmp3lame0" +ARG XVIDCORE_PKGS="libxvidcore-dev libxvidcore4" +ARG FDKAAC_PKGS="libfdk-aac-dev libfdk-aac2" +ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev" +# bzip2-doc fontconfig-config fonts-dejavu-core fonts-dejavu-mono libaom3 libbrotli-dev +# libbrotli1 libbsd0 libbz2-dev libc-dev-bin libc-devtools libc6-dev libcrypt-dev libde265-0 +# libdeflate0 libfontconfig1 libfreetype6 libgd3 libheif-plugin-aomdec +# libheif-plugin-aomenc libheif-plugin-libde265 libheif1 libjbig0 libjpeg-turbo8 +# libjpeg8 liblerc4 libpng-dev libpng-tools libpng16-16t64 libsharpyuv0 libtiff6 +# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev +# manpages manpages-dev rpcsvc-proto zlib1g-dev +ARG FREETYPE_PKGS="libfreetype6-dev" +ARG FONTCONFIG_PKGS="libfontconfig-dev libfontconfig1 fontconfig-config fontconfig-config fonts-dejavu-core fonts-dejavu-mono" +ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1" +ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0" +# libass-dev wanted to install a boat-load of packages +ARG LIBASS_PKGS="libass-dev libass9" +ARG AOM_PKGS="libaom-dev libaom3" +ARG SVTAV1_PKGS="libsvtav1-dev libsvtav1enc-dev libsvtav1enc1d1 libsvtav1dec-dev libsvtav1dec0" +ARG DAV1D_PKGS="libdav1d-dev libdav1d7" +# LIBDRM_PKGS picks ups some of the XORG_MACROS_PKGS as well +ARG XORG_MACROS_PKGS="libxcb-shm0-dev libxcb-shm0 libxcb-xfixes0 libxcb-xfixes0-dev" +ARG XPROTO_PKGS="x11proto-core-dev x11proto-dev" +ARG XAU_PKGS="libxau-dev libxau6" +ARG PTHREADS_STUBS_PKGS="libpthread-stubs0-dev" +ARG XML2_PKGS="libxml2-dev libxml2" +ARG BLURAY_PKGS="libbluray-dev libbluray2" +ARG ZMQ_PKGS="libzmq3-dev libzmq5" +# libpng-tools +ARG PNG_PKGS="libpng-dev libpng16-16t64" +ARG ARIBB24_PKGS="libaribb24-dev" +ARG ZIMG_PKGS="libzimg-dev libzimg2" +ARG THEORA_PKGS="libtheora-dev libtheora0" +ARG SRT_PKGS="libssl-dev libsrt-openssl-dev libsrt1.5-openssl" +ARG LIBDRM_PKGS="libbsd0 libdrm-dev libdrm2 libxcb1-dev libxcb1" + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" + + +# Note: I don't think we need 'ca-certificates' +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +RUN buildDeps="autoconf \ + automake \ + cmake \ + build-essential \ + texinfo \ + curl \ + wget \ + tar \ + bzip2 \ + libexpat1-dev \ + gcc \ + git \ + git-core \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + perl \ + pkg-config \ + python3 \ + yasm \ + zlib1g-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libsdl2-dev \ + libva-dev \ + libvdpau-dev \ + libnuma-dev \ + libdav1d-dev \ + openssl \ + libssl-dev \ + expat \ + libgomp1 \ + ca-certificates \ + libxcb-shape0-dev \ + libavformat-dev" && \ + apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ${buildDeps} + +RUN \ + echo "Installing dependencies..." && \ + apt-get install -yq --no-install-recommends ${OPENCORE_PKGS} ${X264_PKGS} ${X265_PKGS} ${OGG_PKGS} ${OPUS_PKGS} ${VORBIS_PKGS} ${VPX_PKGS} ${WEBP_PKGS} ${MP3LAME_PKGS} ${XVIDCORE_PKGS} ${FDKAAC_PKGS} ${OPENJP_PKGS} ${FREETYPE_PKGS} ${VIDSTAB_PKGS} ${FRIBIDI_PKGS} ${FONTCONFIG_PKGS} ${LIBASS_PKGS} ${AOM_PKGS} ${SVTAV1_PKGS} ${DAV1D_PKGS} ${XORG_MACROS_PKGS} ${XPROTO_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${BLURAY_PKGS} ${ZMQ_PKGS} ${PNG_PKGS} ${ARIBB24_PKGS} ${ZIMG_PKGS} ${THEORA_PKGS} ${SRT_PKGS} ${LIBDRM_PKGS} + + # apt install libdrm-dev + +## libvmaf https://github.com/Netflix/vmaf +## https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 +RUN \ + echo "Adding g++ for VMAF build" && \ + apt-get install -yq g++ + +# Note: pass '--library-list lib1,lib2,lib3 for more control. +# Here we have 3 libs that we have to build from source +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar,libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list nvidia-codec-headers +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-7.1 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +## when debugging you can pass in || true to the end of the command +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/install_ffmpeg.sh + + + +# Stage 2: Final Image ( shrink the size back down ) +# FROM nvidia/cuda:12.6.2-runtime-ubuntu24.04 +FROM nvidia/cuda:12.6.2-base-ubuntu24.04 AS runtime +# We used to use runtime, but I switched us to base, as it is significantly-smaller. +# (~ 80Megs ) base: Includes the CUDA runtime (cudart) +# (~ 1.4Gigs) runtime: Builds on the base and includes the CUDA math libraries⁠, and NCCL⁠. +# (~ 4 Gigs ) devel: Builds on the runtime and includes headers, development tools for building CUDA images. + +# COPY --from=builder /usr/local /usr/local/ +# copy only needed files, without copying nvidia dev files +COPY --from=builder /usr/local/bin /usr/local/bin/ +COPY --from=builder /usr/local/share /usr/local/share/ +COPY --from=builder /usr/local/lib /usr/local/lib/ +COPY --from=builder /usr/local/include /usr/local/include/ + +ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,video +ENV DEBIAN_FRONTEND=nonintercative +WORKDIR /tmp/workdir + +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 libxcb-shape0-dev && \ + apt-get autoremove -y && \ + apt-get clean -y + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["ffmpeg"] diff --git a/docker-images/7.1/nvidia2404/build_source.sh b/docker-images/7.1/nvidia2404/build_source.sh new file mode 100644 index 000000000..04275b3d1 --- /dev/null +++ b/docker-images/7.1/nvidia2404/build_source.sh @@ -0,0 +1,432 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure --disable-debug \ + --disable-doc \ + --disable-ffplay \ + --enable-cuda \ + --enable-cuvid \ + --enable-fontconfig \ + --enable-gpl \ + --enable-libaom \ + --enable-libaribb24 \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-libfreetype \ + --enable-libharfbuzz \ + --enable-libkvazaar \ + --enable-libmp3lame \ + --enable-libnpp \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-libsrt \ + --enable-libsvtav1 \ + --enable-libtheora \ + --enable-libvidstab \ + --enable-libvmaf \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-libzmq \ + --enable-nonfree \ + --enable-nvenc \ + --enable-openssl \ + --enable-postproc \ + --enable-shared \ + --enable-small \ + --enable-version3 \ + --extra-cflags="-I${PREFIX}/include -I${PREFIX}/include/ffnvcodec -I/usr/local/cuda/include/ -I/usr/include/x86_64-linux-gnu" \ + --extra-ldflags="-L${PREFIX}/lib -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib32/ -L/usr/lib/x86_64-linux-gnu -L/usr/lib" \ + --extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu \ + --extra-libs=-ldl \ + --extra-libs=-lm \ + --extra-libs=-lpthread \ + --ld=g++ \ + --prefix="${PREFIX}" && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/7.1/nvidia2404/download_tarballs.sh b/docker-images/7.1/nvidia2404/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/docker-images/7.1/nvidia2404/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/docker-images/7.1/nvidia2404/generate-source-of-truth-ffmpeg-versions.py b/docker-images/7.1/nvidia2404/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/docker-images/7.1/nvidia2404/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/docker-images/7.1/nvidia2404/install_ffmpeg.sh b/docker-images/7.1/nvidia2404/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/docker-images/7.1/nvidia2404/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/docker-images/7.1/scratch320/Dockerfile b/docker-images/7.1/scratch320/Dockerfile new file mode 100644 index 000000000..ddc1ebfcd --- /dev/null +++ b/docker-images/7.1/scratch320/Dockerfile @@ -0,0 +1,209 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# + +FROM alpine:3.20 AS builder + +RUN apk add --no-cache --update libgcc libstdc++ ca-certificates openssl expat git libgomp less tree file vim bash +# apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + +RUN chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +ENV FFMPEG_VERSION=7.1 + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" + + + +RUN buildDeps="autoconf \ + automake \ + bash \ + binutils \ + bzip2 \ + cmake \ + coreutils \ + curl \ + jq \ + diffutils \ + expat-dev \ + file \ + g++ \ + gcc \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + openssl-dev \ + python3 \ + tar \ + xz \ + bzip2 \ + xcb-proto \ + yasm \ + zlib-dev \ + alpine-sdk \ + linux-headers\ + ## https://www.fribidi.org/ + fribidi \ + fribidi-static \ + fribidi-dev\ + # https://github.com/libass/libass + libass \ + libass-dev\ + # https://www.x.org/archive/individual/proto/ + xorgproto \ + # https://git.code.sf.net/p/libpng/code + libpng \ + libpng-static \ + libpng-utils \ + libpng-dev\ + dav1d \ + libdav1d \ + dav1d-dev" && \ + apk add --no-cache --update ${buildDeps} + +# Note: pass '--library-list' to 'generate-source-of-truth-ffmpeg-versions.py' +# ex: '--library-list lib1,lib2,lib3' +# for more control over the build process, and how the docker layers are cached + +# RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libopencore-amr,libx264,libx265,libogg,libopus,libvorbis,libvpx,libwebp,libmp3lame,libxvid,libfdk-aac,openjpeg,freetype,libvidstab,fribidi,fontconfig,libass,kvazaar,aom,libsvtav1,xorg-macros,xproto,libxau,libpthread-stubs,libxml2,libbluray,libzmq,libpng,libaribb24,zimg,libtheora,libsrt,libvmaf,ffmpeg +# dont do this 👆 where all of the libs are built at one time. +# by splitting them up into batches we allow docker to cache the layers ( which is a lifesaver when debugging ) +# I left this line in here, as it shows the proper order of the libraries that need to be built. ( what worked ) +# there are only a few build deps. I remember that libtheora needed libogg. + +# RUN \ +# echo "Installing dependencies..." && \ +# apt-get install -yq --no-install-recommends ${FRIBIDI_PKGS} ${LIBASS_PKGS} ${XORG_MACROS_PKGS} ${XAU_PKGS} ${XML2_PKGS} ${PNG_PKGS} + # apt-get install -yq --no-install-recommends ${FRIBIDI_PKGS} ${LIBASS_PKGS} ${XORG_MACROS_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${PNG_PKGS} + + +# First batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libopencore-amr,\ +libx264,\ +libx265,\ +libogg,\ +libopus +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libvorbis,\ +libvpx,\ +libwebp,\ +libmp3lame +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libxvid,libpthread-stubs +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libfdk-aac,\ +openjpeg,\ +freetype,\ +libvidstab +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list fontconfig +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +aom,\ +xorg-macros,\ +libsvtav1 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +# note: took out 'xproto' because of the configure.guess error +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libxau +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libxml2,\ +libbluray,\ +libzmq +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libaribb24,\ +zimg +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libtheora +# Note: libtheora is dependant on libogg +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# # additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libsrt,\ +libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# This is a slow one, put it on its own container layer to speed up the build (allowing it to be cached) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-7.1 +## when debugging you can pass in || true to the end of the next 3 commands +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# TODO add a strip and fakeroot argument +RUN /tmp/workdir/install_ffmpeg.sh --strip + + +### Release Stage +FROM alpine:3.20 AS release +# RUN apk add --no-cache --update bash less tree file vim +COPY --from=builder /usr/local /usr/local +COPY --from=builder /tmp/fakeroot/ / + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["/bin/ffmpeg"] diff --git a/docker-images/7.1/scratch320/build_source.sh b/docker-images/7.1/scratch320/build_source.sh new file mode 100644 index 000000000..e5d8f57e4 --- /dev/null +++ b/docker-images/7.1/scratch320/build_source.sh @@ -0,0 +1,427 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure --disable-debug \ + --disable-doc \ + --disable-ffplay \ + --enable-fontconfig \ + --enable-gpl \ + --enable-libaom \ + --enable-libaribb24 \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-libfreetype \ + --enable-libkvazaar \ + --enable-libmp3lame \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-libsrt \ + --enable-libsvtav1 \ + --enable-libtheora \ + --enable-libvidstab \ + --enable-libvmaf \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-libzmq \ + --enable-nonfree \ + --enable-openssl \ + --enable-postproc \ + --enable-shared \ + --enable-small \ + --enable-version3 \ + --extra-cflags="-I${PREFIX}/include -I/usr/include/x86_64-linux-gnu" \ + --extra-ldflags="-L${PREFIX}/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib" \ + --extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu \ + --extra-libs=-ldl \ + --extra-libs=-lm \ + --extra-libs=-lpthread \ + --ld=g++ \ + --prefix="${PREFIX}" && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/7.1/scratch320/download_tarballs.sh b/docker-images/7.1/scratch320/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/docker-images/7.1/scratch320/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/docker-images/7.1/scratch320/generate-source-of-truth-ffmpeg-versions.py b/docker-images/7.1/scratch320/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/docker-images/7.1/scratch320/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/docker-images/7.1/scratch320/install_ffmpeg.sh b/docker-images/7.1/scratch320/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/docker-images/7.1/scratch320/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/docker-images/7.1/ubuntu2404-edge/Dockerfile b/docker-images/7.1/ubuntu2404-edge/Dockerfile new file mode 100644 index 000000000..0fa13d01c --- /dev/null +++ b/docker-images/7.1/ubuntu2404-edge/Dockerfile @@ -0,0 +1,209 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# +# Stage 1: Build +FROM ubuntu:24.04 AS builder + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + + +ENV FFMPEG_VERSION=7.1 + +# fribidi +ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0" +# libass +ARG LIBASS_PKGS="libass-dev libass9" +# xorg-macros +ARG XORG_MACROS_PKGS="libxcb-shm0-dev libxcb-shm0 libxcb-xfixes0 libxcb-xfixes0-dev" +# libxau +ARG XAU_PKGS="libxau-dev libxau6" +# libpthread-stubs +ARG PTHREADS_STUBS_PKGS="libpthread-stubs0-dev" +# libxml2 ( started giving me download problems, so I went back to the debian package's version ) +ARG XML2_PKGS="libxml2-dev libxml2" +# libpng +ARG PNG_PKGS="libpng-dev libpng16-16t64" + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" + + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + + +RUN buildDeps="autoconf \ + automake \ + cmake \ + build-essential \ + texinfo \ + curl \ + wget \ + tar \ + bzip2 \ + libexpat1-dev \ + gcc \ + git \ + git-core \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + perl \ + pkg-config \ + python3 \ + yasm \ + zlib1g-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libsdl2-dev \ + libva-dev \ + libvdpau-dev \ + libnuma-dev \ + libdav1d-dev \ + openssl \ + libssl-dev \ + expat \ + libgomp1" && \ + apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ${buildDeps} + +# Note: pass '--library-list' to 'generate-source-of-truth-ffmpeg-versions.py' +# ex: '--library-list lib1,lib2,lib3' +# for more control over the build process, and how the docker layers are cached + +# RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libopencore-amr,libx264,libx265,libogg,libopus,libvorbis,libvpx,libwebp,libmp3lame,libxvid,libfdk-aac,openjpeg,freetype,libvidstab,fribidi,fontconfig,libass,kvazaar,aom,libsvtav1,xorg-macros,xproto,libxau,libpthread-stubs,libxml2,libbluray,libzmq,libpng,libaribb24,zimg,libtheora,libsrt,libvmaf,ffmpeg +# dont do this 👆 where all of the libs are built at one time. +# by splitting them up into batches we allow docker to cache the layers ( which is a lifesaver when debugging ) +# I left this line in here, as it shows the proper order of the libraries that need to be built. ( what worked ) +# there are only a few build deps. I remember that libtheora needed libogg. + +RUN \ + echo "Installing dependencies..." && \ + apt-get install -yq --no-install-recommends ${FRIBIDI_PKGS} ${LIBASS_PKGS} ${XORG_MACROS_PKGS} ${XAU_PKGS} ${XML2_PKGS} ${PNG_PKGS} + # apt-get install -yq --no-install-recommends ${FRIBIDI_PKGS} ${LIBASS_PKGS} ${XORG_MACROS_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${PNG_PKGS} + + +# First batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libopencore-amr,\ +libx264,\ +libx265,\ +libogg,\ +libopus +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libvorbis,\ +libvpx,\ +libwebp,\ +libmp3lame +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libxvid,libpthread-stubs +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libfdk-aac,\ +openjpeg,\ +freetype,\ +libvidstab +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list fontconfig +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +aom,\ +libsvtav1 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list xproto +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libbluray,\ +libzmq +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libaribb24,\ +zimg,\ +libtheora +# Note: libtheora is dependant on libogg +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libsrt,\ +libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# This is a slow one, put it on its own container layer to speed up the build (allowing it to be cached) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-7.1 +## when debugging you can pass in || true to the end of the next 3 commands +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/install_ffmpeg.sh + + + +# Stage 2: Final Image ( shrink the size back down ) +FROM ubuntu:24.04 AS runtime + +COPY --from=builder /usr/local /usr/local/ + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["ffmpeg"] diff --git a/docker-images/7.1/ubuntu2404-edge/build_source.sh b/docker-images/7.1/ubuntu2404-edge/build_source.sh new file mode 100644 index 000000000..e5d8f57e4 --- /dev/null +++ b/docker-images/7.1/ubuntu2404-edge/build_source.sh @@ -0,0 +1,427 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure --disable-debug \ + --disable-doc \ + --disable-ffplay \ + --enable-fontconfig \ + --enable-gpl \ + --enable-libaom \ + --enable-libaribb24 \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-libfreetype \ + --enable-libkvazaar \ + --enable-libmp3lame \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-libsrt \ + --enable-libsvtav1 \ + --enable-libtheora \ + --enable-libvidstab \ + --enable-libvmaf \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-libzmq \ + --enable-nonfree \ + --enable-openssl \ + --enable-postproc \ + --enable-shared \ + --enable-small \ + --enable-version3 \ + --extra-cflags="-I${PREFIX}/include -I/usr/include/x86_64-linux-gnu" \ + --extra-ldflags="-L${PREFIX}/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib" \ + --extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu \ + --extra-libs=-ldl \ + --extra-libs=-lm \ + --extra-libs=-lpthread \ + --ld=g++ \ + --prefix="${PREFIX}" && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/7.1/ubuntu2404-edge/download_tarballs.sh b/docker-images/7.1/ubuntu2404-edge/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/docker-images/7.1/ubuntu2404-edge/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/docker-images/7.1/ubuntu2404-edge/generate-source-of-truth-ffmpeg-versions.py b/docker-images/7.1/ubuntu2404-edge/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/docker-images/7.1/ubuntu2404-edge/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/docker-images/7.1/ubuntu2404-edge/install_ffmpeg.sh b/docker-images/7.1/ubuntu2404-edge/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/docker-images/7.1/ubuntu2404-edge/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/docker-images/7.1/ubuntu2404/Dockerfile b/docker-images/7.1/ubuntu2404/Dockerfile new file mode 100644 index 000000000..fd76d1da1 --- /dev/null +++ b/docker-images/7.1/ubuntu2404/Dockerfile @@ -0,0 +1,200 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# +# Stage 1: Build +FROM ubuntu:24.04 AS builder + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + + +ENV FFMPEG_VERSION=7.1 + +## opencore-amr - https://sourceforge.net/projects/opencore-amr/ +## x264 - http://www.videolan.org/developers/x264.html +## x265 - http://x265.org/ ( videolan ) +## libogg - https://www.xiph.org/ogg/ ( xiph ) +## libopus - https://www.opus-codec.org/ ( xiph ) +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus +## libvorbis - https://xiph.org/vorbis/ ( xiph ) +## libvpx - https://www.webmproject.org/code/ +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx +## libwebp - https://developers.google.com/speed/webp/ +## libmp3lame - http://lame.sourceforge.net/ +## xvid - https://www.xvid.com/ (xvidcore) +## fdk-aac - https://github.com/mstorsjo/fdk-aac +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac +## openjpeg - https://github.com/uclouvain/openjpeg +## freetype - https://www.freetype.org/ +## consider passing --no-install-recommends for this one its globbie (if you do, pass in libfreetype6) +## libvidstab - https://github.com/georgmartius/vid.stab +## fridibi - https://www.fribidi.org/ +## fontconfig - https://www.freedesktop.org/wiki/Software/fontconfig/ +## libass - https://github.com/libass/libass +## lib aom - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libaom +## libsvtav1 - https://gitlab.com/AOMediaCodec/SVT-AV1.git +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libsvtav1 +## libdav1d - https://code.videolan.org/videolan/dav1d +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libdav1d +## util-macros - (x.org) (and supporting libraries) for screen capture https://xcb.freedesktop.org/ +## xproto - (x.org) +## libXau - +## libpthread - libpthread-stubs +## libxml2 - for libbluray +## libbluray - Requires libxml, freetype, and fontconfig +## libzmq - https://github.com/zeromq/libzmq/ +## this one pulls in a bunch of dependencies +## libpng - this one also pulls in a bunch of stuff +## libaribb24 - +## zimg - https://github.com/sekrit-twc/zimg +## libtheora - http://www.theora.org/ ( xiph ) +## - https://stackoverflow.com/questions/4810996/how-to-resolve-configure-guessing-build-type-failure +## libsrt - https://github.com/Haivision/srt +## Secure Reliable Transport UDP streaming library +## multiple flavors (OpenSSL flavour) and ( GnuTLS flavour) +ARG OPENCORE_PKGS="libopencore-amrnb-dev libopencore-amrnb0 libopencore-amrwb-dev libopencore-amrwb0" +ARG X264_PKGS="libx264-164 libx264-dev" +ARG X265_PKGS="libnuma1 libx265-199 libx265-dev" +# libnuma-dev +ARG OGG_PKGS="libogg-dev libogg0" +ARG OPUS_PKGS="libopus-dev libopus0" +ARG VORBIS_PKGS="libvorbis-dev libvorbis0a libvorbisenc2 libvorbisfile3" +ARG VPX_PKGS="libvpx-dev libvpx9" +ARG WEBP_PKGS="libsharpyuv-dev libsharpyuv0 libwebp-dev libwebp7 libwebpdecoder3 libwebpdemux2 libwebpmux3" +ARG MP3LAME_PKGS="libmp3lame-dev libmp3lame0" +ARG XVIDCORE_PKGS="libxvidcore-dev libxvidcore4" +ARG FDKAAC_PKGS="libfdk-aac-dev libfdk-aac2" +ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev" +# bzip2-doc fontconfig-config fonts-dejavu-core fonts-dejavu-mono libaom3 libbrotli-dev +# libbrotli1 libbsd0 libbz2-dev libc-dev-bin libc-devtools libc6-dev libcrypt-dev libde265-0 +# libdeflate0 libfontconfig1 libfreetype6 libgd3 libheif-plugin-aomdec +# libheif-plugin-aomenc libheif-plugin-libde265 libheif1 libjbig0 libjpeg-turbo8 +# libjpeg8 liblerc4 libpng-dev libpng-tools libpng16-16t64 libsharpyuv0 libtiff6 +# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev +# manpages manpages-dev rpcsvc-proto zlib1g-dev +ARG FREETYPE_PKGS="libfreetype6-dev" +ARG FONTCONFIG_PKGS="libfontconfig-dev libfontconfig1 fontconfig-config fontconfig-config fonts-dejavu-core fonts-dejavu-mono" +ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1" +ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0" +# libass-dev wanted to install a boat-load of packages +ARG LIBASS_PKGS="libass-dev libass9" +ARG AOM_PKGS="libaom-dev libaom3" +ARG SVTAV1_PKGS="libsvtav1-dev libsvtav1enc-dev libsvtav1enc1d1 libsvtav1dec-dev libsvtav1dec0" +ARG DAV1D_PKGS="libdav1d-dev libdav1d7" +# LIBDRM_PKGS picks ups some of the XORG_MACROS_PKGS as well +ARG XORG_MACROS_PKGS="libxcb-shm0-dev libxcb-shm0 libxcb-xfixes0 libxcb-xfixes0-dev" +ARG XPROTO_PKGS="x11proto-core-dev x11proto-dev" +ARG XAU_PKGS="libxau-dev libxau6" +ARG PTHREADS_STUBS_PKGS="libpthread-stubs0-dev" +ARG XML2_PKGS="libxml2-dev libxml2" +ARG BLURAY_PKGS="libbluray-dev libbluray2" +ARG ZMQ_PKGS="libzmq3-dev libzmq5" +# libpng-tools +ARG PNG_PKGS="libpng-dev libpng16-16t64" +ARG ARIBB24_PKGS="libaribb24-dev" +ARG ZIMG_PKGS="libzimg-dev libzimg2" +ARG THEORA_PKGS="libtheora-dev libtheora0" +ARG SRT_PKGS="libssl-dev libsrt-openssl-dev libsrt1.5-openssl" +ARG LIBDRM_PKGS="libbsd0 libdrm-dev libdrm2 libxcb1-dev libxcb1" + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" + + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +RUN buildDeps="autoconf \ + automake \ + cmake \ + build-essential \ + texinfo \ + curl \ + wget \ + tar \ + bzip2 \ + libexpat1-dev \ + gcc \ + git \ + git-core \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + perl \ + pkg-config \ + python3 \ + yasm \ + zlib1g-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libsdl2-dev \ + libva-dev \ + libvdpau-dev \ + libnuma-dev \ + libdav1d-dev \ + openssl \ + libssl-dev \ + expat \ + libgomp1" && \ + apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ${buildDeps} + +RUN \ + echo "Installing dependencies..." && \ + apt-get install -yq --no-install-recommends ${OPENCORE_PKGS} ${X264_PKGS} ${X265_PKGS} ${OGG_PKGS} ${OPUS_PKGS} ${VORBIS_PKGS} ${VPX_PKGS} ${WEBP_PKGS} ${MP3LAME_PKGS} ${XVIDCORE_PKGS} ${FDKAAC_PKGS} ${OPENJP_PKGS} ${FREETYPE_PKGS} ${VIDSTAB_PKGS} ${FRIBIDI_PKGS} ${FONTCONFIG_PKGS} ${LIBASS_PKGS} ${AOM_PKGS} ${SVTAV1_PKGS} ${DAV1D_PKGS} ${XORG_MACROS_PKGS} ${XPROTO_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${BLURAY_PKGS} ${ZMQ_PKGS} ${PNG_PKGS} ${ARIBB24_PKGS} ${ZIMG_PKGS} ${THEORA_PKGS} ${SRT_PKGS} ${LIBDRM_PKGS} + + # apt install libdrm-dev + +## libvmaf https://github.com/Netflix/vmaf +## https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 +RUN \ + echo "Adding g++ for VMAF build" && \ + apt-get install -yq g++ + +# Note: pass '--library-list lib1,lib2,lib3 for more control. +# Here we have 3 libs that we have to build from source +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar,libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-7.1 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +## when debugging you can pass in || true to the end of the command +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/install_ffmpeg.sh + + + +# Stage 2: Final Image ( shrink the size back down ) +FROM ubuntu:24.04 AS runtime +COPY --from=builder /usr/local /usr/local/ + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["ffmpeg"] diff --git a/docker-images/7.1/ubuntu2404/build_source.sh b/docker-images/7.1/ubuntu2404/build_source.sh new file mode 100644 index 000000000..e5d8f57e4 --- /dev/null +++ b/docker-images/7.1/ubuntu2404/build_source.sh @@ -0,0 +1,427 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure --disable-debug \ + --disable-doc \ + --disable-ffplay \ + --enable-fontconfig \ + --enable-gpl \ + --enable-libaom \ + --enable-libaribb24 \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-libfreetype \ + --enable-libkvazaar \ + --enable-libmp3lame \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-libsrt \ + --enable-libsvtav1 \ + --enable-libtheora \ + --enable-libvidstab \ + --enable-libvmaf \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-libzmq \ + --enable-nonfree \ + --enable-openssl \ + --enable-postproc \ + --enable-shared \ + --enable-small \ + --enable-version3 \ + --extra-cflags="-I${PREFIX}/include -I/usr/include/x86_64-linux-gnu" \ + --extra-ldflags="-L${PREFIX}/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib" \ + --extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu \ + --extra-libs=-ldl \ + --extra-libs=-lm \ + --extra-libs=-lpthread \ + --ld=g++ \ + --prefix="${PREFIX}" && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/7.1/ubuntu2404/download_tarballs.sh b/docker-images/7.1/ubuntu2404/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/docker-images/7.1/ubuntu2404/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/docker-images/7.1/ubuntu2404/generate-source-of-truth-ffmpeg-versions.py b/docker-images/7.1/ubuntu2404/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/docker-images/7.1/ubuntu2404/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/docker-images/7.1/ubuntu2404/install_ffmpeg.sh b/docker-images/7.1/ubuntu2404/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/docker-images/7.1/ubuntu2404/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/docker-images/7.1/vaapi2404/Dockerfile b/docker-images/7.1/vaapi2404/Dockerfile new file mode 100644 index 000000000..6e92f3162 --- /dev/null +++ b/docker-images/7.1/vaapi2404/Dockerfile @@ -0,0 +1,205 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# +# Stage 1: Build +FROM ubuntu:24.04 AS builder + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + + +ENV FFMPEG_VERSION=7.1 + +## opencore-amr - https://sourceforge.net/projects/opencore-amr/ +## x264 - http://www.videolan.org/developers/x264.html +## x265 - http://x265.org/ ( videolan ) +## libogg - https://www.xiph.org/ogg/ ( xiph ) +## libopus - https://www.opus-codec.org/ ( xiph ) +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus +## libvorbis - https://xiph.org/vorbis/ ( xiph ) +## libvpx - https://www.webmproject.org/code/ +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx +## libwebp - https://developers.google.com/speed/webp/ +## libmp3lame - http://lame.sourceforge.net/ +## xvid - https://www.xvid.com/ (xvidcore) +## fdk-aac - https://github.com/mstorsjo/fdk-aac +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac +## openjpeg - https://github.com/uclouvain/openjpeg +## freetype - https://www.freetype.org/ +## consider passing --no-install-recommends for this one its globbie (if you do, pass in libfreetype6) +## libvidstab - https://github.com/georgmartius/vid.stab +## fridibi - https://www.fribidi.org/ +## fontconfig - https://www.freedesktop.org/wiki/Software/fontconfig/ +## libass - https://github.com/libass/libass +## lib aom - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libaom +## libsvtav1 - https://gitlab.com/AOMediaCodec/SVT-AV1.git +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libsvtav1 +## libdav1d - https://code.videolan.org/videolan/dav1d +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libdav1d +## util-macros - (x.org) (and supporting libraries) for screen capture https://xcb.freedesktop.org/ +## xproto - (x.org) +## libXau - +## libpthread - libpthread-stubs +## libxml2 - for libbluray +## libbluray - Requires libxml, freetype, and fontconfig +## libzmq - https://github.com/zeromq/libzmq/ +## this one pulls in a bunch of dependencies +## libpng - this one also pulls in a bunch of stuff +## libaribb24 - +## zimg - https://github.com/sekrit-twc/zimg +## libtheora - http://www.theora.org/ ( xiph ) +## - https://stackoverflow.com/questions/4810996/how-to-resolve-configure-guessing-build-type-failure +## libsrt - https://github.com/Haivision/srt +## Secure Reliable Transport UDP streaming library +## multiple flavors (OpenSSL flavour) and ( GnuTLS flavour) +ARG OPENCORE_PKGS="libopencore-amrnb-dev libopencore-amrnb0 libopencore-amrwb-dev libopencore-amrwb0" +ARG X264_PKGS="libx264-164 libx264-dev" +ARG X265_PKGS="libnuma1 libx265-199 libx265-dev" +# libnuma-dev +ARG OGG_PKGS="libogg-dev libogg0" +ARG OPUS_PKGS="libopus-dev libopus0" +ARG VORBIS_PKGS="libvorbis-dev libvorbis0a libvorbisenc2 libvorbisfile3" +ARG VPX_PKGS="libvpx-dev libvpx9" +ARG WEBP_PKGS="libsharpyuv-dev libsharpyuv0 libwebp-dev libwebp7 libwebpdecoder3 libwebpdemux2 libwebpmux3" +ARG MP3LAME_PKGS="libmp3lame-dev libmp3lame0" +ARG XVIDCORE_PKGS="libxvidcore-dev libxvidcore4" +ARG FDKAAC_PKGS="libfdk-aac-dev libfdk-aac2" +ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev" +# bzip2-doc fontconfig-config fonts-dejavu-core fonts-dejavu-mono libaom3 libbrotli-dev +# libbrotli1 libbsd0 libbz2-dev libc-dev-bin libc-devtools libc6-dev libcrypt-dev libde265-0 +# libdeflate0 libfontconfig1 libfreetype6 libgd3 libheif-plugin-aomdec +# libheif-plugin-aomenc libheif-plugin-libde265 libheif1 libjbig0 libjpeg-turbo8 +# libjpeg8 liblerc4 libpng-dev libpng-tools libpng16-16t64 libsharpyuv0 libtiff6 +# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev +# manpages manpages-dev rpcsvc-proto zlib1g-dev +ARG FREETYPE_PKGS="libfreetype6-dev" +ARG FONTCONFIG_PKGS="libfontconfig-dev libfontconfig1 fontconfig-config fontconfig-config fonts-dejavu-core fonts-dejavu-mono" +ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1" +ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0" +# libass-dev wanted to install a boat-load of packages +ARG LIBASS_PKGS="libass-dev libass9" +ARG AOM_PKGS="libaom-dev libaom3" +ARG SVTAV1_PKGS="libsvtav1-dev libsvtav1enc-dev libsvtav1enc1d1 libsvtav1dec-dev libsvtav1dec0" +ARG DAV1D_PKGS="libdav1d-dev libdav1d7" +# LIBDRM_PKGS picks ups some of the XORG_MACROS_PKGS as well +ARG XORG_MACROS_PKGS="libxcb-shm0-dev libxcb-shm0 libxcb-xfixes0 libxcb-xfixes0-dev" +ARG XPROTO_PKGS="x11proto-core-dev x11proto-dev" +ARG XAU_PKGS="libxau-dev libxau6" +ARG PTHREADS_STUBS_PKGS="libpthread-stubs0-dev" +ARG XML2_PKGS="libxml2-dev libxml2" +ARG BLURAY_PKGS="libbluray-dev libbluray2" +ARG ZMQ_PKGS="libzmq3-dev libzmq5" +# libpng-tools +ARG PNG_PKGS="libpng-dev libpng16-16t64" +ARG ARIBB24_PKGS="libaribb24-dev" +ARG ZIMG_PKGS="libzimg-dev libzimg2" +ARG THEORA_PKGS="libtheora-dev libtheora0" +ARG SRT_PKGS="libssl-dev libsrt-openssl-dev libsrt1.5-openssl" +ARG LIBDRM_PKGS="libbsd0 libdrm-dev libdrm2 libxcb1-dev libxcb1" + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" + + +ARG DEBIAN_FRONTEND=noninteractive + +# Before autoremove and clean: Image was 217.01MB +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +RUN buildDeps="autoconf \ + automake \ + cmake \ + build-essential \ + texinfo \ + curl \ + wget \ + tar \ + bzip2 \ + libexpat1-dev \ + gcc \ + git \ + git-core \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + perl \ + pkg-config \ + python3 \ + yasm \ + zlib1g-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libsdl2-dev \ + libva-dev \ + libvdpau-dev \ + libnuma-dev \ + libdav1d-dev \ + openssl \ + libssl-dev \ + expat \ + libgomp1" && \ + apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ${buildDeps} + +RUN \ + echo "Installing dependencies..." && \ + apt-get install -yq --no-install-recommends ${OPENCORE_PKGS} ${X264_PKGS} ${X265_PKGS} ${OGG_PKGS} ${OPUS_PKGS} ${VORBIS_PKGS} ${VPX_PKGS} ${WEBP_PKGS} ${MP3LAME_PKGS} ${XVIDCORE_PKGS} ${FDKAAC_PKGS} ${OPENJP_PKGS} ${FREETYPE_PKGS} ${VIDSTAB_PKGS} ${FRIBIDI_PKGS} ${FONTCONFIG_PKGS} ${LIBASS_PKGS} ${AOM_PKGS} ${SVTAV1_PKGS} ${DAV1D_PKGS} ${XORG_MACROS_PKGS} ${XPROTO_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${BLURAY_PKGS} ${ZMQ_PKGS} ${PNG_PKGS} ${ARIBB24_PKGS} ${ZIMG_PKGS} ${THEORA_PKGS} ${SRT_PKGS} ${LIBDRM_PKGS} + +RUN \ + apt-get install -y --no-install-recommends libva-drm2 libva2 i965-va-driver + + # apt install libdrm-dev + +## libvmaf https://github.com/Netflix/vmaf +## https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 +RUN \ + echo "Adding g++ for VMAF build" && \ + apt-get install -yq g++ + +# Note: pass '--library-list lib1,lib2,lib3 for more control. +# Here we have 3 libs that we have to build from source +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar,libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-7.1 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +## when debugging you can pass in || true to the end of the command +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/install_ffmpeg.sh + + + +# Stage 2: Final Image ( shrink the size back down ) +FROM ubuntu:24.04 +COPY --from=builder /usr/local /usr/local/ + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["ffmpeg"] diff --git a/docker-images/7.1/vaapi2404/build_source.sh b/docker-images/7.1/vaapi2404/build_source.sh new file mode 100644 index 000000000..05da92ac0 --- /dev/null +++ b/docker-images/7.1/vaapi2404/build_source.sh @@ -0,0 +1,428 @@ +#!/usr/bin/env bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" +manifestJsonVersionsFile="/tmp/workdir/generated_build_versions_manifest.json" + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif grep -q "Alpine Linux" /etc/alpine-release; then + is_alpine=true + fi +fi +######################### Callback build functions ######################### +build_libopencore-amr() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libx264() { + ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli + make + make install +} + +build_libx265() { + cd build/linux + sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh + sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh + ./multilib.sh + make -C 8bit install +} + +build_libogg() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libopus() { + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_libvorbis() { + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared + make + make install + # https://gitlab.xiph.org/xiph/vorbis + # cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="${PREFIX}" . + # make + # make install +} + +build_libvpx() { + local data=$(jq -r '.[] | select(.library_name == "libvpx")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local vpx_version=$(jq -r '.["libvpx"]' $manifestJsonVersionsFile) + if [ -n "$vpx_version" ] && [[ "$vpx_version" != "null" ]]; then + echo "Building [libvpx-${vpx_version}] in [${dir}]" + else + echo "Error: libvpx version is empty or unset" + fi + version="v${vpx_version}" + git -C libvpx pull 2> /dev/null || git clone --branch ${version} --depth 1 https://chromium.googlesource.com/webm/libvpx.git + cd libvpx + pwd + ./configure --prefix="${PREFIX}" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-pic --enable-shared --as=yasm + make + make install +} + +build_libwebp() { + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +build_libmp3lame() { + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ + make && \ + make install +} + + +build_libxvid() { + # read doc/INSTALL + cd build/generic + ./configure --help + echo "Now guess" + ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin --enable-shared" + make + make install +} + +build_libfdk-aac() { + autoreconf -fiv && \ + ./configure --prefix="${PREFIX}" --enable-shared + make + make install +} + +build_openjpeg() { + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_freetype() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libvidstab() { + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_fribidi() { + # Currently broken, need to fix + # sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am + # ./bootstrap --no-config --auto + ./configure --prefix="${PREFIX}" --disable-static --enable-shared + make -j1 + make install +} + +build_fontconfig() { + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_libass() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +build_kvazaar() { + # ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ + make && \ + make install +} + +# aom is a git clone ( to get source, so not in the loop using the callback function) +build_aom() { + local data=$(jq -r '.[] | select(.library_name == "aom")' $manifestJsonFile) + local dir=$(echo "$data" | jq -r '.build_dir') + local aom_version=$(jq -r '.["aom"]' $manifestJsonVersionsFile) # Access value with key "aom" + if [ -n "$aom_version" ] && [[ "$aom_version" != "null" ]]; then + echo "Building [aom-${aom_version}] in [${dir}]" + else + echo "Error: aom version is empty or unset" + fi + version="v${aom_version}" + git clone --branch ${version} --depth 1 https://aomedia.googlesource.com/aom ${dir} && \ + cd ${dir} && \ + mkdir -p ./aom_build && \ + cd ./aom_build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 -DENABLE_NASM=on .. && \ + make && \ + make install +} + +build_nvidia-codec-headers() { + local dir=${1} + # git clone https://github.com/FFmpeg/nv-codec-headers ${dir} + # git checkout n${NVIDIA_HEADERS_VERSION} + make PREFIX="${PREFIX}" + make install PREFIX="${PREFIX}" +} + +build_libsvtav1() { + cd Build && \ + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. \ + make && \ + make install +} + +build_xorg-macros() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_xproto() { + dir=${1} + cp /usr/share/misc/config.guess . && \ + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxau() { + dir=${1} + ./configure --srcdir=${dir} --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libpthread-stubs() { + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_libxml2() { + ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ + make && \ + make install +} + +build_libbluray() { + ## libbluray - Requires libxml, freetype, and fontconfig + ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ + make && \ + make install +} + +build_libzmq() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make && \ + make install +} + +# another special, code clone situation ( actually currently using the tarball build approach ) +build_libpng() { + local dir = "/tmp/png" + # local libpng_version=$(jq -r '.["libpng"]' $manifestJsonVersionsFile) # Access value with key "libpng" + # git clone https://git.code.sf.net/p/libpng/code ${dir} -b v${libpng_version} --depth 1 && \ + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" && \ + make check && \ + make install +} + +build_libaribb24() { + autoreconf -fiv && \ + ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ + make && \ + make install +} + +build_zimg() { + ./autogen.sh && \ + ./configure --prefix="${PREFIX}" --enable-shared && \ + make && \ + make install +} + +# Dependancy on libogg +build_libtheora() { + if [ "$is_ubuntu" = true ]; then + cp /usr/share/misc/config.guess . + fi + ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared --disable-examples + make + make install +} + +build_libsrt() { + # requires libssl-dev + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ + make && \ + make install +} + +build_libvmaf() { + # https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 + mkdir ./libvmaf/build + cd ./libvmaf/build + meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static --prefix "${PREFIX}" .. && \ + # meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=shared --prefix "${PREFIX}" .. + ninja + ninja install +} + +build_ffmpeg() { + # Here is a list of things that we enable in the ffmpeg build: that are not in the + # track configuration guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + # --enable-fontconfig + # --enable-libaribb24 + # --enable-libbluray + # --enable-libkvazaar + # --enable-libopencore-amrnb + # --enable-libopencore-amrwb + # --enable-libopenjpeg + # --enable-libsrt + # --enable-libtheora + # --enable-libvmaf + # --enable-libwebp + # --enable-libxvid + # --enable-libzimg + # --enable-libzmq + # --enable-openssl + # --enable-postproc + # --enable-small + # --enable-version3 + + # export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + ./configure --disable-debug \ + --disable-doc \ + --disable-ffplay \ + --enable-fontconfig \ + --enable-gpl \ + --enable-libaom \ + --enable-libaribb24 \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfdk-aac \ + --enable-libfreetype \ + --enable-libkvazaar \ + --enable-libmp3lame \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-libsrt \ + --enable-libsvtav1 \ + --enable-libtheora \ + --enable-libvidstab \ + --enable-libvmaf \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libwebp \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-libzmq \ + --enable-nonfree \ + --enable-openssl \ + --enable-postproc \ + --enable-shared \ + --enable-small \ + --enable-vaapi \ + --enable-version3 \ + --extra-cflags="-I${PREFIX}/include -I/usr/include/x86_64-linux-gnu" \ + --extra-ldflags="-L${PREFIX}/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib" \ + --extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu \ + --extra-libs=-ldl \ + --extra-libs=-lm \ + --extra-libs=-lpthread \ + --ld=g++ \ + --prefix="${PREFIX}" && \ + make && \ + make install && \ + make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ + make distclean && \ + hash -r && \ + cd tools && \ + make qt-faststart && cp qt-faststart ${PREFIX}/bin/ +} +######################### Helper functions ######################### +extract_tarball() { + local tarball_name=$1 + # grab the extension of the tarball + local extension="${tarball_name##*.}" + # tar extraction args: -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma + if [ "$extension" == "gz" ]; then + tar -zx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "bz2" ]; then + tar -jx --strip-components=1 -f ${tarball_name} + elif [ "$extension" == "xz" ]; then + tar -Jx --strip-components=1 -f ${tarball_name} + else + echo "Error while extract_tarball, got an unknown extension: $extension" + fi +} + +build_support_libraries() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + # handle the clone source case's ( there are only two ) + # if [ "$lib_name" == "libsvtav1" ]; then + # echo "-------------------- Running callback: build_aom --------------------" + # echo "Building 'aom' before we build $lib_name" + # build_aom + # fi + # ffmpeg is in the lib_name string then the callback name is build_ffmpeg + callback_lib_name=${lib_name} + if [[ "$lib_name" == *"ffmpeg"* ]]; then + # take out the version numbers + callback_lib_name="ffmpeg" + fi + + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + sha256sum=$(echo "$data" | jq -r '.sha256sum') + + echo "Building $lib_name: from ${build_dir}/$tarball_name" + cd $build_dir + extract_tarball $tarball_name + if [ -n "$sha256sum" ] && [[ "$sha256sum" != "null" ]]; then + echo "Checking sha256sum for $tarball_name" + echo $sha256sum | sha256sum --check + fi + # make a callback function to build the library + # if anything fails, we will exit with a non-zero status + echo "-------------------- Running callback: build_${lib_name} --------------------" + build_${callback_lib_name} ${build_dir} + echo "Finished building $lib_name removing build directory [${build_dir}]" + cd /tmp/workdir + rm -rf $build_dir + done +} + +build_support_libraries diff --git a/docker-images/7.1/vaapi2404/download_tarballs.sh b/docker-images/7.1/vaapi2404/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/docker-images/7.1/vaapi2404/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/docker-images/7.1/vaapi2404/generate-source-of-truth-ffmpeg-versions.py b/docker-images/7.1/vaapi2404/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/docker-images/7.1/vaapi2404/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/docker-images/7.1/vaapi2404/install_ffmpeg.sh b/docker-images/7.1/vaapi2404/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/docker-images/7.1/vaapi2404/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/docker-images/azure-jobs.yml b/docker-images/azure-jobs.yml index 8d096eb92..72d553a0f 100644 --- a/docker-images/azure-jobs.yml +++ b/docker-images/azure-jobs.yml @@ -8,292 +8,148 @@ jobs: maxParallel: 10 matrix: - ubuntu2204_7.0.2: + ubuntu2404_7.1: MAJOR_VERSION: 7 - VERSION: 7.0 - LONG_VERSION: 7.0.2 - VARIANT: ubuntu2204 + VERSION: 7.1 + LONG_VERSION: 7.1 + VARIANT: ubuntu2404 PARENT: ubuntu ISPARENT: True - alpine313_7.0.2: + ubuntu2404-edge_7.1: MAJOR_VERSION: 7 - VERSION: 7.0 - LONG_VERSION: 7.0.2 - VARIANT: alpine313 - PARENT: alpine + VERSION: 7.1 + LONG_VERSION: 7.1 + VARIANT: ubuntu2404-edge + PARENT: ubuntu-edge ISPARENT: True - scratch313_7.0.2: + alpine320_7.1: MAJOR_VERSION: 7 - VERSION: 7.0 - LONG_VERSION: 7.0.2 - VARIANT: scratch313 - PARENT: scratch + VERSION: 7.1 + LONG_VERSION: 7.1 + VARIANT: alpine320 + PARENT: alpine ISPARENT: True - vaapi2204_7.0.2: + scratch320_7.1: MAJOR_VERSION: 7 - VERSION: 7.0 - LONG_VERSION: 7.0.2 - VARIANT: vaapi2204 - PARENT: vaapi + VERSION: 7.1 + LONG_VERSION: 7.1 + VARIANT: scratch320 + PARENT: scratch ISPARENT: True - nvidia2204_7.0.2: + vaapi2404_7.1: MAJOR_VERSION: 7 - VERSION: 7.0 - LONG_VERSION: 7.0.2 - VARIANT: nvidia2204 - PARENT: nvidia - ISPARENT: True - - - ubuntu2204_6.1.2: - MAJOR_VERSION: 6 - VERSION: 6.1 - LONG_VERSION: 6.1.2 - VARIANT: ubuntu2204 - PARENT: ubuntu - ISPARENT: True - - - vaapi2204_6.1.2: - MAJOR_VERSION: 6 - VERSION: 6.1 - LONG_VERSION: 6.1.2 - VARIANT: vaapi2204 + VERSION: 7.1 + LONG_VERSION: 7.1 + VARIANT: vaapi2404 PARENT: vaapi ISPARENT: True - nvidia2204_6.1.2: - MAJOR_VERSION: 6 - VERSION: 6.1 - LONG_VERSION: 6.1.2 - VARIANT: nvidia2204 + nvidia2404_7.1: + MAJOR_VERSION: 7 + VERSION: 7.1 + LONG_VERSION: 7.1 + VARIANT: nvidia2404 PARENT: nvidia ISPARENT: True - ubuntu2204_5.1.6: - MAJOR_VERSION: 5 - VERSION: 5.1 - LONG_VERSION: 5.1.6 - VARIANT: ubuntu2204 + ubuntu2404_7.0.2: + MAJOR_VERSION: 7 + VERSION: 7.0 + LONG_VERSION: 7.0.2 + VARIANT: ubuntu2404 PARENT: ubuntu ISPARENT: True - alpine313_5.1.6: - MAJOR_VERSION: 5 - VERSION: 5.1 - LONG_VERSION: 5.1.6 - VARIANT: alpine313 - PARENT: alpine - ISPARENT: True - - - vaapi2204_5.1.6: - MAJOR_VERSION: 5 - VERSION: 5.1 - LONG_VERSION: 5.1.6 - VARIANT: vaapi2204 - PARENT: vaapi - ISPARENT: True - - - nvidia2204_5.1.6: - MAJOR_VERSION: 5 - VERSION: 5.1 - LONG_VERSION: 5.1.6 - VARIANT: nvidia2204 - PARENT: nvidia - ISPARENT: True - - - ubuntu2204_4.4.5: - MAJOR_VERSION: 4 - VERSION: 4.4 - LONG_VERSION: 4.4.5 - VARIANT: ubuntu2204 - PARENT: ubuntu + ubuntu2404-edge_7.0.2: + MAJOR_VERSION: 7 + VERSION: 7.0 + LONG_VERSION: 7.0.2 + VARIANT: ubuntu2404-edge + PARENT: ubuntu-edge ISPARENT: True - alpine313_4.4.5: - MAJOR_VERSION: 4 - VERSION: 4.4 - LONG_VERSION: 4.4.5 - VARIANT: alpine313 + alpine320_7.0.2: + MAJOR_VERSION: 7 + VERSION: 7.0 + LONG_VERSION: 7.0.2 + VARIANT: alpine320 PARENT: alpine ISPARENT: True - scratch313_4.4.5: - MAJOR_VERSION: 4 - VERSION: 4.4 - LONG_VERSION: 4.4.5 - VARIANT: scratch313 + scratch320_7.0.2: + MAJOR_VERSION: 7 + VERSION: 7.0 + LONG_VERSION: 7.0.2 + VARIANT: scratch320 PARENT: scratch ISPARENT: True - vaapi2204_4.4.5: - MAJOR_VERSION: 4 - VERSION: 4.4 - LONG_VERSION: 4.4.5 - VARIANT: vaapi2204 - PARENT: vaapi - ISPARENT: True - - - nvidia2204_4.4.5: - MAJOR_VERSION: 4 - VERSION: 4.4 - LONG_VERSION: 4.4.5 - VARIANT: nvidia2204 - PARENT: nvidia - ISPARENT: True - - - ubuntu2204_4.3.8: - MAJOR_VERSION: 4 - VERSION: 4.3 - LONG_VERSION: 4.3.8 - VARIANT: ubuntu2204 - PARENT: ubuntu - ISPARENT: True - - - vaapi2204_4.3.8: - MAJOR_VERSION: 4 - VERSION: 4.3 - LONG_VERSION: 4.3.8 - VARIANT: vaapi2204 + vaapi2404_7.0.2: + MAJOR_VERSION: 7 + VERSION: 7.0 + LONG_VERSION: 7.0.2 + VARIANT: vaapi2404 PARENT: vaapi ISPARENT: True - nvidia2204_4.3.8: - MAJOR_VERSION: 4 - VERSION: 4.3 - LONG_VERSION: 4.3.8 - VARIANT: nvidia2204 + nvidia2404_7.0.2: + MAJOR_VERSION: 7 + VERSION: 7.0 + LONG_VERSION: 7.0.2 + VARIANT: nvidia2404 PARENT: nvidia ISPARENT: True - ubuntu2204_4.2.10: - MAJOR_VERSION: 4 - VERSION: 4.2 - LONG_VERSION: 4.2.10 - VARIANT: ubuntu2204 + ubuntu2404_6.1.2: + MAJOR_VERSION: 6 + VERSION: 6.1 + LONG_VERSION: 6.1.2 + VARIANT: ubuntu2404 PARENT: ubuntu ISPARENT: True - scratch313_4.2.10: - MAJOR_VERSION: 4 - VERSION: 4.2 - LONG_VERSION: 4.2.10 - VARIANT: scratch313 - PARENT: scratch - ISPARENT: True - - - vaapi2204_4.2.10: - MAJOR_VERSION: 4 - VERSION: 4.2 - LONG_VERSION: 4.2.10 - VARIANT: vaapi2204 - PARENT: vaapi - ISPARENT: True - - - nvidia2204_4.2.10: - MAJOR_VERSION: 4 - VERSION: 4.2 - LONG_VERSION: 4.2.10 - VARIANT: nvidia2204 - PARENT: nvidia - ISPARENT: True - - - ubuntu2204_3.4.13: - MAJOR_VERSION: 3 - VERSION: 3.4 - LONG_VERSION: 3.4.13 - VARIANT: ubuntu2204 - PARENT: ubuntu + ubuntu2404-edge_6.1.2: + MAJOR_VERSION: 6 + VERSION: 6.1 + LONG_VERSION: 6.1.2 + VARIANT: ubuntu2404-edge + PARENT: ubuntu-edge ISPARENT: True - alpine313_3.4.13: - MAJOR_VERSION: 3 - VERSION: 3.4 - LONG_VERSION: 3.4.13 - VARIANT: alpine313 + alpine320_6.1.2: + MAJOR_VERSION: 6 + VERSION: 6.1 + LONG_VERSION: 6.1.2 + VARIANT: alpine320 PARENT: alpine ISPARENT: True - scratch313_3.4.13: - MAJOR_VERSION: 3 - VERSION: 3.4 - LONG_VERSION: 3.4.13 - VARIANT: scratch313 - PARENT: scratch - ISPARENT: True - - - vaapi2204_3.4.13: - MAJOR_VERSION: 3 - VERSION: 3.4 - LONG_VERSION: 3.4.13 - VARIANT: vaapi2204 - PARENT: vaapi - ISPARENT: True - - - nvidia2204_3.4.13: - MAJOR_VERSION: 3 - VERSION: 3.4 - LONG_VERSION: 3.4.13 - VARIANT: nvidia2204 - PARENT: nvidia - ISPARENT: True - - - ubuntu2204_2.8.22: - MAJOR_VERSION: 2 - VERSION: 2.8 - LONG_VERSION: 2.8.22 - VARIANT: ubuntu2204 - PARENT: ubuntu - ISPARENT: True - - - vaapi2204_2.8.22: - MAJOR_VERSION: 2 - VERSION: 2.8 - LONG_VERSION: 2.8.22 - VARIANT: vaapi2204 + vaapi2404_6.1.2: + MAJOR_VERSION: 6 + VERSION: 6.1 + LONG_VERSION: 6.1.2 + VARIANT: vaapi2404 PARENT: vaapi ISPARENT: True - - nvidia2204_2.8.22: - MAJOR_VERSION: 2 - VERSION: 2.8 - LONG_VERSION: 2.8.22 - VARIANT: nvidia2204 - PARENT: nvidia - ISPARENT: True - steps: - template: ../azure-steps.yml diff --git a/docker-images/gitlab-ci.yml b/docker-images/gitlab-ci.yml index 07ce64280..f1cbf1b56 100644 --- a/docker-images/gitlab-ci.yml +++ b/docker-images/gitlab-ci.yml @@ -4,356 +4,181 @@ stages: - nvidia - scratch - ubuntu + - ubuntu-edge - vaapi -7.0.2-ubuntu2204: +7.1-ubuntu2404: extends: .docker stage: ubuntu variables: MAJOR_VERSION: 7 - VERSION: "7.0" - LONG_VERSION: "7.0.2" - VARIANT: ubuntu2204 + VERSION: "7.1" + LONG_VERSION: "7.1" + VARIANT: ubuntu2404 PARENT: "ubuntu" ISPARENT: "True" -7.0.2-alpine313: +7.1-ubuntu2404-edge: + extends: .docker + stage: ubuntu-edge + variables: + MAJOR_VERSION: 7 + VERSION: "7.1" + LONG_VERSION: "7.1" + VARIANT: ubuntu2404-edge + PARENT: "ubuntu-edge" + ISPARENT: "True" + +7.1-alpine320: extends: .docker stage: alpine variables: MAJOR_VERSION: 7 - VERSION: "7.0" - LONG_VERSION: "7.0.2" - VARIANT: alpine313 + VERSION: "7.1" + LONG_VERSION: "7.1" + VARIANT: alpine320 PARENT: "alpine" ISPARENT: "True" -7.0.2-scratch313: +7.1-scratch320: extends: .docker stage: scratch variables: MAJOR_VERSION: 7 - VERSION: "7.0" - LONG_VERSION: "7.0.2" - VARIANT: scratch313 + VERSION: "7.1" + LONG_VERSION: "7.1" + VARIANT: scratch320 PARENT: "scratch" ISPARENT: "True" -7.0.2-vaapi2204: +7.1-vaapi2404: extends: .docker stage: vaapi variables: MAJOR_VERSION: 7 - VERSION: "7.0" - LONG_VERSION: "7.0.2" - VARIANT: vaapi2204 + VERSION: "7.1" + LONG_VERSION: "7.1" + VARIANT: vaapi2404 PARENT: "vaapi" ISPARENT: "True" -7.0.2-nvidia2204: +7.1-nvidia2404: extends: .docker stage: nvidia variables: MAJOR_VERSION: 7 - VERSION: "7.0" - LONG_VERSION: "7.0.2" - VARIANT: nvidia2204 - PARENT: "nvidia" - ISPARENT: "True" - -6.1.2-ubuntu2204: - extends: .docker - stage: ubuntu - variables: - MAJOR_VERSION: 6 - VERSION: "6.1" - LONG_VERSION: "6.1.2" - VARIANT: ubuntu2204 - PARENT: "ubuntu" - ISPARENT: "True" - -6.1.2-vaapi2204: - extends: .docker - stage: vaapi - variables: - MAJOR_VERSION: 6 - VERSION: "6.1" - LONG_VERSION: "6.1.2" - VARIANT: vaapi2204 - PARENT: "vaapi" - ISPARENT: "True" - -6.1.2-nvidia2204: - extends: .docker - stage: nvidia - variables: - MAJOR_VERSION: 6 - VERSION: "6.1" - LONG_VERSION: "6.1.2" - VARIANT: nvidia2204 + VERSION: "7.1" + LONG_VERSION: "7.1" + VARIANT: nvidia2404 PARENT: "nvidia" ISPARENT: "True" -5.1.6-ubuntu2204: +7.0.2-ubuntu2404: extends: .docker stage: ubuntu variables: - MAJOR_VERSION: 5 - VERSION: "5.1" - LONG_VERSION: "5.1.6" - VARIANT: ubuntu2204 + MAJOR_VERSION: 7 + VERSION: "7.0" + LONG_VERSION: "7.0.2" + VARIANT: ubuntu2404 PARENT: "ubuntu" ISPARENT: "True" -5.1.6-alpine313: - extends: .docker - stage: alpine - variables: - MAJOR_VERSION: 5 - VERSION: "5.1" - LONG_VERSION: "5.1.6" - VARIANT: alpine313 - PARENT: "alpine" - ISPARENT: "True" - -5.1.6-vaapi2204: - extends: .docker - stage: vaapi - variables: - MAJOR_VERSION: 5 - VERSION: "5.1" - LONG_VERSION: "5.1.6" - VARIANT: vaapi2204 - PARENT: "vaapi" - ISPARENT: "True" - -5.1.6-nvidia2204: - extends: .docker - stage: nvidia - variables: - MAJOR_VERSION: 5 - VERSION: "5.1" - LONG_VERSION: "5.1.6" - VARIANT: nvidia2204 - PARENT: "nvidia" - ISPARENT: "True" - -4.4.5-ubuntu2204: +7.0.2-ubuntu2404-edge: extends: .docker - stage: ubuntu + stage: ubuntu-edge variables: - MAJOR_VERSION: 4 - VERSION: "4.4" - LONG_VERSION: "4.4.5" - VARIANT: ubuntu2204 - PARENT: "ubuntu" + MAJOR_VERSION: 7 + VERSION: "7.0" + LONG_VERSION: "7.0.2" + VARIANT: ubuntu2404-edge + PARENT: "ubuntu-edge" ISPARENT: "True" -4.4.5-alpine313: +7.0.2-alpine320: extends: .docker stage: alpine variables: - MAJOR_VERSION: 4 - VERSION: "4.4" - LONG_VERSION: "4.4.5" - VARIANT: alpine313 + MAJOR_VERSION: 7 + VERSION: "7.0" + LONG_VERSION: "7.0.2" + VARIANT: alpine320 PARENT: "alpine" ISPARENT: "True" -4.4.5-scratch313: +7.0.2-scratch320: extends: .docker stage: scratch variables: - MAJOR_VERSION: 4 - VERSION: "4.4" - LONG_VERSION: "4.4.5" - VARIANT: scratch313 + MAJOR_VERSION: 7 + VERSION: "7.0" + LONG_VERSION: "7.0.2" + VARIANT: scratch320 PARENT: "scratch" ISPARENT: "True" -4.4.5-vaapi2204: - extends: .docker - stage: vaapi - variables: - MAJOR_VERSION: 4 - VERSION: "4.4" - LONG_VERSION: "4.4.5" - VARIANT: vaapi2204 - PARENT: "vaapi" - ISPARENT: "True" - -4.4.5-nvidia2204: - extends: .docker - stage: nvidia - variables: - MAJOR_VERSION: 4 - VERSION: "4.4" - LONG_VERSION: "4.4.5" - VARIANT: nvidia2204 - PARENT: "nvidia" - ISPARENT: "True" - -4.3.8-ubuntu2204: - extends: .docker - stage: ubuntu - variables: - MAJOR_VERSION: 4 - VERSION: "4.3" - LONG_VERSION: "4.3.8" - VARIANT: ubuntu2204 - PARENT: "ubuntu" - ISPARENT: "True" - -4.3.8-vaapi2204: +7.0.2-vaapi2404: extends: .docker stage: vaapi variables: - MAJOR_VERSION: 4 - VERSION: "4.3" - LONG_VERSION: "4.3.8" - VARIANT: vaapi2204 + MAJOR_VERSION: 7 + VERSION: "7.0" + LONG_VERSION: "7.0.2" + VARIANT: vaapi2404 PARENT: "vaapi" ISPARENT: "True" -4.3.8-nvidia2204: +7.0.2-nvidia2404: extends: .docker stage: nvidia variables: - MAJOR_VERSION: 4 - VERSION: "4.3" - LONG_VERSION: "4.3.8" - VARIANT: nvidia2204 + MAJOR_VERSION: 7 + VERSION: "7.0" + LONG_VERSION: "7.0.2" + VARIANT: nvidia2404 PARENT: "nvidia" ISPARENT: "True" -4.2.10-ubuntu2204: +6.1.2-ubuntu2404: extends: .docker stage: ubuntu variables: - MAJOR_VERSION: 4 - VERSION: "4.2" - LONG_VERSION: "4.2.10" - VARIANT: ubuntu2204 + MAJOR_VERSION: 6 + VERSION: "6.1" + LONG_VERSION: "6.1.2" + VARIANT: ubuntu2404 PARENT: "ubuntu" ISPARENT: "True" -4.2.10-scratch313: - extends: .docker - stage: scratch - variables: - MAJOR_VERSION: 4 - VERSION: "4.2" - LONG_VERSION: "4.2.10" - VARIANT: scratch313 - PARENT: "scratch" - ISPARENT: "True" - -4.2.10-vaapi2204: - extends: .docker - stage: vaapi - variables: - MAJOR_VERSION: 4 - VERSION: "4.2" - LONG_VERSION: "4.2.10" - VARIANT: vaapi2204 - PARENT: "vaapi" - ISPARENT: "True" - -4.2.10-nvidia2204: - extends: .docker - stage: nvidia - variables: - MAJOR_VERSION: 4 - VERSION: "4.2" - LONG_VERSION: "4.2.10" - VARIANT: nvidia2204 - PARENT: "nvidia" - ISPARENT: "True" - -3.4.13-ubuntu2204: +6.1.2-ubuntu2404-edge: extends: .docker - stage: ubuntu + stage: ubuntu-edge variables: - MAJOR_VERSION: 3 - VERSION: "3.4" - LONG_VERSION: "3.4.13" - VARIANT: ubuntu2204 - PARENT: "ubuntu" + MAJOR_VERSION: 6 + VERSION: "6.1" + LONG_VERSION: "6.1.2" + VARIANT: ubuntu2404-edge + PARENT: "ubuntu-edge" ISPARENT: "True" -3.4.13-alpine313: +6.1.2-alpine320: extends: .docker stage: alpine variables: - MAJOR_VERSION: 3 - VERSION: "3.4" - LONG_VERSION: "3.4.13" - VARIANT: alpine313 + MAJOR_VERSION: 6 + VERSION: "6.1" + LONG_VERSION: "6.1.2" + VARIANT: alpine320 PARENT: "alpine" ISPARENT: "True" -3.4.13-scratch313: - extends: .docker - stage: scratch - variables: - MAJOR_VERSION: 3 - VERSION: "3.4" - LONG_VERSION: "3.4.13" - VARIANT: scratch313 - PARENT: "scratch" - ISPARENT: "True" - -3.4.13-vaapi2204: - extends: .docker - stage: vaapi - variables: - MAJOR_VERSION: 3 - VERSION: "3.4" - LONG_VERSION: "3.4.13" - VARIANT: vaapi2204 - PARENT: "vaapi" - ISPARENT: "True" - -3.4.13-nvidia2204: - extends: .docker - stage: nvidia - variables: - MAJOR_VERSION: 3 - VERSION: "3.4" - LONG_VERSION: "3.4.13" - VARIANT: nvidia2204 - PARENT: "nvidia" - ISPARENT: "True" - -2.8.22-ubuntu2204: - extends: .docker - stage: ubuntu - variables: - MAJOR_VERSION: 2 - VERSION: "2.8" - LONG_VERSION: "2.8.22" - VARIANT: ubuntu2204 - PARENT: "ubuntu" - ISPARENT: "True" - -2.8.22-vaapi2204: +6.1.2-vaapi2404: extends: .docker stage: vaapi variables: - MAJOR_VERSION: 2 - VERSION: "2.8" - LONG_VERSION: "2.8.22" - VARIANT: vaapi2204 + MAJOR_VERSION: 6 + VERSION: "6.1" + LONG_VERSION: "6.1.2" + VARIANT: vaapi2404 PARENT: "vaapi" ISPARENT: "True" - -2.8.22-nvidia2204: - extends: .docker - stage: nvidia - variables: - MAJOR_VERSION: 2 - VERSION: "2.8" - LONG_VERSION: "2.8.22" - VARIANT: nvidia2204 - PARENT: "nvidia" - ISPARENT: "True" diff --git a/download_tarballs.sh b/download_tarballs.sh new file mode 100755 index 000000000..8a12e6baf --- /dev/null +++ b/download_tarballs.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# The point of this script is to read in the list of tarballs to download from generated_build_manifest.json +# using jq and then download them into their build directories. +# +# The point, we need robust re-tries, as sometimes the download fails, and we need to be able to re-try. +# and verify that the download was successful. + +manifestJsonFile="/tmp/workdir/generated_build_manifest.json" + +report_on_failed_downloads() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [ -z "$tarball_name" ]; then + if [ ! -d "$build_dir" ]; then + echo "Error: $build_dir does not exist" + ((count++)) + fi + fi + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "Error: $build_dir/$tarball_name does not exist" + ((count++)) + fi + done + echo "Failed to download $count tarballs" +} + +actual_number_of_downloads_completed() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + local count=0 + + for i in "${!libs[@]}"; do + lib_name=${libs[$i]} + local data=$(jq -r '.[] | select(.library_name == "'${lib_name}'")' $manifestJsonFile) + build_dir=$(echo "$data" | jq -r '.build_dir') + tarball_name=$(echo "$data" | jq -r '.tarball_name') + # if tarball_name does not exist, then it could be a source repo build + # just check the directory + if [[ -z "$tarball_name" || "$tarball_name" == "null" ]]; then + if [ -d "$build_dir" ]; then + ((count++)) + fi + fi + if [ -f "$build_dir/$tarball_name" ]; then + ((count++)) + fi + done + echo $count # Return the count as output +} +number_of_tarballs_to_download() { + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "${#libs[@]}" # return count as output +} + +download_tarballs() { + # the default argument of quiet is false + quiet=${1:-false} + local librariesRaw="$(jq -r '.[] | .library_name' $manifestJsonFile)" + local libs=( $librariesRaw ) + echo "Downloading (${#libs[@]} libraries)..." + for i in "${!libs[@]}"; do + # echo "Downloading ${libs[$i]}..." + lib_name=${libs[$i]} + # use double quotes around '${lib_name}', so Bash will expand the value. + build_dir=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .build_dir' $manifestJsonFile) + download_url=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .download_url' $manifestJsonFile) + tarball_name=$(jq -r '.[] | select(.library_name == "'${lib_name}'") | .tarball_name' $manifestJsonFile) + if [ -z "$build_dir" ]; then + echo "Error: build_dir, is empty" + exit 1 + fi + + # does the directory exist? if not make it + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + fi + # handle edge case for source repo builds (git clone ) + if [[ -z "$tarball_name" || -z "$download_url" || "$tarball_name" == "null" || "$download_url" == "null" ]]; then + echo "Warning: tarball_name, or download_url is empty or unset (ok in a source repo build)" + continue + fi + echo "Downloading: ${download_url} to: ${build_dir} ${tarball_name}" + if [ -z "$build_dir" ] || [ -z "$download_url" ] || [ -z "$tarball_name" ]; then + echo "Error: build_dir, download_url, or tarball_name is empty" + exit 1 + fi + # if the tarball_file does not exhist then download it + if [ ! -f "$build_dir/$tarball_name" ]; then + echo "$build_dir/$tarball_name does not exist, downloading now..." + cd "$build_dir" + # curl -fsSL -o "$library.tar.gz" " + # curl command line reference + # -o write output to file + # -f Fail fast with no output on HTTP errors + # -s Silent mode + # -S, --show-error Show error even when -s is used + # -L, --location Follow redirects + # --retry Retry request if transient problems occur + curl -fsSL --retry 2 -o "$tarball_name" "$download_url" + else + # if not quietly, then echo that we are skipping the download + [ "$quiet" = false ] && + echo "$build_dir/$tarball_name already exists, skipping download" + fi + done +} + +num_to_download=1 # at least 1 +num_completed=0 +number_of_times_to_retry=6 +download_tarballs_called_number=0 +num_completed=$(actual_number_of_downloads_completed) +num_to_download=$(number_of_tarballs_to_download) +echo "Starting to download ${num_to_download} tarball images" +while [ $num_completed -lt $num_to_download ] && [ $number_of_times_to_retry -gt $download_tarballs_called_number ]; do + ((download_tarballs_called_number++)) + download_tarballs + sleep 5 + num_completed=$(actual_number_of_downloads_completed) + num_to_download=$(number_of_tarballs_to_download) + echo "Downloaded ${num_completed} of ${num_to_download} tarball images on pass ${download_tarballs_called_number}" +done + +if [ $num_completed -lt $num_to_download ]; then + echo "Failed to download all tarballs after $download_tarballs_called_number attempts" + report_on_failed_downloads + exit 1 +fi +echo "Successfully Downloaded the ${num_completed} tarball images after $download_tarballs_called_number attempts" +exit 0 diff --git a/generate-list-of-recent-images.py b/generate-list-of-recent-images.py new file mode 100644 index 000000000..4e6273b34 --- /dev/null +++ b/generate-list-of-recent-images.py @@ -0,0 +1,62 @@ +import json + +import requests + +""" +To run this script you need the requests library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install requests +$ python3 ./generate-list-of-recent-images.py > list_of_recent_images.txt +$ deactivate +$ rm -rf .venv + +you will now have a file called list_of_recent_images.txt with the list of images +""" + + +def make_api_request(page, page_size): + url = "https://registry.hub.docker.com/v2/repositories/jrottenberg/ffmpeg/tags" + params = {"page": page, "page_size": page_size} + response = requests.get(url, params=params) + return response.json() + + +def process_data(data): + data = json.loads(data) + sorted_data = sorted(data, key=lambda x: x["name"], reverse=True) + for item in sorted_data: + if item["tag_status"].lower() == "active": + size_mb = round(item["full_size"] / 1048576) + name_padding = " " * (20 - len(item["name"])) + size_padding = " " * (8 - len(str(size_mb))) + last_updated = item["last_updated"][:10] + # print("-" * 50) + # print(json.dumps(item, indent=4)) + print( + f"{item['name']}{name_padding}{size_mb}mb{size_padding}{last_updated}" + ) + # print(f'{item["last_updater_username"]}') + + +def main(): + page = 1 + page_size = 100 + data = [] + + while True: + response = make_api_request(page, page_size) + data.extend(response["results"]) + + if len(response["results"]) < page_size: + break + + page += 1 + + process_data(json.dumps(data)) + + +if __name__ == "__main__": + main() diff --git a/generate-source-of-truth-ffmpeg-versions.py b/generate-source-of-truth-ffmpeg-versions.py new file mode 100755 index 000000000..5261acb81 --- /dev/null +++ b/generate-source-of-truth-ffmpeg-versions.py @@ -0,0 +1,861 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys +from collections import OrderedDict + +""" +------- Purpose ------- +...This is the source of truth... +1. This script generates a table of the libraries used by FFMPEG that + will be included in the main README.md file of the repository. +2. This script generates a 'build_manifest.json' file that contains the + the download links, build directories, and build tarball names for + each library. ( Required to generate a robust re-try download of the package tarballs) + +------- Setup ------- +This script is run in the container to generate 'build_manifest.json' +However, it is also used to generate a generated_versions_table.md file. +The steps for doing that are below. +To run this script you need the ?? library. You can install it with pip: +in a venv as follows: + +$ python3 -mvenv .venv +$ source .venv/bin/activate +$ pip install ?? +$ python3 ./generate-source-of-truth-ffmpeg-versions.py +$ deactivate +$ rm -rf .venv + +The output of this script will be a table in markdown format, which you can +paste into the README.md file of the repository. +""" + +# Library versions Source of truth +FFMPEG_71 = {"version": "7.1", "release_date": "2024-09-30"} +FFMPEG_70 = {"version": "7.0", "release_date": "2024-04-05"} +FFMPEG_61 = {"version": "6.1", "release_date": "2023-11-11"} +# FFMPEG_51 = {"version": "5.1", "release_date": "2022-06-22"} +OGG = {"version": "1.3.5", "release_date": "2021-06-04"} +OPENCOREAMR = {"version": "0.1.6", "release_date": "2022-08-01"} +VORBIS = {"version": "1.3.7", "release_date": "2020-07-04"} +THEORA = {"version": "1.1.1", "release_date": "2010"} +LAME = {"version": "3.100", "release_date": "2017-10-13"} +OPUS = {"version": "1.5.2", "release_date": "2024-04-12"} +VPX = {"version": "1.14.1", "release_date": "2024-05-30"} +WEBP = {"version": "1.4.0", "release_date": "2024-04-13"} +XVID = {"version": "1.3.7", "release_date": "2019"} +FDKAAC = {"version": "2.0.3", "release_date": "2023-12-21"} +FREETYPE = {"version": "2.13.3", "release_date": "2024-08-12"} +LIBVIDSTAB = {"version": "1.1.1", "release_date": "2022-05-30"} +LIBFRIDIBI = {"version": "1.0.16", "release_date": "2024-10-1"} +FONTCONFIG = {"version": "2.15.0", "release_date": "2023-12-22"} +LIBASS = {"version": "0.17.3", "release_date": "2024-07-02"} +KVAAZAAR = {"version": "2.3.1", "release_date": "2024-04-10"} +AOM = {"version": "3.10.0", "release_date": "2024-08-01"} +NV_CODEC = {"version": "12.2.72.0", "release_date": "2024-03-31"} +SVTAV1 = {"version": "2.2.1", "release_date": "2024-08-01"} +XORG_MACROS = {"version": "1.20.1", "release_date": "2024-04-16"} +XPROTO = {"version": "7.0.31", "release_date": "2016-09-23"} +XAU = {"version": "1.0.11", "release_date": "2022-12-08"} +PTHREAD_STUBS = {"version": "0.5", "release_date": "2023-07-18"} +LIBXML2 = {"version": "2.13.4", "release_date": "2024-09-01"} +LIBBLURAY = {"version": "1.3.4", "release_date": "2022-11-26"} +X264 = {"version": "20191217-2245-stable", "release_date": "2019-12-17"} +X265 = {"version": "4.0", "release_date": "2024-09-13"} +LIBZMQ = {"version": "4.3.5", "release_date": "2023-10-9"} +LIBSRT = {"version": "1.5.3", "release_date": "2023-09-07"} +LIBPNG = {"version": "1.6.44", "release_date": "2024-09-12"} +ZIMG = {"version": "3.0.5", "release_date": "2023-6-30"} +LIBARIBB24 = {"version": "1.0.3", "release_date": "2014-08-18"} +OPENJPEG = {"version": "2.5.2", "release_date": "2024-02-28"} +THEORA = {"version": "1.1.1", "release_date": "2010-01-25"} +LIBVMAF = {"version": "3.0.0", "release_date": "2023-12-07"} + +# Library details, Source of truth +# TODO: store this in a yaml confiuration file ( would probably be better ) +# flake8: noqa E501 +LIBRARIES = OrderedDict( + [ + ( + "libopencore-amr", + { + "link": "https://sourceforge.net/projects/opencore-amr/", + "version": OPENCOREAMR["version"], + "version_link": "https://sourceforge.net/projects/opencore-amr/files/opencore-amr/", + "release_date": OPENCOREAMR["release_date"], + "license_name": "Apache License", + "license_link": "https://sourceforge.net/p/opencore-amr/code/ci/master/tree/LICENSE", + "build_info": { + # this one of the finikie download link's ( and the reason we wrote the download_tarball.sh script) + "download_link": f"https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-{OPENCOREAMR['version']}.tar.gz", + "build_dir": "/tmp/libopencore-amr", + "tarball_name": f"opencore-amr-{OPENCOREAMR['version']}.tar.gz", + }, + }, + ), + ( + "libx264", + { + "link": "https://www.videolan.org/developers/x264.html", + "version": X264["version"], + "version_link": "https://download.videolan.org/pub/videolan/x264/snapshots/", + "release_date": X264["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-{X264['version']}.tar.bz2", + "build_dir": "/tmp/x264", + "tarball_name": f"x264-snapshot-{X264['version']}.tar.bz2", + }, + }, + ), + ( + "libx265", + { + "link": "http://x265.org/", + "version": X265["version"], + "version_link": "http://ftp.videolan.org/pub/videolan/x265/", # "https://www.x265.org/downloads/", + "release_date": X265["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING", + "build_info": { + "download_link": f"http://ftp.videolan.org/pub/videolan/x265/x265_{X265['version']}.tar.gz", + "build_dir": "/tmp/x265", + "tarball_name": f"x265_{X265['version']}.tar.gz", + }, + }, + ), + ( + "libogg", + { + "link": "https://www.xiph.org/ogg/", + "version": OGG["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": OGG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/ogg.git;a=blob_plain;f=COPYING;hb=HEAD", # TODO: check this link + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/ogg/libogg-{OGG['version']}.tar.gz", + "build_dir": "/tmp/libogg", + "tarball_name": f"libogg-{OGG['version']}.tar.gz", + }, + }, + ), + ( + "libopus", + { + "link": "https://www.opus-codec.org/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus + "version": OPUS["version"], + "version_link": "https://www.opus-codec.org/downloads/", + # https://ftp.osuosl.org/pub/xiph/releases/opus/ + "release_date": OPUS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", # https://opus-codec.org/license/ + "build_info": { + "download_link": f"https://github.com/xiph/opus/releases/download/v{OPUS['version']}/opus-{OPUS['version']}.tar.gz", + "build_dir": "/tmp/opus", + "tarball_name": f"opus-{OPUS['version']}.tar.gz", + "sha256sum": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1 opus-1.5.2.tar.gz", + }, + }, + ), + ( + "libvorbis", + { + "link": "https://xiph.org/vorbis/", + "version": VORBIS["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": VORBIS["release_date"], + "license_name": "BSD-style license", + "license_link": "https://www.xiph.org/licenses/bsd/", + "build_info": { + "download_link": f"http://downloads.xiph.org/releases/vorbis/libvorbis-{VORBIS['version']}.tar.gz", + "build_dir": "/tmp/vorbis", + "tarball_name": f"libvorbis-{VORBIS['version']}.tar.gz", + "sha256sum": "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab libvorbis-1.3.7.tar.gz", + }, + }, + ), + ( + "libvpx", + { + "link": "https://www.webmproject.org/code/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx + "version": VPX["version"], + "version_link": "https://chromium.googlesource.com/webm/libvpx.git/", + "release_date": VPX["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + # "download_link": f"https://chromium.googlesource.com/webm/libvpx/+archive/v{VPX['version']}.tar.gz", + "build_dir": "/tmp/libvpx", + # "tarball_name": f"libvpx-v{VPX['version']}.tar.gz", + }, + }, + ), + ( + "libwebp", + { + "link": "https://developers.google.com/speed/webp/", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libwebp + "version": WEBP["version"], + "version_link": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html", + "release_date": WEBP["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/webmproject/libvpx/blob/master/LICENSE", + "build_info": { + "download_link": f"https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-{WEBP['version']}.tar.gz", + "build_dir": "/tmp/webp", + "tarball_name": f"libwebp-{WEBP['version']}.tar.gz", + }, + }, + ), + ( + "libmp3lame", + { + "link": "http://lame.sourceforge.net/", + "version": LAME["version"], + "version_link": "http://lame.sourceforge.net/download.php", + "release_date": LAME["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9", + "build_info": { + # this one is also testie + "download_link": f"https://sourceforge.net/projects/lame/files/lame/{LAME['version']}/lame-{LAME['version']}.tar.gz", + "build_dir": "/tmp/lame", + "tarball_name": f"lame-{LAME['version']}.tar.gz", + }, + }, + ), + ( + "libxvid", + { + "link": "https://www.xvid.com/", + "version": XVID["version"], + "version_link": "https://labs.xvid.com/source/", + "release_date": XVID["release_date"], + "license_name": "GNU General Public Licence (GPL) version 2", + "license_link": "http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851", + "build_info": { + "download_link": f"https://downloads.xvid.com/downloads/xvidcore-{XVID['version']}.tar.gz", + "build_dir": "/tmp/xvid", + "tarball_name": f"xvidcore-{XVID['version']}.tar.gz", + }, + }, + ), + ( + "libfdk-aac", + { + "link": "https://github.com/mstorsjo/fdk-aac", + # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac + "version": FDKAAC["version"], + "version_link": "https://github.com/mstorsjo/fdk-aac/tags", + "release_date": FDKAAC["release_date"], + "license_name": "Liberal but not a license of patented technologies", + "license_link": "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE", + "build_info": { + "download_link": f"https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v{FDKAAC['version']}.tar.gz", + "build_dir": "/tmp/fdk-aac", + "tarball_name": f"fdk-aac-{FDKAAC['version']}.tar.gz", + }, + }, + ), + ( + "openjpeg", + { + "link": "https://github.com/uclouvain/openjpeg", + "version": OPENJPEG["version"], + "version_link": "https://github.com/uclouvain/openjpeg/releases", + "release_date": OPENJPEG["release_date"], + "license_name": "BSD-style license", + "license_link": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/uclouvain/openjpeg/archive/refs/tags/v{OPENJPEG['version']}.tar.gz", + "build_dir": "/tmp/openjpeg", + "tarball_name": f"openjpeg-{OPENJPEG['version']}.tar.gz", + }, + }, + ), + ( + "freetype", + { + "link": "https://www.freetype.org/", + "version": FREETYPE["version"], + "version_link": "http://download.savannah.gnu.org/releases/freetype/", + "release_date": FREETYPE["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.freetype.org/license.html", + "build_info": { + "download_link": f"http://download.savannah.gnu.org/releases/freetype/freetype-{FREETYPE['version']}.tar.gz", + "build_dir": "/tmp/freetype", + "tarball_name": f"freetype-{FREETYPE['version']}.tar.gz", + }, + }, + ), + ( + "libvidstab", + { + "link": "https://github.com/georgmartius/vid.stab", + "version": LIBVIDSTAB["version"], + "version_link": "https://github.com/georgmartius/vid.stab/tags", + "release_date": LIBVIDSTAB["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://github.com/georgmartius/vid.stab/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/georgmartius/vid.stab/archive/v{LIBVIDSTAB['version']}.tar.gz", + "build_dir": "/tmp/vid.stab", + "tarball_name": f"vid.stab-{LIBVIDSTAB['version']}.tar.gz", + }, + }, + ), + ( + "fribidi", + { + "link": "https://www.fribidi.org/", + "version": LIBFRIDIBI["version"], + "version_link": "https://github.com/fribidi/fribidi/releases", + "release_date": LIBFRIDIBI["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://cgit.freedesktop.org/fribidi/fribidi/plain/COPYING", + "build_info": { + "download_link": f"https://github.com/fribidi/fribidi/archive/refs/tags/v{LIBFRIDIBI['version']}.tar.gz", + "build_dir": "/tmp/fribidi", + "tarball_name": f"fribidi-{LIBFRIDIBI['version']}.tar.gz", + "using_source_build": False, + # "sha256sum": "3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 fribidi-{LIBFRIDIBI['version']}.tar.gz" + }, + }, + ), + ( + "fontconfig", + { + "link": "https://www.freedesktop.org/wiki/Software/fontconfig/", + "version": FONTCONFIG["version"], + "version_link": "https://www.freedesktop.org/software/fontconfig/release/", + "release_date": FONTCONFIG["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://www.freedesktop.org/software/fontconfig/release/fontconfig-{FONTCONFIG['version']}.tar.gz", + "build_dir": "/tmp/fontconfig", + "tarball_name": f"fontconfig-{FONTCONFIG['version']}.tar.gz", + }, + }, + ), + ( + "libass", + { + "link": "https://github.com/libass/libass", + "version": LIBASS["version"], + "version_link": "https://github.com/libass/libass/releases", + "release_date": LIBASS["release_date"], + "license_name": "ISC License", + "license_link": "https://github.com/libass/libass/blob/master/COPYING", + "build_info": { + "download_link": f"https://github.com/libass/libass/releases/download/{LIBASS['version']}/libass-{LIBASS['version']}.tar.gz", + "build_dir": "/tmp/libass", + "tarball_name": f"libass-{LIBASS['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "kvazaar", + { + "link": "https://github.com/ultravideo/kvazaar", + "version": KVAAZAAR["version"], + "version_link": "https://github.com/ultravideo/kvazaar/releases", + "release_date": KVAAZAAR["release_date"], + "license_name": "BSD 3-Clause", + "license_link": "https://github.com/ultravideo/kvazaar/blob/master/LICENSE`", + "build_info": { + "download_link": f"https://github.com/ultravideo/kvazaar/releases/download/v{KVAAZAAR['version']}/kvazaar-{KVAAZAAR['version']}.tar.gz", + "build_dir": "/tmp/kvazaar", + "tarball_name": f"kvazaar-{KVAAZAAR['version']}.tar.gz", + }, + }, + ), + ( + "aom", + { + "link": "https://aomedia.googlesource.com/aom", + "version": AOM["version"], + "version_link": "https://aomedia.googlesource.com/aom/+refs", + "release_date": AOM["release_date"], + "license_name": "Alliance for Open Media", + "license_link": "https://aomedia.org/license/software-license/", + "build_info": { + "build_dir": "/tmp/aom", + }, + }, + ), + ( + "nvidia-codec-headers", + { + "link": "https://github.com/FFmpeg/nv-codec-headers", + "version": NV_CODEC["version"], + "version_link": "", + "release_date": NV_CODEC["release_date"], + "license_name": "", + "license_link": "", + "build_info": { + "download_link": f"https://github.com/FFmpeg/nv-codec-headers/releases/download/n{NV_CODEC['version']}/nv-codec-headers-{NV_CODEC['version']}.tar.gz", + # "download_link": f"https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n{NV_CODEC['version']}.tar.gz", + "build_dir": "/tmp/nv-codec-headers", + "tarball_name": f"nv-codec-headers-{NV_CODEC['version']}.tar.gz", + }, + }, + ), + ( + "libsvtav1", + { + "link": "https://gitlab.com/AOMediaCodec/SVT-AV1", + "version": SVTAV1["version"], + "version_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/tags", + "release_date": SVTAV1["release_date"], + "license_name": "BSD 3-Clause Clear License", + "license_link": "https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/LICENSE.md?ref_type=heads", + "build_info": { + "download_link": f"https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v{SVTAV1['version']}/SVT-AV1-v{SVTAV1['version']}.tar.gz", + "build_dir": "/tmp/libsvtav1", + "tarball_name": f"SVT-AV1-v{SVTAV1['version']}.tar.gz", + }, + }, + ), + ( + "xorg-macros", + { + "link": "https://xcb.freedesktop.org/", + "version": XORG_MACROS["version"], + "version_link": "https://www.x.org/releases/individual/util/", + "release_date": XORG_MACROS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/util/util-macros-{XORG_MACROS['version']}.tar.xz", + "build_dir": "/tmp/xorg-macros", + "tarball_name": f"util-macros-{XORG_MACROS['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "xproto", + { + "link": "https://www.x.org/releases/individual/proto/", + "version": XPROTO["version"], + "version_link": "https://www.x.org/releases/individual/proto/", + "release_date": XPROTO["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/proto/xproto-{XPROTO['version']}.tar.gz", + "build_dir": "/tmp/xproto", + "tarball_name": f"xproto-{XPROTO['version']}.tar.gz", + }, + }, + ), + ( + "libxau", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": XAU["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": XAU["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libXau-{XAU['version']}.tar.xz", + "build_dir": "/tmp/libXau", + "tarball_name": f"libXau-{XAU['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libpthread-stubs", + { + "link": "https://www.x.org/releases/individual/lib/", + "version": PTHREAD_STUBS["version"], + "version_link": "https://www.x.org/releases/individual/lib/", + "release_date": PTHREAD_STUBS["release_date"], + "license_name": "The MIT License", + "license_link": "https://opensource.org/licenses/MIT", + "build_info": { + "download_link": f"https://www.x.org/releases/individual/lib/libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + "build_dir": "/tmp/libpthread-stubs", + "tarball_name": f"libpthread-stubs-{PTHREAD_STUBS['version']}.tar.xz", + # "using_source_build": False, + }, + }, + ), + ( + "libxml2", + { + "link": "http://www.xmlsoft.org/", + "version": LIBXML2["version"], + "version_link": "http://www.xmlsoft.org/downloads.html", + "release_date": LIBXML2["release_date"], + "license_name": "MIT License", + "license_link": "http://www.xmlsoft.org/license.html", + "build_info": { + "download_link": f"https://gitlab.gnome.org/GNOME/libxml2/-/archive/v{LIBXML2['version']}/libxml2-v{LIBXML2['version']}.tar.gz", + "build_dir": "/tmp/libxml2", + "tarball_name": f"libxml2-{LIBXML2['version']}.tar.gz", + "using_source_build": False, + }, + }, + ), + ( + "libbluray", + { + "link": "https://www.videolan.org/developers/libbluray.html", + "version": LIBBLURAY["version"], + "version_link": "https://download.videolan.org/pub/videolan/libbluray/", + "release_date": LIBBLURAY["release_date"], + "license_name": "GNU General Public License (GPL) version 2", + "license_link": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "build_info": { + "download_link": f"https://download.videolan.org/pub/videolan/libbluray/{LIBBLURAY['version']}/libbluray-{LIBBLURAY['version']}.tar.bz2", + "build_dir": "/tmp/libbluray", + "tarball_name": f"libbluray-{LIBBLURAY['version']}.tar.bz2", + }, + }, + ), + ( + "libzmq", + { + "link": "https://github.com/zeromq/libzmq/", + "version": LIBZMQ["version"], + "version_link": "https://github.com/zeromq/libzmq/releases/", + "release_date": LIBZMQ["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": f"https://github.com/zeromq/libzmq/blob/v{LIBZMQ['version']}/LICENSE", + "build_info": { + "download_link": f"https://github.com/zeromq/libzmq/releases/download/v{LIBZMQ['version']}/zeromq-{LIBZMQ['version']}.tar.gz", + "build_dir": "/tmp/libzmq", + "tarball_name": f"zeromq-{LIBZMQ['version']}.tar.gz", + }, + }, + ), + ( + "libpng", + { + "link": "http://www.libpng.org/pub/png/libpng.html", + "version": LIBPNG["version"], + "version_link": "https://sourceforge.net/projects/libpng/files/libpng16/", + "release_date": LIBPNG["release_date"], + "license_name": "PNG Reference Library License version 2", + "license_link": "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", + "build_info": { + # sourceforge is a bit finikie + # https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.gz/download + # https://download.sourceforge.net/libpng/libpng-1.6.44.tar.xz + "download_link": f"https://download.sourceforge.net/libpng/libpng-{LIBPNG['version']}.tar.xz", + "build_dir": "/tmp/libpng", + "tarball_name": f"libpng-{LIBPNG['version']}.tar.xz", + "using_source_build": False, + }, + }, + ), + ( + "libaribb24", + { + "link": "https://github.com/nkoriyama/aribb24/", + "version": LIBARIBB24["version"], + "version_link": "https://github.com/nkoriyama/aribb24/releases", + "release_date": LIBARIBB24["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1 or newer", + "license_link": "https://github.com/nkoriyama/aribb24/issues/9", + "build_info": { + "download_link": f"https://github.com/nkoriyama/aribb24/archive/refs/tags/v{LIBARIBB24['version']}.tar.gz", + "build_dir": "/tmp/b24", + "tarball_name": f"aribb24-v{LIBARIBB24['version']}.tar.gz", + }, + }, + ), + ( + "zimg", + { + "link": "https://github.com/sekrit-twc/zimg", + "version": ZIMG["version"], + "version_link": "https://github.com/sekrit-twc/zimg/releases", + "release_date": ZIMG["release_date"], + "license_name": "WTFPL", + "license_link": "https://github.com/sekrit-twc/zimg?tab=WTFPL-1-ov-file", + "build_info": { + "download_link": f"https://github.com/sekrit-twc/zimg/archive/refs/tags/release-{ZIMG['version']}.tar.gz", + "build_dir": "/tmp/zimg", + "tarball_name": f"zimg-{ZIMG['version']}.tar.gz", + }, + }, + ), + ( + "libtheora", + { + "link": "https://xiph.org/downloads/", + "version": THEORA["version"], + "version_link": "https://xiph.org/downloads/", + "release_date": THEORA["release_date"], + "license_name": "BSD-style license", + "license_link": "https://git.xiph.org/?p=mirrors/theora.git;a=blob_plain;f=COPYING;hb=HEAD", + "build_info": { + "download_link": f"https://downloads.xiph.org/releases/theora/libtheora-{THEORA['version']}.tar.gz", + "build_dir": "/tmp/theora", + "tarball_name": f"libtheora-{THEORA['version']}.tar.gz", + }, + }, + ), + ( + "libsrt", + { + "link": "https://github.com/Haivision/srt", + "version": LIBSRT["version"], + "version_link": "https://github.com/Haivision/srt/releases/", + "release_date": LIBSRT["release_date"], + "license_name": "Mozilla Public License (MPL) version 2.0", + "license_link": "https://github.com/Haivision/srt/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Haivision/srt/archive/refs/tags/v{LIBSRT['version']}.tar.gz", + "build_dir": "/tmp/srt", + "tarball_name": f"srt-v{LIBSRT['version']}.tar.gz", + }, + }, + ), + ( + "libvmaf", + { + "link": "https://github.com/Netflix/vmaf", + # https://github.com/Netflix/vmaf/issues/788 + "version": LIBVMAF["version"], + "version_link": "https://github.com/Netflix/vmaf/releases", + "release_date": LIBVMAF["release_date"], + "license_name": "BSD-2-Clause", + "license_link": "https://github.com/Netflix/vmaf/blob/master/LICENSE", + "build_info": { + "download_link": f"https://github.com/Netflix/vmaf/archive/refs/tags/v{LIBVMAF['version']}.tar.gz", + "build_dir": "/tmp/vmaf", + "tarball_name": f"vmaf-v{LIBVMAF['version']}.tar.gz", + }, + }, + ), + ( + "ffmpeg-7.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_71["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_71["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_71['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_71['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-7.0", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_70["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_70["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_70['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_70['version']}.tar.bz2", + }, + }, + ), + ( + "ffmpeg-6.1", + { + "link": "http://ffmpeg.org/", + "version": FFMPEG_61["version"], + "version_link": "http://ffmpeg.org/releases/", + "release_date": FFMPEG_61["release_date"], + "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + "license_link": "https://ffmpeg.org/legal.html", + "build_info": { + "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_61['version']}.tar.bz2", + "build_dir": "/tmp/ffmpeg", + "tarball_name": f"ffmpeg-{FFMPEG_61['version']}.tar.bz2", + }, + }, + ), + # ( + # "ffmpeg-5.1", + # { + # "link": "http://ffmpeg.org/", + # "version": FFMPEG_51["version"], + # "version_link": "http://ffmpeg.org/releases/", + # "release_date": FFMPEG_51["release_date"], + # "license_name": "GNU Lesser General Public License (LGPL) version 2.1", + # "license_link": "https://ffmpeg.org/legal.html", + # "build_info": { + # "download_link": f"https://ffmpeg.org/releases/ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # "build_dir": "/tmp/ffmpeg", + # "tarball_name": f"ffmpeg-{FFMPEG_51['version']}.tar.bz2", + # }, + # }, + # ), + ] +) +# come back to this problem, I think yaml configuration might be better. +# with open('libraries.json', 'r') as f: +# data = json.load(f) # todo this should be yaml config +# order_list = data['build_order'] +# LIBRARIES = OrderedDict((key, data['libraries'][key]) for key in order_list) + + +def generate_library_table(filename): + """ + Generates a formatted table of FFmpeg libraries. + cut-n-paste this into the main projects README.md file. + """ + # open the filename for writing, overwrite if it exists + with open(filename, "w") as f: + f.write("## FFMPEG Supported Libraries\n") + f.write( + "The following libraries are used by FFMPEG. The version number and release date are provided along with the license information.\n" + ) + f.write( + "These version numbers are for the lib source builds, which are 'ubuntu2404-edge' and 'foo'.\n" + ) + f.write( + "These libs are included in the package images as well, but the version numbers might vary slightly.\n\n" + ) + + f.write( + "| Libraries | Version | Release Date | Download Source | Checksum | License |\n" + ) + f.write( + "|-----------|---------|--------------|------------ | --- | ---------|\n" + ) + for k, v in LIBRARIES.items(): + libname = f"[{k}]({v['link']})" # link to the library + libversion = f"[{v['version']}]({v['version_link']})" # link to the version + license = ( + f"[{v['license_name']}]({v['license_link']})" # link to the license + ) + # if build_info and build_info.tarball_name and build_info.download_link is avaliabl then set the download_source + download_source = "" + if ( + v.get("build_info") + and v["build_info"].get("tarball_name") + and v["build_info"].get("download_link") + ): + download_source = f"[{v['build_info']['tarball_name']}]({v['build_info']['download_link']})" + checksum = v["build_info"].get("sha256sum", "") + has_checksum = "Yes" if checksum else "No" + + using_source_build = v["build_info"].get("using_source_build", True) + # if we are not using the source build then do not display it in the table. + if using_source_build: + f.write( + f"| {libname} | {libversion} | {v.get('release_date', '')} | {download_source} | {has_checksum} | {license} |\n" + ) + print(f"Library table generated: {filename}") + sys.stdout.flush() + + +def generate_versions_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_versions_manifest.json' file containing library version information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_versions_manifest.json". + """ + + manifest_data = {} + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + manifest_data[library_name] = library_info.get("version", "") + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Versions manifest generated: {output_file}") + sys.stdout.flush() + + +def generate_build_manifest(output_file, ffmpeg_libraries=[]): + """ + Generates a 'generated_build_manifest.json' file containing library download information. + + Args: + ffmpeg_libraries (dict): A dictionary containing FFmpeg library information. + output_file (str, optional): The filename for the build manifest. Defaults to "generated_build_manifest.json". + """ + + manifest_data = [] + if not ffmpeg_libraries: + ffmpeg_libraries = LIBRARIES.keys() + for library_name in ffmpeg_libraries: + library_info = LIBRARIES.get(library_name, {}) + build_info = library_info.get("build_info", {}) + download_url = build_info.get("download_link", "") + build_dir = build_info.get("build_dir", "") + tarball_name = build_info.get("tarball_name", "") + sha256sum = build_info.get("sha256sum", "") + + if not all([build_dir]): + print( + f"Warning: Missing 'build_dir' information for {library_name} in build manifest generation." + ) + continue + + data = { + "library_name": library_name, + "build_dir": build_dir, + } + if download_url and tarball_name: + data["download_url"] = download_url + data["tarball_name"] = tarball_name + + if sha256sum: + data["sha256sum"] = sha256sum + manifest_data.append(data) + + with open(output_file, "w") as f: + json.dump(manifest_data, f, indent=4) + print(f"Build manifest generated: {output_file}") + sys.stdout.flush() + + +def list_of_strings(arg): + return arg.split(",") + + +def main(): + """ + Handles three modes: + 1. Generate both generated files (default) + 2. Generate library table + 3. Generate build manifest + """ + + parser = argparse.ArgumentParser(description="FFmpeg Library Information Script") + parser.add_argument("--library-list", type=list_of_strings, default=[]) + args = parser.parse_args() + + default_versions_table = "generated_versions_table.md" + default_generated_json_file = "generated_build_manifest.json" + default_generated_versions_json = "generated_build_versions_manifest.json" + + generate_library_table(default_versions_table) + generate_build_manifest(default_generated_json_file, args.library_list) + generate_versions_manifest(default_generated_versions_json, args.library_list) + + +if __name__ == "__main__": + main() diff --git a/install_ffmpeg.sh b/install_ffmpeg.sh new file mode 100644 index 000000000..03f96868b --- /dev/null +++ b/install_ffmpeg.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Stop execution on any error +# Note: we can override this in the Dockerfile RUN command with an || true. +# which is useful for debugging +set -e +strip_libs=false + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --strip) + strip_libs=true + shift 1 + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +OS_NAME=$(uname -s) +is_ubuntu=false +is_alpine=false +if [[ "$OS_NAME" == "Linux" ]]; then + if grep -q "Ubuntu" /etc/os-release; then + is_ubuntu=true + elif [[ -f /etc/alpine-release ]]; then + is_alpine=true + fi +fi + +install_ffmpeg() { + echo "Installing ffmpeg" + ## cleanup + # This is used for both the source and packages version ( be robust about looking for libs to copy ) + if [ ! -f ${PREFIX}/bin/ffmpeg ]; then + echo "ERROR: ffmpeg not found in ${PREFIX}/bin" + exit 1 + fi + # Check if ffmpeg library is linked to x86_64-linux-gnu and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep x86_64-linux-gnu | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + # some nvidia libs are in the cuda targets directory + if [[ -d /usr/local/cuda/targets/x86_64-linux/lib/ ]]; then + cp -p /usr/local/cuda/targets/x86_64-linux/lib/libnpp* /usr/local/lib + fi + + # Check if ffmpeg library is linked to opt/ffmpeg and copy it to /usr/local/lib + if ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | grep -q . ; then + ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp -p {} /usr/local/lib/ + fi + + # Create symbolic links for shared libraries in /usr/local/lib + for lib in /usr/local/lib/*.so.*; do + ln -sf "${lib##*/}" "${lib%%.so.*}".so + done + + # Copy ffmpeg binaries and share directory to /usr/local + cp -r ${PREFIX}/bin/* /usr/local/bin/ + cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ + + if [ ! -d /usr/local/include ]; then + mkdir -p /usr/local/include + fi + + # Build configuration and copy include directories + LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ + cp -rp ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include + + # Create pkgconfig directory and copy and modify pkgconfig files + mkdir -p /usr/local/lib/pkgconfig + for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/kvazaar.pc ${PREFIX}/lib/pkgconfig/libsw*.pc ${PREFIX}/lib/x86_64-linux-gnu/pkgconfig/libvmaf*; do + if [[ -f "$pc" ]]; then + # sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}" + sed "s:${PREFIX}:/usr/local:g; s:/lib64:/lib:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ + else + echo "Warning: File '$pc' not found." + fi + done +} + +fakeroot_install_with_striped_libs() { + echo "Installing ffmpeg with fakeroot and striped libs" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +fakeroot_install() { + echo "Using fakeroot to install ffmpeg" + mkdir -p /tmp/fakeroot/lib + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ + cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ + cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ + LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf +} + +# if strip_libs is true then call the install_with_striped_libs function +# else if is_alpine is true then call the fakeroot_install function +if $strip_libs; then + fakeroot_install_with_striped_libs +elif $is_alpine; then + fakeroot_install +else + install_ffmpeg +fi diff --git a/templates/Dockerfile-env b/templates/Dockerfile-env deleted file mode 100644 index 23c21971c..000000000 --- a/templates/Dockerfile-env +++ /dev/null @@ -1,57 +0,0 @@ -FFMPEG_VERSION=%%FFMPEG_VERSION%% \ - AOM_VERSION=v3.8.1 \ - CHROMAPRINT_VERSION=1.5.0 \ - FDKAAC_VERSION=0.1.5 \ - FONTCONFIG_VERSION=2.12.4 \ - FREETYPE_VERSION=2.10.4 \ - FRIBIDI_VERSION=0.19.7 \ - KVAZAAR_VERSION=2.0.0 \ - LAME_VERSION=3.100 \ - LIBASS_VERSION=0.13.7 \ - LIBPTHREAD_STUBS_VERSION=0.4 \ - LIBVIDSTAB_VERSION=1.1.0 \ - LIBXCB_VERSION=1.13.1 \ - XCBPROTO_VERSION=1.13 \ - OGG_VERSION=1.3.2 \ - OPENCOREAMR_VERSION=0.1.5 \ - OPUS_VERSION=1.2 \ - OPENJPEG_VERSION=2.1.2 \ - PYTHON=python3 \ - THEORA_VERSION=1.1.1 \ - VORBIS_VERSION=1.3.5 \ - VPX_VERSION=1.8.0 \ - WEBP_VERSION=1.0.2 \ - X264_VERSION=20170226-2245-stable \ - X265_VERSION=3.4 \ - XAU_VERSION=1.0.9 \ - XORG_MACROS_VERSION=1.19.2 \ - XPROTO_VERSION=7.0.31 \ - XVID_VERSION=1.3.4 \ - LIBXML2_VERSION=2.9.12 \ - LIBBLURAY_VERSION=1.1.2 \ - LIBZMQ_VERSION=4.3.2 \ - LIBSRT_VERSION=1.4.1 \ - LIBARIBB24_VERSION=1.0.3 \ - LIBPNG_VERSION=1.6.9 \ - LIBVMAF_VERSION=2.1.1 \ - ZIMG_VERSION=3.0.5 \ - SRC=/usr/local - -ARG FREETYPE_SHA256SUM="5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac freetype-2.10.4.tar.gz" -ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz" -ARG LIBASS_SHA256SUM="8fadf294bf701300d4605e6f1d92929304187fca4b8d8a47889315526adbafd7 0.13.7.tar.gz" -ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz" -ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" -ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" -ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" -ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" -ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" -ARG LIBBLURAY_SHA256SUM="a3dd452239b100dc9da0d01b30e1692693e2a332a7d29917bf84bb10ea7c0b42 libbluray-1.1.2.tar.bz2" -ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz" -ARG LIBARIBB24_SHA256SUM="f61560738926e57f9173510389634d8c06cabedfa857db4b28fb7704707ff128 v1.0.3.tar.gz" - - -ARG MAKEFLAGS="-j2" -ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" -ARG PREFIX="/opt/ffmpeg" -ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64" diff --git a/templates/Dockerfile-env-alpine b/templates/Dockerfile-env-alpine new file mode 100644 index 000000000..4fa9f989c --- /dev/null +++ b/templates/Dockerfile-env-alpine @@ -0,0 +1,7 @@ +ENV FFMPEG_VERSION=%%FFMPEG_VERSION%% + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" diff --git a/templates/Dockerfile-env-alpine-scratch b/templates/Dockerfile-env-alpine-scratch new file mode 100644 index 000000000..4fa9f989c --- /dev/null +++ b/templates/Dockerfile-env-alpine-scratch @@ -0,0 +1,7 @@ +ENV FFMPEG_VERSION=%%FFMPEG_VERSION%% + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" diff --git a/templates/Dockerfile-env-nvidia b/templates/Dockerfile-env-nvidia new file mode 100644 index 000000000..a12c4338f --- /dev/null +++ b/templates/Dockerfile-env-nvidia @@ -0,0 +1,96 @@ +ENV FFMPEG_VERSION=%%FFMPEG_VERSION%% + +ENV NVIDIA_HEADERS_VERSION=11.1.5.3 + +## opencore-amr - https://sourceforge.net/projects/opencore-amr/ +## x264 - http://www.videolan.org/developers/x264.html +## x265 - http://x265.org/ ( videolan ) +## libogg - https://www.xiph.org/ogg/ ( xiph ) +## libopus - https://www.opus-codec.org/ ( xiph ) +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus +## libvorbis - https://xiph.org/vorbis/ ( xiph ) +## libvpx - https://www.webmproject.org/code/ +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx +## libwebp - https://developers.google.com/speed/webp/ +## libmp3lame - http://lame.sourceforge.net/ +## xvid - https://www.xvid.com/ (xvidcore) +## fdk-aac - https://github.com/mstorsjo/fdk-aac +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac +## openjpeg - https://github.com/uclouvain/openjpeg +## freetype - https://www.freetype.org/ +## consider passing --no-install-recommends for this one its globbie (if you do, pass in libfreetype6) +## libvidstab - https://github.com/georgmartius/vid.stab +## fridibi - https://www.fribidi.org/ +## fontconfig - https://www.freedesktop.org/wiki/Software/fontconfig/ +## libass - https://github.com/libass/libass +## lib aom - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libaom +## libsvtav1 - https://gitlab.com/AOMediaCodec/SVT-AV1.git +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libsvtav1 +## libdav1d - https://code.videolan.org/videolan/dav1d +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libdav1d +## util-macros - (x.org) (and supporting libraries) for screen capture https://xcb.freedesktop.org/ +## xproto - (x.org) +## libXau - +## libpthread - libpthread-stubs +## libxml2 - for libbluray +## libbluray - Requires libxml, freetype, and fontconfig +## libzmq - https://github.com/zeromq/libzmq/ +## this one pulls in a bunch of dependencies +## libpng - this one also pulls in a bunch of stuff +## libaribb24 - +## zimg - https://github.com/sekrit-twc/zimg +## libtheora - http://www.theora.org/ ( xiph ) +## - https://stackoverflow.com/questions/4810996/how-to-resolve-configure-guessing-build-type-failure +## libsrt - https://github.com/Haivision/srt +## Secure Reliable Transport UDP streaming library +## multiple flavors (OpenSSL flavour) and ( GnuTLS flavour) +ARG OPENCORE_PKGS="libopencore-amrnb-dev libopencore-amrnb0 libopencore-amrwb-dev libopencore-amrwb0" +ARG X264_PKGS="libx264-164 libx264-dev" +ARG X265_PKGS="libnuma1 libx265-199 libx265-dev" +# libnuma-dev +ARG OGG_PKGS="libogg-dev libogg0" +ARG OPUS_PKGS="libopus-dev libopus0" +ARG VORBIS_PKGS="libvorbis-dev libvorbis0a libvorbisenc2 libvorbisfile3" +ARG VPX_PKGS="libvpx-dev libvpx9" +ARG WEBP_PKGS="libsharpyuv-dev libsharpyuv0 libwebp-dev libwebp7 libwebpdecoder3 libwebpdemux2 libwebpmux3" +ARG MP3LAME_PKGS="libmp3lame-dev libmp3lame0" +ARG XVIDCORE_PKGS="libxvidcore-dev libxvidcore4" +ARG FDKAAC_PKGS="libfdk-aac-dev libfdk-aac2" +ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev" +# bzip2-doc fontconfig-config fonts-dejavu-core fonts-dejavu-mono libaom3 libbrotli-dev +# libbrotli1 libbsd0 libbz2-dev libc-dev-bin libc-devtools libc6-dev libcrypt-dev libde265-0 +# libdeflate0 libfontconfig1 libfreetype6 libgd3 libheif-plugin-aomdec +# libheif-plugin-aomenc libheif-plugin-libde265 libheif1 libjbig0 libjpeg-turbo8 +# libjpeg8 liblerc4 libpng-dev libpng-tools libpng16-16t64 libsharpyuv0 libtiff6 +# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev +# manpages manpages-dev rpcsvc-proto zlib1g-dev +ARG FREETYPE_PKGS="libfreetype6-dev" +ARG FONTCONFIG_PKGS="libfontconfig-dev libfontconfig1 fontconfig-config fontconfig-config fonts-dejavu-core fonts-dejavu-mono" +ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1" +ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0" +# libass-dev wanted to install a boat-load of packages +ARG LIBASS_PKGS="libass-dev libass9" +ARG AOM_PKGS="libaom-dev libaom3" +ARG SVTAV1_PKGS="libsvtav1-dev libsvtav1enc-dev libsvtav1enc1d1 libsvtav1dec-dev libsvtav1dec0" +ARG DAV1D_PKGS="libdav1d-dev libdav1d7" +# LIBDRM_PKGS picks ups some of the XORG_MACROS_PKGS as well +ARG XORG_MACROS_PKGS="libxcb-shm0-dev libxcb-shm0 libxcb-xfixes0 libxcb-xfixes0-dev" +ARG XPROTO_PKGS="x11proto-core-dev x11proto-dev" +ARG XAU_PKGS="libxau-dev libxau6" +ARG PTHREADS_STUBS_PKGS="libpthread-stubs0-dev" +ARG XML2_PKGS="libxml2-dev libxml2" +ARG BLURAY_PKGS="libbluray-dev libbluray2" +ARG ZMQ_PKGS="libzmq3-dev libzmq5" +# libpng-tools +ARG PNG_PKGS="libpng-dev libpng16-16t64" +ARG ARIBB24_PKGS="libaribb24-dev" +ARG ZIMG_PKGS="libzimg-dev libzimg2" +ARG THEORA_PKGS="libtheora-dev libtheora0" +ARG SRT_PKGS="libssl-dev libsrt-openssl-dev libsrt1.5-openssl" +ARG LIBDRM_PKGS="libbsd0 libdrm-dev libdrm2 libxcb1-dev libxcb1" + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" diff --git a/templates/Dockerfile-env-ubuntu b/templates/Dockerfile-env-ubuntu new file mode 100644 index 000000000..31ec16fc0 --- /dev/null +++ b/templates/Dockerfile-env-ubuntu @@ -0,0 +1,94 @@ +ENV FFMPEG_VERSION=%%FFMPEG_VERSION%% + +## opencore-amr - https://sourceforge.net/projects/opencore-amr/ +## x264 - http://www.videolan.org/developers/x264.html +## x265 - http://x265.org/ ( videolan ) +## libogg - https://www.xiph.org/ogg/ ( xiph ) +## libopus - https://www.opus-codec.org/ ( xiph ) +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus +## libvorbis - https://xiph.org/vorbis/ ( xiph ) +## libvpx - https://www.webmproject.org/code/ +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx +## libwebp - https://developers.google.com/speed/webp/ +## libmp3lame - http://lame.sourceforge.net/ +## xvid - https://www.xvid.com/ (xvidcore) +## fdk-aac - https://github.com/mstorsjo/fdk-aac +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac +## openjpeg - https://github.com/uclouvain/openjpeg +## freetype - https://www.freetype.org/ +## consider passing --no-install-recommends for this one its globbie (if you do, pass in libfreetype6) +## libvidstab - https://github.com/georgmartius/vid.stab +## fridibi - https://www.fribidi.org/ +## fontconfig - https://www.freedesktop.org/wiki/Software/fontconfig/ +## libass - https://github.com/libass/libass +## lib aom - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libaom +## libsvtav1 - https://gitlab.com/AOMediaCodec/SVT-AV1.git +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libsvtav1 +## libdav1d - https://code.videolan.org/videolan/dav1d +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libdav1d +## util-macros - (x.org) (and supporting libraries) for screen capture https://xcb.freedesktop.org/ +## xproto - (x.org) +## libXau - +## libpthread - libpthread-stubs +## libxml2 - for libbluray +## libbluray - Requires libxml, freetype, and fontconfig +## libzmq - https://github.com/zeromq/libzmq/ +## this one pulls in a bunch of dependencies +## libpng - this one also pulls in a bunch of stuff +## libaribb24 - +## zimg - https://github.com/sekrit-twc/zimg +## libtheora - http://www.theora.org/ ( xiph ) +## - https://stackoverflow.com/questions/4810996/how-to-resolve-configure-guessing-build-type-failure +## libsrt - https://github.com/Haivision/srt +## Secure Reliable Transport UDP streaming library +## multiple flavors (OpenSSL flavour) and ( GnuTLS flavour) +ARG OPENCORE_PKGS="libopencore-amrnb-dev libopencore-amrnb0 libopencore-amrwb-dev libopencore-amrwb0" +ARG X264_PKGS="libx264-164 libx264-dev" +ARG X265_PKGS="libnuma1 libx265-199 libx265-dev" +# libnuma-dev +ARG OGG_PKGS="libogg-dev libogg0" +ARG OPUS_PKGS="libopus-dev libopus0" +ARG VORBIS_PKGS="libvorbis-dev libvorbis0a libvorbisenc2 libvorbisfile3" +ARG VPX_PKGS="libvpx-dev libvpx9" +ARG WEBP_PKGS="libsharpyuv-dev libsharpyuv0 libwebp-dev libwebp7 libwebpdecoder3 libwebpdemux2 libwebpmux3" +ARG MP3LAME_PKGS="libmp3lame-dev libmp3lame0" +ARG XVIDCORE_PKGS="libxvidcore-dev libxvidcore4" +ARG FDKAAC_PKGS="libfdk-aac-dev libfdk-aac2" +ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev" +# bzip2-doc fontconfig-config fonts-dejavu-core fonts-dejavu-mono libaom3 libbrotli-dev +# libbrotli1 libbsd0 libbz2-dev libc-dev-bin libc-devtools libc6-dev libcrypt-dev libde265-0 +# libdeflate0 libfontconfig1 libfreetype6 libgd3 libheif-plugin-aomdec +# libheif-plugin-aomenc libheif-plugin-libde265 libheif1 libjbig0 libjpeg-turbo8 +# libjpeg8 liblerc4 libpng-dev libpng-tools libpng16-16t64 libsharpyuv0 libtiff6 +# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev +# manpages manpages-dev rpcsvc-proto zlib1g-dev +ARG FREETYPE_PKGS="libfreetype6-dev" +ARG FONTCONFIG_PKGS="libfontconfig-dev libfontconfig1 fontconfig-config fontconfig-config fonts-dejavu-core fonts-dejavu-mono" +ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1" +ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0" +# libass-dev wanted to install a boat-load of packages +ARG LIBASS_PKGS="libass-dev libass9" +ARG AOM_PKGS="libaom-dev libaom3" +ARG SVTAV1_PKGS="libsvtav1-dev libsvtav1enc-dev libsvtav1enc1d1 libsvtav1dec-dev libsvtav1dec0" +ARG DAV1D_PKGS="libdav1d-dev libdav1d7" +# LIBDRM_PKGS picks ups some of the XORG_MACROS_PKGS as well +ARG XORG_MACROS_PKGS="libxcb-shm0-dev libxcb-shm0 libxcb-xfixes0 libxcb-xfixes0-dev" +ARG XPROTO_PKGS="x11proto-core-dev x11proto-dev" +ARG XAU_PKGS="libxau-dev libxau6" +ARG PTHREADS_STUBS_PKGS="libpthread-stubs0-dev" +ARG XML2_PKGS="libxml2-dev libxml2" +ARG BLURAY_PKGS="libbluray-dev libbluray2" +ARG ZMQ_PKGS="libzmq3-dev libzmq5" +# libpng-tools +ARG PNG_PKGS="libpng-dev libpng16-16t64" +ARG ARIBB24_PKGS="libaribb24-dev" +ARG ZIMG_PKGS="libzimg-dev libzimg2" +ARG THEORA_PKGS="libtheora-dev libtheora0" +ARG SRT_PKGS="libssl-dev libsrt-openssl-dev libsrt1.5-openssl" +ARG LIBDRM_PKGS="libbsd0 libdrm-dev libdrm2 libxcb1-dev libxcb1" + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" diff --git a/templates/Dockerfile-env-ubuntu-edge b/templates/Dockerfile-env-ubuntu-edge new file mode 100644 index 000000000..f5bd1d7b6 --- /dev/null +++ b/templates/Dockerfile-env-ubuntu-edge @@ -0,0 +1,22 @@ +ENV FFMPEG_VERSION=%%FFMPEG_VERSION%% + +# fribidi +ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0" +# libass +ARG LIBASS_PKGS="libass-dev libass9" +# xorg-macros +ARG XORG_MACROS_PKGS="libxcb-shm0-dev libxcb-shm0 libxcb-xfixes0 libxcb-xfixes0-dev" +# libxau +ARG XAU_PKGS="libxau-dev libxau6" +# libpthread-stubs +ARG PTHREADS_STUBS_PKGS="libpthread-stubs0-dev" +# libxml2 ( started giving me download problems, so I went back to the debian package's version ) +ARG XML2_PKGS="libxml2-dev libxml2" +# libpng +ARG PNG_PKGS="libpng-dev libpng16-16t64" + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" diff --git a/templates/Dockerfile-env-vaapi b/templates/Dockerfile-env-vaapi new file mode 100644 index 000000000..31ec16fc0 --- /dev/null +++ b/templates/Dockerfile-env-vaapi @@ -0,0 +1,94 @@ +ENV FFMPEG_VERSION=%%FFMPEG_VERSION%% + +## opencore-amr - https://sourceforge.net/projects/opencore-amr/ +## x264 - http://www.videolan.org/developers/x264.html +## x265 - http://x265.org/ ( videolan ) +## libogg - https://www.xiph.org/ogg/ ( xiph ) +## libopus - https://www.opus-codec.org/ ( xiph ) +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus +## libvorbis - https://xiph.org/vorbis/ ( xiph ) +## libvpx - https://www.webmproject.org/code/ +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx +## libwebp - https://developers.google.com/speed/webp/ +## libmp3lame - http://lame.sourceforge.net/ +## xvid - https://www.xvid.com/ (xvidcore) +## fdk-aac - https://github.com/mstorsjo/fdk-aac +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac +## openjpeg - https://github.com/uclouvain/openjpeg +## freetype - https://www.freetype.org/ +## consider passing --no-install-recommends for this one its globbie (if you do, pass in libfreetype6) +## libvidstab - https://github.com/georgmartius/vid.stab +## fridibi - https://www.fribidi.org/ +## fontconfig - https://www.freedesktop.org/wiki/Software/fontconfig/ +## libass - https://github.com/libass/libass +## lib aom - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libaom +## libsvtav1 - https://gitlab.com/AOMediaCodec/SVT-AV1.git +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libsvtav1 +## libdav1d - https://code.videolan.org/videolan/dav1d +## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libdav1d +## util-macros - (x.org) (and supporting libraries) for screen capture https://xcb.freedesktop.org/ +## xproto - (x.org) +## libXau - +## libpthread - libpthread-stubs +## libxml2 - for libbluray +## libbluray - Requires libxml, freetype, and fontconfig +## libzmq - https://github.com/zeromq/libzmq/ +## this one pulls in a bunch of dependencies +## libpng - this one also pulls in a bunch of stuff +## libaribb24 - +## zimg - https://github.com/sekrit-twc/zimg +## libtheora - http://www.theora.org/ ( xiph ) +## - https://stackoverflow.com/questions/4810996/how-to-resolve-configure-guessing-build-type-failure +## libsrt - https://github.com/Haivision/srt +## Secure Reliable Transport UDP streaming library +## multiple flavors (OpenSSL flavour) and ( GnuTLS flavour) +ARG OPENCORE_PKGS="libopencore-amrnb-dev libopencore-amrnb0 libopencore-amrwb-dev libopencore-amrwb0" +ARG X264_PKGS="libx264-164 libx264-dev" +ARG X265_PKGS="libnuma1 libx265-199 libx265-dev" +# libnuma-dev +ARG OGG_PKGS="libogg-dev libogg0" +ARG OPUS_PKGS="libopus-dev libopus0" +ARG VORBIS_PKGS="libvorbis-dev libvorbis0a libvorbisenc2 libvorbisfile3" +ARG VPX_PKGS="libvpx-dev libvpx9" +ARG WEBP_PKGS="libsharpyuv-dev libsharpyuv0 libwebp-dev libwebp7 libwebpdecoder3 libwebpdemux2 libwebpmux3" +ARG MP3LAME_PKGS="libmp3lame-dev libmp3lame0" +ARG XVIDCORE_PKGS="libxvidcore-dev libxvidcore4" +ARG FDKAAC_PKGS="libfdk-aac-dev libfdk-aac2" +ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev" +# bzip2-doc fontconfig-config fonts-dejavu-core fonts-dejavu-mono libaom3 libbrotli-dev +# libbrotli1 libbsd0 libbz2-dev libc-dev-bin libc-devtools libc6-dev libcrypt-dev libde265-0 +# libdeflate0 libfontconfig1 libfreetype6 libgd3 libheif-plugin-aomdec +# libheif-plugin-aomenc libheif-plugin-libde265 libheif1 libjbig0 libjpeg-turbo8 +# libjpeg8 liblerc4 libpng-dev libpng-tools libpng16-16t64 libsharpyuv0 libtiff6 +# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev +# manpages manpages-dev rpcsvc-proto zlib1g-dev +ARG FREETYPE_PKGS="libfreetype6-dev" +ARG FONTCONFIG_PKGS="libfontconfig-dev libfontconfig1 fontconfig-config fontconfig-config fonts-dejavu-core fonts-dejavu-mono" +ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1" +ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0" +# libass-dev wanted to install a boat-load of packages +ARG LIBASS_PKGS="libass-dev libass9" +ARG AOM_PKGS="libaom-dev libaom3" +ARG SVTAV1_PKGS="libsvtav1-dev libsvtav1enc-dev libsvtav1enc1d1 libsvtav1dec-dev libsvtav1dec0" +ARG DAV1D_PKGS="libdav1d-dev libdav1d7" +# LIBDRM_PKGS picks ups some of the XORG_MACROS_PKGS as well +ARG XORG_MACROS_PKGS="libxcb-shm0-dev libxcb-shm0 libxcb-xfixes0 libxcb-xfixes0-dev" +ARG XPROTO_PKGS="x11proto-core-dev x11proto-dev" +ARG XAU_PKGS="libxau-dev libxau6" +ARG PTHREADS_STUBS_PKGS="libpthread-stubs0-dev" +ARG XML2_PKGS="libxml2-dev libxml2" +ARG BLURAY_PKGS="libbluray-dev libbluray2" +ARG ZMQ_PKGS="libzmq3-dev libzmq5" +# libpng-tools +ARG PNG_PKGS="libpng-dev libpng16-16t64" +ARG ARIBB24_PKGS="libaribb24-dev" +ARG ZIMG_PKGS="libzimg-dev libzimg2" +ARG THEORA_PKGS="libtheora-dev libtheora0" +ARG SRT_PKGS="libssl-dev libsrt-openssl-dev libsrt1.5-openssl" +ARG LIBDRM_PKGS="libbsd0 libdrm-dev libdrm2 libxcb1-dev libxcb1" + +ENV MAKEFLAGS="-j2" +ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig" + +ENV PREFIX="/opt/ffmpeg" +ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu" diff --git a/templates/Dockerfile-run b/templates/Dockerfile-run deleted file mode 100644 index 73abe7302..000000000 --- a/templates/Dockerfile-run +++ /dev/null @@ -1,423 +0,0 @@ -## libvmaf https://github.com/Netflix/vmaf -RUN \ - if which meson || false; then \ - echo "Building VMAF." && \ - DIR=/tmp/vmaf && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Netflix/vmaf/archive/v${LIBVMAF_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBVMAF_VERSION}.tar.gz && \ - cd /tmp/vmaf/libvmaf && \ - meson build --buildtype release --prefix=${PREFIX} && \ - ninja -vC build && \ - ninja -vC build install && \ - mkdir -p ${PREFIX}/share/model/ && \ - cp -r /tmp/vmaf/model/* ${PREFIX}/share/model/ && \ - rm -rf ${DIR}; \ - else \ - echo "VMAF skipped."; \ - fi - -## opencore-amr https://sourceforge.net/projects/opencore-amr/ -RUN \ - DIR=/tmp/opencore-amr && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## x264 http://www.videolan.org/developers/x264.html -RUN \ - DIR=/tmp/x264 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ - tar -jx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ - make && \ - make install && \ - rm -rf ${DIR} -### x265 http://x265.org/ -RUN \ - DIR=/tmp/x265 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/videolan/x265/archive/refs/tags/${X265_VERSION}.tar.gz | \ - tar -zx && \ - cd x265-${X265_VERSION}/build/linux && \ - sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ - sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ - ./multilib.sh && \ - make -C 8bit install && \ - rm -rf ${DIR} -### libogg https://www.xiph.org/ogg/ -RUN \ - DIR=/tmp/ogg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \ - echo ${OGG_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libopus https://www.opus-codec.org/ -RUN \ - DIR=/tmp/opus && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \ - echo ${OPUS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvorbis https://xiph.org/vorbis/ -RUN \ - DIR=/tmp/vorbis && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \ - echo ${VORBIS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libtheora http://www.theora.org/ -RUN \ - DIR=/tmp/theora && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \ - echo ${THEORA_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libvpx https://www.webmproject.org/code/ -RUN \ - DIR=/tmp/vpx && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \ - --disable-debug --disable-examples --disable-docs --disable-install-bins && \ - make && \ - make install && \ - rm -rf ${DIR} -### libwebp https://developers.google.com/speed/webp/ -RUN \ - DIR=/tmp/vebp && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -### libmp3lame http://lame.sourceforge.net/ -RUN \ - DIR=/tmp/lame && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://sourceforge.net/projects/lame/files/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz/download | \ - tar -zx --strip-components=1 && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \ - make && \ - make install && \ - rm -rf ${DIR} -### xvid https://www.xvid.com/ -RUN \ - DIR=/tmp/xvid && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \ - echo ${XVID_SHA256SUM} | sha256sum --check && \ - tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \ - cd xvidcore/build/generic && \ - ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" && \ - make && \ - make install && \ - rm -rf ${DIR} -### fdk-aac https://github.com/mstorsjo/fdk-aac -RUN \ - DIR=/tmp/fdk-aac && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - autoreconf -fiv && \ - ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \ - make && \ - make install && \ - rm -rf ${DIR} -## openjpeg https://github.com/uclouvain/openjpeg -RUN \ - DIR=/tmp/openjpeg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## freetype https://www.freetype.org/ -RUN \ - DIR=/tmp/freetype && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ - echo ${FREETYPE_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libvstab https://github.com/georgmartius/vid.stab -RUN \ - DIR=/tmp/vid.stab && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz && \ - echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} -## fridibi https://www.fribidi.org/ -RUN \ - DIR=/tmp/fribidi && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \ - echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \ - sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \ - ./bootstrap --no-config --auto && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make -j1 && \ - make install && \ - rm -rf ${DIR} -## fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ -RUN \ - DIR=/tmp/fontconfig && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## libass https://github.com/libass/libass -RUN \ - DIR=/tmp/libass && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/libass/libass/archive/${LIBASS_VERSION}.tar.gz && \ - echo ${LIBASS_SHA256SUM} | sha256sum --check && \ - tar -zx --strip-components=1 -f ${LIBASS_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} -## kvazaar https://github.com/ultravideo/kvazaar -RUN \ - DIR=/tmp/kvazaar && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/aom && \ - git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \ - cd ${DIR} ; \ - rm -rf CMakeCache.txt CMakeFiles ; \ - mkdir -p ./aom_build ; \ - cd ./aom_build ; \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \ - make ; \ - make install ; \ - rm -rf ${DIR} - -## libxcb (and supporting libraries) for screen capture https://xcb.freedesktop.org/ -RUN \ - DIR=/tmp/xorg-macros && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive//individual/util/util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f util-macros-${XORG_MACROS_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/xproto && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/proto/xproto-${XPROTO_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f xproto-${XPROTO_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libXau && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://www.x.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libXau-${XAU_VERSION}.tar.gz && \ - ./configure --srcdir=${DIR} --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -RUN \ - DIR=/tmp/libpthread-stubs && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - - -## libxml2 - for libbluray -RUN \ - DIR=/tmp/libxml2 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/GNOME/libxml2/archive/refs/tags/v${LIBXML2_VERSION}.tar.gz | \ - tar -xz --strip-components=1 && \ - ./autogen.sh --prefix="${PREFIX}" --with-ftp=no --with-http=no --with-python=no && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libbluray - Requires libxml, freetype, and fontconfig -RUN \ - DIR=/tmp/libbluray && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://download.videolan.org/pub/videolan/libbluray/${LIBBLURAY_VERSION}/libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - echo ${LIBBLURAY_SHA256SUM} | sha256sum --check && \ - tar -jx --strip-components=1 -f libbluray-${LIBBLURAY_VERSION}.tar.bz2 && \ - ./configure --prefix="${PREFIX}" --disable-examples --disable-bdjava-jar --disable-static --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libzmq https://github.com/zeromq/libzmq/ -RUN \ - DIR=/tmp/libzmq && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ - echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libsrt https://github.com/Haivision/srt -RUN \ - DIR=/tmp/srt && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/Haivision/srt/archive/v${LIBSRT_VERSION}.tar.gz && \ - tar -xz --strip-components=1 -f v${LIBSRT_VERSION}.tar.gz && \ - cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \ - make && \ - make install && \ - rm -rf ${DIR} - -## libpng -RUN \ - DIR=/tmp/png && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - git clone https://git.code.sf.net/p/libpng/code ${DIR} -b v${LIBPNG_VERSION} --depth 1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" && \ - make check && \ - make install && \ - rm -rf ${DIR} - -## libaribb24 -RUN \ - DIR=/tmp/b24 && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sLO https://github.com/nkoriyama/aribb24/archive/v${LIBARIBB24_VERSION}.tar.gz && \ - echo ${LIBARIBB24_SHA256SUM} | sha256sum --check && \ - tar -xz --strip-components=1 -f v${LIBARIBB24_VERSION}.tar.gz && \ - autoreconf -fiv && \ - ./configure CFLAGS="-I${PREFIX}/include -fPIC" --prefix="${PREFIX}" && \ - make && \ - make install && \ - rm -rf ${DIR} - -# zimg https://github.com/sekrit-twc/zimg -RUN \ - DIR=/tmp/zimg && \ - mkdir -p ${DIR} && \ - cd ${DIR} && \ - curl -sL https://github.com/sekrit-twc/zimg/archive/refs/tags/release-${ZIMG_VERSION}.tar.gz | \ - tar -zx --strip-components=1 && \ - ./autogen.sh && \ - ./configure --prefix="${PREFIX}" --enable-shared && \ - make && \ - make install && \ - rm -rf ${DIR} - -## Download ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \ - curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ - ./configure --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --extra-libs=-ldl && \ - make ; make install - - - - - -## Build ffmpeg https://ffmpeg.org/ -RUN \ - DIR=/tmp/ffmpeg && cd ${DIR} && \ - ./configure \ - %%FFMPEG_CONFIG_FLAGS%% && \ - make clean && \ - make && \ - make install && \ - make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \ - make distclean && \ - hash -r && \ - cd tools && \ - make qt-faststart && cp qt-faststart ${PREFIX}/bin/ diff --git a/templates/Dockerfile-run-alpine b/templates/Dockerfile-run-alpine new file mode 100644 index 000000000..1dd75554c --- /dev/null +++ b/templates/Dockerfile-run-alpine @@ -0,0 +1,20 @@ +# Note: pass '--library-list lib1,lib2,lib3 for more control. +# Here we have 3 libs that we have to build from source +# vmaf +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar,libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# # libevent && libevent-dev has usr/lib/libevent_pthreads ??? +# ## libbluray - Requires libxml, freetype, and fontconfig +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libpthread-stubs,libbluray,libaribb24 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-%%FFMPEG_VERSION%% +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# when debugging you can pass in || true to the end of the command +# to keep the build going even if one of the steps fails +RUN /tmp/workdir/install_ffmpeg.sh diff --git a/templates/Dockerfile-run-alpine-scratch b/templates/Dockerfile-run-alpine-scratch new file mode 100644 index 000000000..caddc5774 --- /dev/null +++ b/templates/Dockerfile-run-alpine-scratch @@ -0,0 +1,112 @@ +# Note: pass '--library-list' to 'generate-source-of-truth-ffmpeg-versions.py' +# ex: '--library-list lib1,lib2,lib3' +# for more control over the build process, and how the docker layers are cached + +# RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libopencore-amr,libx264,libx265,libogg,libopus,libvorbis,libvpx,libwebp,libmp3lame,libxvid,libfdk-aac,openjpeg,freetype,libvidstab,fribidi,fontconfig,libass,kvazaar,aom,libsvtav1,xorg-macros,xproto,libxau,libpthread-stubs,libxml2,libbluray,libzmq,libpng,libaribb24,zimg,libtheora,libsrt,libvmaf,ffmpeg +# dont do this 👆 where all of the libs are built at one time. +# by splitting them up into batches we allow docker to cache the layers ( which is a lifesaver when debugging ) +# I left this line in here, as it shows the proper order of the libraries that need to be built. ( what worked ) +# there are only a few build deps. I remember that libtheora needed libogg. + +# RUN \ +# echo "Installing dependencies..." && \ +# apt-get install -yq --no-install-recommends ${FRIBIDI_PKGS} ${LIBASS_PKGS} ${XORG_MACROS_PKGS} ${XAU_PKGS} ${XML2_PKGS} ${PNG_PKGS} + # apt-get install -yq --no-install-recommends ${FRIBIDI_PKGS} ${LIBASS_PKGS} ${XORG_MACROS_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${PNG_PKGS} + + +# First batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libopencore-amr,\ +libx264,\ +libx265,\ +libogg,\ +libopus +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libvorbis,\ +libvpx,\ +libwebp,\ +libmp3lame +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libxvid,libpthread-stubs +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libfdk-aac,\ +openjpeg,\ +freetype,\ +libvidstab +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list fontconfig +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +aom,\ +xorg-macros,\ +libsvtav1 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +# note: took out 'xproto' because of the configure.guess error +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libxau +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libxml2,\ +libbluray,\ +libzmq +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libaribb24,\ +zimg +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libtheora +# Note: libtheora is dependant on libogg +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# # additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libsrt,\ +libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# This is a slow one, put it on its own container layer to speed up the build (allowing it to be cached) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-%%FFMPEG_VERSION%% +## when debugging you can pass in || true to the end of the next 3 commands +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# TODO add a strip and fakeroot argument +RUN /tmp/workdir/install_ffmpeg.sh --strip diff --git a/templates/Dockerfile-run-nvidia b/templates/Dockerfile-run-nvidia new file mode 100644 index 000000000..54cfc203f --- /dev/null +++ b/templates/Dockerfile-run-nvidia @@ -0,0 +1,29 @@ +RUN \ + echo "Installing dependencies..." && \ + apt-get install -yq --no-install-recommends ${OPENCORE_PKGS} ${X264_PKGS} ${X265_PKGS} ${OGG_PKGS} ${OPUS_PKGS} ${VORBIS_PKGS} ${VPX_PKGS} ${WEBP_PKGS} ${MP3LAME_PKGS} ${XVIDCORE_PKGS} ${FDKAAC_PKGS} ${OPENJP_PKGS} ${FREETYPE_PKGS} ${VIDSTAB_PKGS} ${FRIBIDI_PKGS} ${FONTCONFIG_PKGS} ${LIBASS_PKGS} ${AOM_PKGS} ${SVTAV1_PKGS} ${DAV1D_PKGS} ${XORG_MACROS_PKGS} ${XPROTO_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${BLURAY_PKGS} ${ZMQ_PKGS} ${PNG_PKGS} ${ARIBB24_PKGS} ${ZIMG_PKGS} ${THEORA_PKGS} ${SRT_PKGS} ${LIBDRM_PKGS} + + # apt install libdrm-dev + +## libvmaf https://github.com/Netflix/vmaf +## https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 +RUN \ + echo "Adding g++ for VMAF build" && \ + apt-get install -yq g++ + +# Note: pass '--library-list lib1,lib2,lib3 for more control. +# Here we have 3 libs that we have to build from source +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar,libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list nvidia-codec-headers +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-%%FFMPEG_VERSION%% +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +## when debugging you can pass in || true to the end of the command +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/install_ffmpeg.sh diff --git a/templates/Dockerfile-run-ubuntu b/templates/Dockerfile-run-ubuntu new file mode 100644 index 000000000..89743c44a --- /dev/null +++ b/templates/Dockerfile-run-ubuntu @@ -0,0 +1,25 @@ +RUN \ + echo "Installing dependencies..." && \ + apt-get install -yq --no-install-recommends ${OPENCORE_PKGS} ${X264_PKGS} ${X265_PKGS} ${OGG_PKGS} ${OPUS_PKGS} ${VORBIS_PKGS} ${VPX_PKGS} ${WEBP_PKGS} ${MP3LAME_PKGS} ${XVIDCORE_PKGS} ${FDKAAC_PKGS} ${OPENJP_PKGS} ${FREETYPE_PKGS} ${VIDSTAB_PKGS} ${FRIBIDI_PKGS} ${FONTCONFIG_PKGS} ${LIBASS_PKGS} ${AOM_PKGS} ${SVTAV1_PKGS} ${DAV1D_PKGS} ${XORG_MACROS_PKGS} ${XPROTO_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${BLURAY_PKGS} ${ZMQ_PKGS} ${PNG_PKGS} ${ARIBB24_PKGS} ${ZIMG_PKGS} ${THEORA_PKGS} ${SRT_PKGS} ${LIBDRM_PKGS} + + # apt install libdrm-dev + +## libvmaf https://github.com/Netflix/vmaf +## https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 +RUN \ + echo "Adding g++ for VMAF build" && \ + apt-get install -yq g++ + +# Note: pass '--library-list lib1,lib2,lib3 for more control. +# Here we have 3 libs that we have to build from source +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar,libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-%%FFMPEG_VERSION%% +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +## when debugging you can pass in || true to the end of the command +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/install_ffmpeg.sh diff --git a/templates/Dockerfile-run-ubuntu-edge b/templates/Dockerfile-run-ubuntu-edge new file mode 100644 index 000000000..869a30e98 --- /dev/null +++ b/templates/Dockerfile-run-ubuntu-edge @@ -0,0 +1,104 @@ +# Note: pass '--library-list' to 'generate-source-of-truth-ffmpeg-versions.py' +# ex: '--library-list lib1,lib2,lib3' +# for more control over the build process, and how the docker layers are cached + +# RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libopencore-amr,libx264,libx265,libogg,libopus,libvorbis,libvpx,libwebp,libmp3lame,libxvid,libfdk-aac,openjpeg,freetype,libvidstab,fribidi,fontconfig,libass,kvazaar,aom,libsvtav1,xorg-macros,xproto,libxau,libpthread-stubs,libxml2,libbluray,libzmq,libpng,libaribb24,zimg,libtheora,libsrt,libvmaf,ffmpeg +# dont do this 👆 where all of the libs are built at one time. +# by splitting them up into batches we allow docker to cache the layers ( which is a lifesaver when debugging ) +# I left this line in here, as it shows the proper order of the libraries that need to be built. ( what worked ) +# there are only a few build deps. I remember that libtheora needed libogg. + +RUN \ + echo "Installing dependencies..." && \ + apt-get install -yq --no-install-recommends ${FRIBIDI_PKGS} ${LIBASS_PKGS} ${XORG_MACROS_PKGS} ${XAU_PKGS} ${XML2_PKGS} ${PNG_PKGS} + # apt-get install -yq --no-install-recommends ${FRIBIDI_PKGS} ${LIBASS_PKGS} ${XORG_MACROS_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${PNG_PKGS} + + +# First batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libopencore-amr,\ +libx264,\ +libx265,\ +libogg,\ +libopus +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libvorbis,\ +libvpx,\ +libwebp,\ +libmp3lame +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list libxvid,libpthread-stubs +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libfdk-aac,\ +openjpeg,\ +freetype,\ +libvidstab +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list fontconfig +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +aom,\ +libsvtav1 +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list xproto +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libbluray,\ +libzmq +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libaribb24,\ +zimg,\ +libtheora +# Note: libtheora is dependant on libogg +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# additional batch of libraries ( split into docker layers, to allow for caching ) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list \ +libsrt,\ +libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +# This is a slow one, put it on its own container layer to speed up the build (allowing it to be cached) +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-%%FFMPEG_VERSION%% +## when debugging you can pass in || true to the end of the next 3 commands +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/install_ffmpeg.sh diff --git a/templates/Dockerfile-run-vaapi b/templates/Dockerfile-run-vaapi new file mode 100644 index 000000000..26d3fc940 --- /dev/null +++ b/templates/Dockerfile-run-vaapi @@ -0,0 +1,29 @@ +RUN \ + echo "Installing dependencies..." && \ + apt-get install -yq --no-install-recommends ${OPENCORE_PKGS} ${X264_PKGS} ${X265_PKGS} ${OGG_PKGS} ${OPUS_PKGS} ${VORBIS_PKGS} ${VPX_PKGS} ${WEBP_PKGS} ${MP3LAME_PKGS} ${XVIDCORE_PKGS} ${FDKAAC_PKGS} ${OPENJP_PKGS} ${FREETYPE_PKGS} ${VIDSTAB_PKGS} ${FRIBIDI_PKGS} ${FONTCONFIG_PKGS} ${LIBASS_PKGS} ${AOM_PKGS} ${SVTAV1_PKGS} ${DAV1D_PKGS} ${XORG_MACROS_PKGS} ${XPROTO_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${BLURAY_PKGS} ${ZMQ_PKGS} ${PNG_PKGS} ${ARIBB24_PKGS} ${ZIMG_PKGS} ${THEORA_PKGS} ${SRT_PKGS} ${LIBDRM_PKGS} + +RUN \ + apt-get install -y --no-install-recommends libva-drm2 libva2 i965-va-driver + + # apt install libdrm-dev + +## libvmaf https://github.com/Netflix/vmaf +## https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059 +RUN \ + echo "Adding g++ for VMAF build" && \ + apt-get install -yq g++ + +# Note: pass '--library-list lib1,lib2,lib3 for more control. +# Here we have 3 libs that we have to build from source +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar,libvmaf +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + +RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-%%FFMPEG_VERSION%% +RUN /tmp/workdir/download_tarballs.sh +RUN /tmp/workdir/build_source.sh + + +## when debugging you can pass in || true to the end of the command +## to keep the build going even if one of the steps fails +RUN /tmp/workdir/install_ffmpeg.sh diff --git a/templates/Dockerfile-template.alpine313 b/templates/Dockerfile-template.alpine313 deleted file mode 100644 index 2635c114b..000000000 --- a/templates/Dockerfile-template.alpine313 +++ /dev/null @@ -1,70 +0,0 @@ -# ffmpeg - http://ffmpeg.org/download.html -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# - -FROM alpine:3.13 AS base - -RUN apk add --no-cache --update libgcc libstdc++ ca-certificates libcrypto1.1 libssl1.1 libgomp expat git - - -FROM base AS build - -WORKDIR /tmp/workdir - -ENV %%ENV%% - -RUN buildDeps="autoconf \ - automake \ - bash \ - binutils \ - bzip2 \ - cmake \ - coreutils \ - curl \ - diffutils \ - expat-dev \ - file \ - g++ \ - gcc \ - gperf \ - libtool \ - make \ - nasm \ - openssl-dev \ - python3 \ - tar \ - xcb-proto \ - yasm \ - zlib-dev" && \ - apk add --no-cache --update ${buildDeps} -%%RUN%% - -RUN \ - ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - mkdir -p /usr/local/include && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - -### Release Stage -FROM base AS release -LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ - org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -COPY --from=build /usr/local /usr/local - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output diff --git a/templates/Dockerfile-template.alpine320 b/templates/Dockerfile-template.alpine320 new file mode 100644 index 000000000..cc2fd2308 --- /dev/null +++ b/templates/Dockerfile-template.alpine320 @@ -0,0 +1,183 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# + +FROM alpine:3.20 AS builder + +RUN apk add --no-cache --update libgcc libstdc++ ca-certificates openssl expat git less tree file vim bash + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + +RUN chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +%%ENV%% + +RUN libDeps="libgomp \ + # https://github.com/zeromq/libzmq/ + zeromq \ + zeromq-dev \ + # https://sourceforge.net/projects/opencore-amr/ + opencore-amr \ + opencore-amr-dev \ + # https://www.xiph.org/ogg/ + libogg \ + libogg-static \ + libogg-dev \ + # libtheora http://www.theora.org/ + libtheora \ + libtheora-static \ + libtheora-dev \ + # http://www.videolan.org/developers/x264.html + x264 \ + x264-libs \ + x264-dev \ + # http://x265.org/ + x265 \ + x265-libs \ + x265-dev \ + # https://www.opus-codec.org/ + opus \ + opus-tools \ + opus-dev \ + # https://xiph.org/vorbis/ + libvorbis \ + libvorbis-static \ + libvorbis-dev \ + # https://www.webmproject.org/code/ + libvpx \ + libvpx-utils \ + libvpx-dev \ + # https://developers.google.com/speed/webp/ + libwebp \ + libwebp-dev \ + libwebp-static \ + libwebp-tools \ + # http://lame.sourceforge.net/ + lame \ + lame-libs \ + lame-dev \ + # https://www.xvid.com/ + xvidcore \ + xvidcore-static \ + xvidcore-dev \ + # https://github.com/mstorsjo/fdk-aac + fdk-aac \ + fdk-aac-dev \ + # https://github.com/uclouvain/openjpeg + openjpeg \ + openjpeg-tools \ + openjpeg-dev \ + # https://www.freetype.org/ + freetype \ + freetype-static \ + freetype-dev \ + # https://github.com/georgmartius/vid.stab + vidstab \ + vidstab-dev \ + ## https://www.fribidi.org/ + fribidi \ + fribidi-static \ + fribidi-dev \ + # fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/ + fontconfig \ + fontconfig-static \ + fontconfig-dev \ + # https://github.com/libass/libass + libass \ + libass-dev \ + # https://aomedia.googlesource.com/aom + aom \ + aom-libs \ + aom-dev \ + # https://xcb.freedesktop.org/ + # https://www.x.org/archive//individual/util/util-macros- + util-macros \ + # https://www.x.org/archive/individual/proto/ + xorgproto \ + # https://www.x.org/archive/individual/lib/libXau- + libxau \ + libxau-dev \ + # https://github.com/GNOME/libxml2/ + libxml2 \ + libxml2-static \ + libxml2-utils \ + libxml2-dev \ + # https://github.com/Haivision/srt + libsrt \ + libsrt-progs \ + libsrt-dev \ + # https://git.code.sf.net/p/libpng/code + libpng \ + libpng-static \ + libpng-utils \ + libpng-dev \ + # https://github.com/sekrit-twc/zimg + zimg \ + zimg-dev \ + dav1d \ + libdav1d \ + dav1d-dev \ + svt-av1 \ + svt-av1-dev \ + libSvtAv1Enc \ + libSvtAv1Dec" && \ + apk add --no-cache --update ${libDeps} + + +RUN buildDeps="autoconf \ + automake \ + bash \ + binutils \ + bzip2 \ + cmake \ + coreutils \ + curl \ + wget \ + jq \ + diffutils \ + expat-dev \ + file \ + g++ \ + gcc \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + openssl-dev \ + python3 \ + tar \ + xz \ + xcb-proto \ + yasm \ + zlib-dev \ + alpine-sdk \ + linux-headers" && \ + apk add --no-cache --update ${buildDeps} + +%%RUN%% + +### Release Stage +FROM alpine:3.20 AS release +# RUN apk add --no-cache --update bash less tree file vim +COPY --from=builder /usr/local /usr/local +COPY --from=builder /tmp/fakeroot/ / + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["/bin/ffmpeg"] diff --git a/templates/Dockerfile-template.nvidia2404 b/templates/Dockerfile-template.nvidia2404 new file mode 100644 index 000000000..0bab49c50 --- /dev/null +++ b/templates/Dockerfile-template.nvidia2404 @@ -0,0 +1,106 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# +# Stage 1: Build ( https://hub.docker.com/r/nvidia/cuda ) +FROM nvidia/cuda:12.6.2-devel-ubuntu24.04 AS builder + +ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,video +ENV DEBIAN_FRONTEND=noninteractive + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + +ENV %%ENV%% + +# Note: I don't think we need 'ca-certificates' +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +RUN buildDeps="autoconf \ + automake \ + cmake \ + build-essential \ + texinfo \ + curl \ + wget \ + tar \ + bzip2 \ + libexpat1-dev \ + gcc \ + git \ + git-core \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + perl \ + pkg-config \ + python3 \ + yasm \ + zlib1g-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libsdl2-dev \ + libva-dev \ + libvdpau-dev \ + libnuma-dev \ + libdav1d-dev \ + openssl \ + libssl-dev \ + expat \ + libgomp1 \ + ca-certificates \ + libxcb-shape0-dev \ + libavformat-dev" && \ + apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ${buildDeps} + +%%RUN%% + + +# Stage 2: Final Image ( shrink the size back down ) +# FROM nvidia/cuda:12.6.2-runtime-ubuntu24.04 +FROM nvidia/cuda:12.6.2-base-ubuntu24.04 AS runtime +# We used to use runtime, but I switched us to base, as it is significantly-smaller. +# (~ 80Megs ) base: Includes the CUDA runtime (cudart) +# (~ 1.4Gigs) runtime: Builds on the base and includes the CUDA math libraries⁠, and NCCL⁠. +# (~ 4 Gigs ) devel: Builds on the runtime and includes headers, development tools for building CUDA images. + +# COPY --from=builder /usr/local /usr/local/ +# copy only needed files, without copying nvidia dev files +COPY --from=builder /usr/local/bin /usr/local/bin/ +COPY --from=builder /usr/local/share /usr/local/share/ +COPY --from=builder /usr/local/lib /usr/local/lib/ +COPY --from=builder /usr/local/include /usr/local/include/ + +ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,video +ENV DEBIAN_FRONTEND=nonintercative +WORKDIR /tmp/workdir + +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 libxcb-shape0-dev && \ + apt-get autoremove -y && \ + apt-get clean -y + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["ffmpeg"] diff --git a/templates/Dockerfile-template.scratch313 b/templates/Dockerfile-template.scratch313 deleted file mode 100644 index 733f28e99..000000000 --- a/templates/Dockerfile-template.scratch313 +++ /dev/null @@ -1,67 +0,0 @@ -# ffmpeg - http://ffmpeg.org/download.html -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# - -FROM alpine:3.13 AS build - -WORKDIR /tmp/workdir - -ENV %%ENV%% - -RUN buildDeps="autoconf \ - automake \ - bash \ - binutils \ - bzip2 \ - ca-certificates \ - cmake \ - coreutils \ - curl \ - diffutils \ - expat-dev \ - file \ - g++ \ - gcc \ - git \ - gperf \ - libcrypto1.1 \ - libgcc \ - libssl1.1 \ - libstdc++ \ - libtool \ - make \ - nasm \ - openssl-dev \ - python3 \ - tar \ - xcb-proto \ - yasm \ - zlib-dev" && \ - apk add --update ${buildDeps} - -%%RUN%% - -RUN \ - mkdir -p /tmp/fakeroot/lib && \ - ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | strings | xargs -I R cp R /tmp/fakeroot/lib/ && \ - for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done && \ - cp -r ${PREFIX}/bin /tmp/fakeroot/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /tmp/fakeroot/share/ && \ - LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf - -### Release Stage -FROM scratch AS release -LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ - org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["/bin/ffmpeg"] - -COPY --from=build /tmp/fakeroot/ / - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output diff --git a/templates/Dockerfile-template.scratch320 b/templates/Dockerfile-template.scratch320 new file mode 100644 index 000000000..32cba1be0 --- /dev/null +++ b/templates/Dockerfile-template.scratch320 @@ -0,0 +1,90 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# + +FROM alpine:3.20 AS builder + +RUN apk add --no-cache --update libgcc libstdc++ ca-certificates openssl expat git libgomp less tree file vim bash +# apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + +RUN chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +%%ENV%% + + +RUN buildDeps="autoconf \ + automake \ + bash \ + binutils \ + bzip2 \ + cmake \ + coreutils \ + curl \ + jq \ + diffutils \ + expat-dev \ + file \ + g++ \ + gcc \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + openssl-dev \ + python3 \ + tar \ + xz \ + bzip2 \ + xcb-proto \ + yasm \ + zlib-dev \ + alpine-sdk \ + linux-headers\ + ## https://www.fribidi.org/ + fribidi \ + fribidi-static \ + fribidi-dev\ + # https://github.com/libass/libass + libass \ + libass-dev\ + # https://www.x.org/archive/individual/proto/ + xorgproto \ + # https://git.code.sf.net/p/libpng/code + libpng \ + libpng-static \ + libpng-utils \ + libpng-dev\ + dav1d \ + libdav1d \ + dav1d-dev" && \ + apk add --no-cache --update ${buildDeps} + +%%RUN%% + +### Release Stage +FROM alpine:3.20 AS release +# RUN apk add --no-cache --update bash less tree file vim +COPY --from=builder /usr/local /usr/local +COPY --from=builder /tmp/fakeroot/ / + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["/bin/ffmpeg"] diff --git a/templates/Dockerfile-template.ubuntu2204 b/templates/Dockerfile-template.ubuntu2204 deleted file mode 100644 index a1d5ddb9a..000000000 --- a/templates/Dockerfile-template.ubuntu2204 +++ /dev/null @@ -1,71 +0,0 @@ -# ffmpeg - http://ffmpeg.org/download.html -# -# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# -FROM ubuntu:20.04 AS base - -WORKDIR /tmp/workdir - -RUN apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 && \ - apt-get autoremove -y && \ - apt-get clean -y - -FROM base as build - -ENV %%ENV%% - -ARG DEBIAN_FRONTEND=noninteractive - -RUN buildDeps="autoconf \ - automake \ - cmake \ - curl \ - bzip2 \ - libexpat1-dev \ - g++ \ - gcc \ - git \ - gperf \ - libtool \ - make \ - meson \ - nasm \ - perl \ - pkg-config \ - python \ - libssl-dev \ - yasm \ - zlib1g-dev" && \ - apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ${buildDeps} -%%RUN%% -## cleanup -RUN \ - ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - -FROM base AS release -LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ - org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -COPY --from=build /usr/local /usr/local/ - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output diff --git a/templates/Dockerfile-template.ubuntu2404 b/templates/Dockerfile-template.ubuntu2404 new file mode 100644 index 000000000..4a7665cdb --- /dev/null +++ b/templates/Dockerfile-template.ubuntu2404 @@ -0,0 +1,81 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# +# Stage 1: Build +FROM ubuntu:24.04 AS builder + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + + +%%ENV%% + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +RUN buildDeps="autoconf \ + automake \ + cmake \ + build-essential \ + texinfo \ + curl \ + wget \ + tar \ + bzip2 \ + libexpat1-dev \ + gcc \ + git \ + git-core \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + perl \ + pkg-config \ + python3 \ + yasm \ + zlib1g-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libsdl2-dev \ + libva-dev \ + libvdpau-dev \ + libnuma-dev \ + libdav1d-dev \ + openssl \ + libssl-dev \ + expat \ + libgomp1" && \ + apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ${buildDeps} + +%%RUN%% + + +# Stage 2: Final Image ( shrink the size back down ) +FROM ubuntu:24.04 AS runtime +COPY --from=builder /usr/local /usr/local/ + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["ffmpeg"] diff --git a/templates/Dockerfile-template.ubuntu2404-edge b/templates/Dockerfile-template.ubuntu2404-edge new file mode 100644 index 000000000..9637c6b60 --- /dev/null +++ b/templates/Dockerfile-template.ubuntu2404-edge @@ -0,0 +1,83 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# +# Stage 1: Build +FROM ubuntu:24.04 AS builder + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + + +%%ENV%% + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + + +RUN buildDeps="autoconf \ + automake \ + cmake \ + build-essential \ + texinfo \ + curl \ + wget \ + tar \ + bzip2 \ + libexpat1-dev \ + gcc \ + git \ + git-core \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + perl \ + pkg-config \ + python3 \ + yasm \ + zlib1g-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libsdl2-dev \ + libva-dev \ + libvdpau-dev \ + libnuma-dev \ + libdav1d-dev \ + openssl \ + libssl-dev \ + expat \ + libgomp1" && \ + apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ${buildDeps} + +%%RUN%% + + +# Stage 2: Final Image ( shrink the size back down ) +FROM ubuntu:24.04 AS runtime + +COPY --from=builder /usr/local /usr/local/ + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["ffmpeg"] diff --git a/templates/Dockerfile-template.vaapi2204 b/templates/Dockerfile-template.vaapi2204 deleted file mode 100644 index 22a5f817f..000000000 --- a/templates/Dockerfile-template.vaapi2204 +++ /dev/null @@ -1,76 +0,0 @@ -# ffmpeg - http://ffmpeg.org/download.html -# -# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu -# -# https://hub.docker.com/r/jrottenberg/ffmpeg/ -# -# -FROM ubuntu:22.04 AS base - -WORKDIR /tmp/workdir - -RUN apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 && \ - apt-get autoremove -y && \ - apt-get clean -y - -FROM base as build - -ENV %%ENV%% - -ARG DEBIAN_FRONTEND=noninteractive - -RUN buildDeps="autoconf \ - automake \ - cmake \ - curl \ - bzip2 \ - libexpat1-dev \ - g++ \ - gcc \ - git \ - gperf \ - libtool \ - make \ - meson \ - nasm \ - perl \ - pkg-config \ - libssl-dev \ - yasm \ - libva-dev \ - zlib1g-dev" && \ - apt-get -yqq update && \ - apt-get install -yq --no-install-recommends ${buildDeps} -%%RUN%% -## cleanup -RUN \ - ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - for lib in /usr/local/lib/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ - cp ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - -FROM base AS release -LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ - org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -CMD ["--help"] -ENTRYPOINT ["ffmpeg"] - -COPY --from=build /usr/local /usr/local/ - -RUN \ - apt-get update -y && \ - apt-get install -y --no-install-recommends libva-drm2 libva2 i965-va-driver && \ - rm -rf /var/lib/apt/lists/* - -# Let's make sure the app built correctly -# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output diff --git a/templates/Dockerfile-template.vaapi2404 b/templates/Dockerfile-template.vaapi2404 new file mode 100644 index 000000000..68cb93e8b --- /dev/null +++ b/templates/Dockerfile-template.vaapi2404 @@ -0,0 +1,82 @@ +# ffmpeg - http://ffmpeg.org/download.html +# +# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu +# +# https://hub.docker.com/r/jrottenberg/ffmpeg/ +# +# +# Stage 1: Build +FROM ubuntu:24.04 AS builder + +WORKDIR /tmp/workdir + +COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir +COPY download_tarballs.sh /tmp/workdir +COPY build_source.sh /tmp/workdir +COPY install_ffmpeg.sh /tmp/workdir + + +%%ENV%% + +ARG DEBIAN_FRONTEND=noninteractive + +# Before autoremove and clean: Image was 217.01MB +RUN apt-get -yqq update && \ + apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim && \ + chmod +x /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py && \ + chmod +x /tmp/workdir/download_tarballs.sh && \ + chmod +x /tmp/workdir/build_source.sh && \ + chmod +x /tmp/workdir/install_ffmpeg.sh + +RUN buildDeps="autoconf \ + automake \ + cmake \ + build-essential \ + texinfo \ + curl \ + wget \ + tar \ + bzip2 \ + libexpat1-dev \ + gcc \ + git \ + git-core \ + gperf \ + libtool \ + make \ + meson \ + ninja-build \ + nasm \ + perl \ + pkg-config \ + python3 \ + yasm \ + zlib1g-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libsdl2-dev \ + libva-dev \ + libvdpau-dev \ + libnuma-dev \ + libdav1d-dev \ + openssl \ + libssl-dev \ + expat \ + libgomp1" && \ + apt-get -yqq update && \ + apt-get install -yq --no-install-recommends ${buildDeps} + +%%RUN%% + + +# Stage 2: Final Image ( shrink the size back down ) +FROM ubuntu:24.04 +COPY --from=builder /usr/local /usr/local/ + +LABEL org.opencontainers.image.authors="julien@rottenberg.info" \ + org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +CMD ["--help"] +ENTRYPOINT ["ffmpeg"] diff --git a/update.py b/update.py index f36152f90..33afd9bc3 100755 --- a/update.py +++ b/update.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 - +import datetime import json import os import shutil @@ -8,36 +8,57 @@ FFMPEG_RELEASES = "https://endoflife.date/api/ffmpeg.json" -with open("templates/Dockerfile-env", "r") as tmpfile: - ENV_CONTENT = tmpfile.read() -with open("templates/Dockerfile-run", "r") as tmpfile: - RUN_CONTENT = tmpfile.read() - DIR_FORMAT_STR = "docker-images/{0}/{1}" IMAGE_FORMAT_STR = "{0}/Dockerfile".format(DIR_FORMAT_STR) TEMPLATE_STR = "templates/Dockerfile-template.{0}" # https://ffmpeg.org/olddownload.html # https://endoflife.date/ffmpeg - -with request.urlopen(FFMPEG_RELEASES) as conn: - ffmpeg_releases = conn.read().decode("utf-8") -keep_version = [] - -for v in json.loads(ffmpeg_releases): - if not v["eol"]: - if "0.0" in v["latest"]: - v["latest"] = v["latest"].replace("0.0", "0") - keep_version.append(v["latest"]) - - +# We use the endoflife.date API to find the most recent ffmpeg versions. However, +# to simplify image maintenance, we only consider versions released within the +# last YEARS years (currently set to 3). Including very older versions compatibility +# issues with different libraries and operating system versions. By focusing on +# recent versions, we keep things manageable. +# Note: the older builds will be preserved in the the docker hub registry. +RELEASED_YEARS_AGO = 3 + + +def is_too_old(date_str, years): + date_obj = datetime.datetime.strptime(date_str, "%Y-%m-%d") + diff = datetime.datetime.now() - date_obj + # Check if the difference is more than x years + return diff.days > (years * 365) + + +def get_eol_versions(): + keep_version = [] + with request.urlopen(FFMPEG_RELEASES) as conn: + ffmpeg_releases = conn.read().decode("utf-8") + + for v in json.loads(ffmpeg_releases): + if not v["eol"]: + if "0.0" in v["latest"]: + v["latest"] = v["latest"].replace("0.0", "0") + release_date = v["releaseDate"] + if not is_too_old(release_date, years=RELEASED_YEARS_AGO): + keep_version.append(v["latest"]) + return keep_version + + +keep_version = get_eol_versions() +print("The following versions of ffmpeg is still supported:") +for version in keep_version: + print(version) VARIANTS = [ - {"name": "ubuntu2204", "parent": "ubuntu"}, - {"name": "alpine313", "parent": "alpine"}, - {"name": "scratch313", "parent": "scratch"}, - {"name": "vaapi2204", "parent": "vaapi"}, - {"name": "nvidia2204", "parent": "nvidia"}, + {"name": "ubuntu2404", "parent": "ubuntu"}, + {"name": "ubuntu2404-edge", "parent": "ubuntu-edge"}, + {"name": "alpine320", "parent": "alpine"}, + {"name": "scratch320", "parent": "scratch"}, + # Video Acceleration API (VAAPI) https://trac.ffmpeg.org/wiki/HWAccelIntro#VAAPI + {"name": "vaapi2404", "parent": "vaapi"}, + {"name": "nvidia2404", "parent": "nvidia"}, ] +current_variant_names = [v["name"] for v in VARIANTS] all_parents = sorted(set([sub["parent"] for sub in VARIANTS])) @@ -47,14 +68,23 @@ for parent in all_parents: gitlabci.append(f" - {parent}\n") - +# Note: Skip variants and the is_too_old(), work together to allow us to skip things +# Skip variants allow us to skip some variants for specific versions +# is_too_old() check allow us to skip versions that are too old SKIP_VARIANTS = { - "2.8": ["alpine313", "nvidia2004", "vaapi2004", "scratch313"], - "4.2": ["alpine313"], - "4.3": ["alpine313", "scratch313"], - "5.1": ["scratch313"], - "6.0": ["alpine313", "nvidia2004"], - "6.1": ["alpine313", "nvidia2004", "scratch313"], + "2.8": ["nvidia2204", "vaapi2204"] + [v["name"] for v in VARIANTS], + "3.4": ["alpine313", "nvidia2204", "scratch313", "vaapi2204"] + + [v["name"] for v in VARIANTS], + "4.2": ["alpine313", "ubuntu2404"] + [v["name"] for v in VARIANTS], + "4.3": ["nvidia2204", "vaapi2204"] + [v["name"] for v in VARIANTS], + "4.4": ["alpine313", "nvidia2204", "scratch313"] + [v["name"] for v in VARIANTS], + "5.1": [v["name"] for v in VARIANTS], + "6.1": [ + "nvidia2404", + "scratch320", + ], # failing from long build times ( over an hour ) + "7.0": [], + "7.1": [], } @@ -74,10 +104,29 @@ def get_major_version(version): return f"{major}" +def read_ffmpeg_template(variant_name, env_or_run="env"): + """Read the ffmpeg template file and return the content""" + if variant_name == "scratch": + distro_name = "alpine-scratch" + elif variant_name == "alpine": + distro_name = "alpine" + elif variant_name == "ubuntu-edge": + distro_name = "ubuntu-edge" + elif variant_name == "nvidia": + distro_name = "nvidia" + elif variant_name == "vaapi": + distro_name = "vaapi" + else: + distro_name = "ubuntu" + + with open(f"templates/Dockerfile-{env_or_run}-{distro_name}", "r") as tmpfile: + return tmpfile.read() + + print("Preparing docker images for ffmpeg versions: ") + for version in keep_version: - print(version) skip_variants = None for k, v in SKIP_VARIANTS.items(): if version.startswith(k): @@ -85,15 +134,25 @@ def get_major_version(version): compatible_variants = [ v for v in VARIANTS if skip_variants is None or v["name"] not in skip_variants ] + short_version = get_shorten_version(version) major_version = get_major_version(version) ver_path = os.path.join("docker-images", short_version) os.makedirs(ver_path, exist_ok=True) for existing_variant in os.listdir(ver_path): if existing_variant not in compatible_variants: - shutil.rmtree(DIR_FORMAT_STR.format(short_version, existing_variant)) + shutil.rmtree( + DIR_FORMAT_STR.format(short_version, existing_variant), + ignore_errors=True, + ) + print(f"Preparing Dockerfile for ffmpeg-{version}") for variant in compatible_variants: + print(f"{' '*25}{version}-{variant['name']}") + + ENV_CONTENT = read_ffmpeg_template(variant["parent"], "env") + RUN_CONTENT = read_ffmpeg_template(variant["parent"], "run") + siblings = [ v["name"] for v in compatible_variants if v["parent"] == variant["parent"] ] @@ -125,6 +184,10 @@ def get_major_version(version): ISPARENT: {is_parent} """ ) + # with open( + # TEMPLATE_STR.format(variant["name"].replace("-edge", "")), "r" + # ) as tmpfile: + # template = tmpfile.read() with open(TEMPLATE_STR.format(variant["name"]), "r") as tmpfile: template = tmpfile.read() @@ -132,11 +195,12 @@ def get_major_version(version): "--disable-debug", "--disable-doc", "--disable-ffplay", - "--enable-fontconfig", + "--enable-shared", + "--extra-libs=-ldl", "--enable-gpl", + "--enable-fontconfig", "--enable-libass", "--enable-libbluray", - "--enable-libfdk_aac", "--enable-libfreetype", "--enable-libmp3lame", "--enable-libopencore-amrnb", @@ -155,10 +219,8 @@ def get_major_version(version): "--enable-nonfree", "--enable-openssl", "--enable-postproc", - "--enable-shared", "--enable-small", "--enable-version3", - "--extra-libs=-ldl", '--prefix="${PREFIX}"', ] CFLAGS = [ @@ -209,6 +271,44 @@ def get_major_version(version): FFMPEG_CONFIG_FLAGS.append("--enable-cuda") FFMPEG_CONFIG_FLAGS.append("--enable-cuvid") FFMPEG_CONFIG_FLAGS.append("--enable-libnpp") + FFMPEG_CONFIG_FLAGS.append("--enable-libharfbuzz") + + if float(version[0:3]) >= 5.1: + # from https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#FFmpeg + FFMPEG_CONFIG_FLAGS.append("--extra-libs=-lm") # add math library + FFMPEG_CONFIG_FLAGS.append("--ld=g++") # use g++ as linker + + # DELETE NEXT 5 LINES when everything works + # --extra-cflags="-I/usr/local/include -I/usr/lib/include" \ + # --extra-cxxflags="-I/usr/local/include -I/usr/lib/include" \ + # --extra-ldflags="-L/usr/local/lib" \ + # --extra-ldflags="-L/usr/local/lib64 -L/usr/lib -L/usr/lib64" \ + # FFMPEG_CONFIG_FLAGS.append("--extra-ldflags=-L/usr/local/lib \ + # -L/usr/local/lib64 -L/usr/lib -L/usr/lib64") + + # Some shenagians to get libvmaf to build with static linking + FFMPEG_CONFIG_FLAGS.append( + "--extra-ldflags=-L/opt/ffmpeg/lib/x86_64-linux-gnu" + ) + + # --ld=g++ or --ld=clang++ when configuring ffmpeg + # FFMPEG_CONFIG_FLAGS.append("--pkg-config-flags='--static'") + # FFMPEG_CONFIG_FLAGS.append("--enable-static") + # FFMPEG_CONFIG_FLAGS.append("--enable-gnutls") + FFMPEG_CONFIG_FLAGS.append("--enable-libfdk-aac") + FFMPEG_CONFIG_FLAGS.append("--enable-libsvtav1") + FFMPEG_CONFIG_FLAGS.append("--enable-libdav1d") + else: # for older versions + FFMPEG_CONFIG_FLAGS.append( + "--enable-libfdk_aac" + ) # this was likely misstyped before + + # if "ubuntu" in variant["parent"] and float(version[0:3]) >= 5.1: + if float(version[0:3]) >= 5.1: + CFLAGS.append("-I/usr/include/x86_64-linux-gnu") + LDFLAGS.append("-L/usr/lib/x86_64-linux-gnu") + LDFLAGS.append("-L/usr/lib") # for alpine ( but probably fine for all) + cflags = '--extra-cflags="{0}"'.format(" ".join(CFLAGS)) ldflags = '--extra-ldflags="{0}"'.format(" ".join(LDFLAGS)) FFMPEG_CONFIG_FLAGS.append(cflags) @@ -216,21 +316,38 @@ def get_major_version(version): FFMPEG_CONFIG_FLAGS.sort() COMBINED_CONFIG_FLAGS = " \\\n ".join(FFMPEG_CONFIG_FLAGS) - - run_content = RUN_CONTENT.replace( + # run content needs two replace statements + run_content_flags = RUN_CONTENT.replace( "%%FFMPEG_CONFIG_FLAGS%%", COMBINED_CONFIG_FLAGS ) + run_content = run_content_flags.replace("%%FFMPEG_VERSION%%", version[0:3]) + env_content = ENV_CONTENT.replace("%%FFMPEG_VERSION%%", version) docker_content = template.replace("%%ENV%%", env_content) docker_content = docker_content.replace("%%RUN%%", run_content) - d = os.path.dirname(dockerfile) - if not os.path.exists(d): - os.makedirs(d) + ddir = os.path.dirname(dockerfile) + if not os.path.exists(ddir): + os.makedirs(ddir) with open(dockerfile, "w") as dfile: dfile.write(docker_content) + # These 4 files are used this for everything as even the packaged + # builds require building ffmpeg. + shutil.copy("generate-source-of-truth-ffmpeg-versions.py", ddir) + shutil.copy("download_tarballs.sh", ddir) + shutil.copy("install_ffmpeg.sh", ddir) + # for build_source.sh, we are not going to just copy the file, we are going + # to replace the FFMPEG_CONFIG_FLAGS + with open("build_source.sh", "r") as tmpfile: + template = tmpfile.read() + build_source_content = template.replace( + "%%FFMPEG_CONFIG_FLAGS%%", COMBINED_CONFIG_FLAGS + ) + with open(f"{ddir}/build_source.sh", "w") as buildfile: + buildfile.write(build_source_content) + with open("docker-images/gitlab-ci.yml", "w") as gitlabcifile: gitlabcifile.write("".join(gitlabci))