├── .gitignore ├── .github ├── dependabot.yml └── workflows │ ├── vainfo.yml │ ├── ffmpeg-macos.yml │ ├── ffmpeg-linux.yml │ ├── ffmpeg-windows.yml │ └── ffmpeg-release.yml ├── scripts ├── common │ ├── versions.sh │ ├── build-tools.sh │ └── helpers.sh ├── macos │ ├── base.sh │ └── build.sh ├── linux │ ├── base.sh │ └── build.sh └── windows │ ├── base.sh │ └── build.sh ├── nonfree.Dockerfile ├── Dockerfile ├── CLAUDE.md ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.exe -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | -------------------------------------------------------------------------------- /scripts/common/versions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | 4 | # 5 | # Centralized Version Definitions 6 | # 7 | # このファイルは将来的にバージョンを集約管理するために使用されます 8 | # 現在は各build-library.shで個別に定義されています 9 | -------------------------------------------------------------------------------- /.github/workflows/vainfo.yml: -------------------------------------------------------------------------------- 1 | name: vainfo 2 | 3 | on: 4 | workflow_dispatch: 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | if: github.ref == 'refs/heads/main' && startsWith(github.ref, 'refs/tags/') == false 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@v6 12 | 13 | - name: Set up Docker Buildx 14 | uses: docker/setup-buildx-action@v3 15 | 16 | - name: Login to DockerHub 17 | uses: docker/login-action@v3 18 | with: 19 | username: akashisn 20 | password: ${{ secrets.DOCKERHUB_TOKEN }} 21 | 22 | - name: Build vainfo 23 | uses: docker/build-push-action@v6 24 | with: 25 | context: ./ 26 | file: ./Dockerfile 27 | tags: | 28 | akashisn/vainfo 29 | platforms: linux/amd64 30 | target: vainfo 31 | push: true 32 | -------------------------------------------------------------------------------- /scripts/common/build-tools.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | 4 | # 5 | # Build Tool Wrappers 6 | # 7 | 8 | do_configure () { 9 | local configure_options="${1:-""}" 10 | local configure_name="${2:-"./configure"}" 11 | 12 | if [[ ! -f "${configure_name}" ]]; then 13 | autoreconf -fiv 14 | fi 15 | 16 | "${configure_name}" --prefix="${PREFIX}" --host="${BUILD_TARGET}" ${configure_options} 1>&2 17 | } 18 | 19 | do_make_and_make_install () { 20 | local overwrite_cpu_num="${1:-${CPU_NUM}}" 21 | local extra_make_options="${2:-""}" 22 | local extra_install_options="${3:-""}" 23 | make -j ${overwrite_cpu_num} ${extra_make_options} 24 | make install ${extra_install_options} 25 | } 26 | 27 | do_cmake () { 28 | local extra_args="${1:-""}" 29 | local build_from_dir="${2:-"."}" 30 | cmake -G"Unix Makefiles" "${build_from_dir}" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ 31 | -DCMAKE_INSTALL_BINDIR=bin -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_INCLUDEDIR=include \ 32 | -DCMAKE_TOOLCHAIN_FILE="${WORKDIR}/toolchains.cmake" $extra_args 1>&2 33 | } 34 | 35 | do_meson () { 36 | local extra_args="${1:-""}" 37 | local build_from_dir="${2:-"."}" 38 | meson --buildtype=release --prefix="${PREFIX}" --bindir=bin --libdir=lib $build_from_dir $extra_args 1>&2 39 | } 40 | 41 | do_ninja_and_ninja_install () { 42 | ninja 43 | ninja install 44 | } 45 | -------------------------------------------------------------------------------- /.github/workflows/ffmpeg-macos.yml: -------------------------------------------------------------------------------- 1 | name: ffmpeg-macos 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | tags: 7 | - v* 8 | 9 | jobs: 10 | build-macos: 11 | runs-on: macos-26 12 | if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') 13 | timeout-minutes: 120 14 | strategy: 15 | matrix: 16 | ffmpeg: ["8.0"] 17 | 18 | steps: 19 | - name: Checkout 20 | uses: actions/checkout@v4 21 | 22 | - name: Create /opt/ffmpeg 23 | run: | 24 | sudo mkdir -p /opt/ffmpeg 25 | sudo chown runner /opt/ffmpeg 26 | 27 | - name: Build FFmpeg with libraries 28 | run: FFMPEG_VERSION=${{ matrix.ffmpeg }} ./scripts/macos/build.sh 29 | 30 | - name: Verify build 31 | run: | 32 | /tmp/dist/opt/ffmpeg/bin/ffmpeg -version 33 | /tmp/dist/opt/ffmpeg/bin/ffprobe -version 34 | 35 | - name: Archive artifact 36 | run: | 37 | mkdir -p /tmp/ffmpeg-${{ matrix.ffmpeg }}-macos-arm64 38 | cp -R /tmp/dist/opt/ffmpeg/* /tmp/ffmpeg-${{ matrix.ffmpeg }}-macos-arm64/ 39 | tar acvf /tmp/ffmpeg-${{ matrix.ffmpeg }}-macos-arm64.tar.xz -C /tmp ffmpeg-${{ matrix.ffmpeg }}-macos-arm64 40 | 41 | - name: Upload artifact 42 | uses: actions/upload-artifact@v6 43 | with: 44 | name: ffmpeg-${{ matrix.ffmpeg }}-macos-arm64 45 | path: /tmp/ffmpeg-${{ matrix.ffmpeg }}-macos-arm64.tar.xz 46 | -------------------------------------------------------------------------------- /.github/workflows/ffmpeg-linux.yml: -------------------------------------------------------------------------------- 1 | name: ffmpeg-linux 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | tags: 7 | - v* 8 | 9 | jobs: 10 | build-linux: 11 | runs-on: ubuntu-latest 12 | if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') 13 | strategy: 14 | matrix: 15 | ffmpeg: ["8.0"] 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v6 19 | 20 | - name: Set up Docker Buildx 21 | uses: docker/setup-buildx-action@v3 22 | 23 | - name: Login to DockerHub 24 | uses: docker/login-action@v3 25 | with: 26 | username: akashisn 27 | password: ${{ secrets.DOCKERHUB_TOKEN }} 28 | 29 | - name: Build and push - ffmpeg-linux 30 | uses: docker/build-push-action@v6 31 | with: 32 | context: ./ 33 | file: ./Dockerfile 34 | tags: | 35 | akashisn/ffmpeg:${{ matrix.ffmpeg }} 36 | build-args: | 37 | FFMPEG_VERSION=${{ matrix.ffmpeg }} 38 | platforms: linux/amd64 39 | target: ffmpeg-linux 40 | cache-from: type=gha 41 | cache-to: type=gha,mode=max 42 | push: true 43 | 44 | - name: Export - ffmpeg-linux 45 | run: | 46 | docker buildx build --platform linux/amd64 --target ffmpeg-linux-export --output type=local,dest=/tmp/build \ 47 | -t ffmpeg-linux-export --build-arg FFMPEG_VERSION=${{ matrix.ffmpeg }} -f ./Dockerfile . 48 | 49 | - name: Archive artifact 50 | run: | 51 | mkdir /tmp/ffmpeg-${{ matrix.ffmpeg }}-linux-amd64 52 | mv /tmp/build/* /tmp/ffmpeg-${{ matrix.ffmpeg }}-linux-amd64/ 53 | tar acvf /tmp/ffmpeg-${{ matrix.ffmpeg }}-linux-amd64.tar.xz -C /tmp ffmpeg-${{ matrix.ffmpeg }}-linux-amd64 54 | 55 | - name: Upload artifact 56 | uses: actions/upload-artifact@v6 57 | with: 58 | name: ffmpeg-${{ matrix.ffmpeg }}-linux-amd64 59 | path: /tmp/ffmpeg-${{ matrix.ffmpeg }}-linux-amd64.tar.xz 60 | -------------------------------------------------------------------------------- /.github/workflows/ffmpeg-windows.yml: -------------------------------------------------------------------------------- 1 | name: ffmpeg-windows 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | tags: 7 | - v* 8 | 9 | jobs: 10 | build-windows: 11 | runs-on: ubuntu-latest 12 | if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') 13 | strategy: 14 | matrix: 15 | ffmpeg: ["8.0"] 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v6 19 | 20 | - name: Set up Docker Buildx 21 | uses: docker/setup-buildx-action@v3 22 | 23 | - name: Login to GHCR 24 | uses: docker/login-action@v3 25 | with: 26 | registry: ghcr.io 27 | username: akashisn 28 | password: ${{ github.token }} 29 | 30 | - name: Build and push - ffmpeg-windows 31 | uses: docker/build-push-action@v6 32 | with: 33 | context: ./ 34 | file: ./Dockerfile 35 | tags: | 36 | ghcr.io/akashisn/ffmpeg-windows:${{ matrix.ffmpeg }} 37 | build-args: | 38 | FFMPEG_VERSION=${{ matrix.ffmpeg }} 39 | platforms: linux/amd64 40 | target: ffmpeg-windows 41 | cache-from: type=gha 42 | cache-to: type=gha,mode=max 43 | push: true 44 | 45 | - name: Export - ffmpeg-windows 46 | run: | 47 | docker buildx build --platform linux/amd64 --target ffmpeg-windows-export --output type=local,dest=/tmp/build \ 48 | -t ffmpeg-windows-export --build-arg FFMPEG_VERSION=${{ matrix.ffmpeg }} -f ./Dockerfile . 49 | 50 | - name: Archive artifact 51 | run: | 52 | mkdir /tmp/ffmpeg-${{ matrix.ffmpeg }}-windows-x64 53 | mv /tmp/build/* /tmp/ffmpeg-${{ matrix.ffmpeg }}-windows-x64/ 54 | tar acvf /tmp/ffmpeg-${{ matrix.ffmpeg }}-windows-x64.tar.xz -C /tmp ffmpeg-${{ matrix.ffmpeg }}-windows-x64 55 | 56 | - name: Upload artifact 57 | uses: actions/upload-artifact@v6 58 | with: 59 | name: ffmpeg-${{ matrix.ffmpeg }}-windows-x64 60 | path: /tmp/ffmpeg-${{ matrix.ffmpeg }}-windows-x64.tar.xz 61 | -------------------------------------------------------------------------------- /scripts/macos/base.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | 4 | # 5 | # macOS-specific environment setup 6 | # 7 | 8 | # Source common scripts 9 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 10 | source "${SCRIPT_DIR}/../common/helpers.sh" 11 | source "${SCRIPT_DIR}/../common/build-tools.sh" 12 | source "${SCRIPT_DIR}/../common/versions.sh" 13 | 14 | TARGET_OS="Darwin" 15 | HOST_OS="macos" 16 | BUILD_TARGET= 17 | CROSS_PREFIX= 18 | 19 | # 20 | # Environment Variables 21 | # 22 | 23 | WORKDIR="${WORKDIR:-$(mktemp -d)}" 24 | PREFIX="${PREFIX:-"/opt/ffmpeg"}" 25 | ARTIFACT_DIR="${ARTIFACT_DIR:-"/tmp/dist"}" 26 | RUNTIME_LIB_DIR="${RUNTIME_LIB_DIR:-"$ARTIFACT_DIR/runtime"}" 27 | 28 | export CC="clang" 29 | export CXX="clang++" 30 | export PKG_CONFIG="pkg-config" 31 | export LD_LIBRARY_PATH="${PREFIX}/lib" 32 | export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig" 33 | export MANPATH="${PREFIX}/share/man" 34 | export INFOPATH="${PREFIX}/share/info" 35 | export ACLOCAL_PATH="${PREFIX}/share/aclocal" 36 | export LIBRARY_PATH="${PREFIX}/lib" 37 | export C_INCLUDE_PATH="${PREFIX}/include" 38 | export CPLUS_INCLUDE_PATH="${PREFIX}/include" 39 | export PATH="${PREFIX}/bin:$PATH" 40 | 41 | # Detect architecture 42 | if [[ "$(uname -m)" == "arm64" ]]; then 43 | HOST_ARCH="arm64" 44 | else 45 | HOST_ARCH="x86_64" 46 | fi 47 | 48 | rm -rf ${ARTIFACT_DIR} 49 | rm -rf ${PREFIX}/{bin,include,lib,share} 50 | rm -rf ${PREFIX}/{configure_options,ffmpeg_configure_options,ffmpeg_extra_libs} 51 | 52 | mkdir -p ${ARTIFACT_DIR} 53 | mkdir -p ${WORKDIR} 54 | mkdir -p ${RUNTIME_LIB_DIR} 55 | mkdir -p ${PREFIX}/{bin,share,lib/pkgconfig,include} 56 | 57 | FFMPEG_CONFIGURE_OPTIONS=() 58 | FFMPEG_EXTRA_LIBS=() 59 | 60 | # 61 | # CPU configuration 62 | # 63 | 64 | CPU_NUM=$(expr $(getconf _NPROCESSORS_ONLN) / 2) 65 | 66 | # 67 | # Build Tools config 68 | # 69 | 70 | # Cmake build toolchain 71 | cat << EOS > ${WORKDIR}/toolchains.cmake 72 | SET(CMAKE_POLICY_VERSION_MINIMUM 3.5) 73 | SET(CMAKE_SYSTEM_NAME ${TARGET_OS}) 74 | SET(CMAKE_PREFIX_PATH ${PREFIX}) 75 | SET(CMAKE_INSTALL_PREFIX ${PREFIX}) 76 | SET(CMAKE_C_COMPILER ${CROSS_PREFIX}${CC}) 77 | SET(CMAKE_CXX_COMPILER ${CROSS_PREFIX}${CXX}) 78 | SET(CMAKE_AR ${CROSS_PREFIX}ar) 79 | SET(CMAKE_RANLIB ${CROSS_PREFIX}ranlib) 80 | EOS 81 | -------------------------------------------------------------------------------- /scripts/linux/base.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | 4 | # 5 | # Linux-specific environment setup 6 | # 7 | 8 | # Source common scripts 9 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 10 | source "${SCRIPT_DIR}/../common/helpers.sh" 11 | source "${SCRIPT_DIR}/../common/build-tools.sh" 12 | source "${SCRIPT_DIR}/../common/versions.sh" 13 | 14 | TARGET_OS="Linux" 15 | HOST_OS="linux" 16 | HOST_ARCH=$(uname -m) 17 | BUILD_TARGET= 18 | CROSS_PREFIX= 19 | 20 | # 21 | # Environment Variables 22 | # 23 | 24 | WORKDIR="${WORKDIR:-$(mktemp -d)}" 25 | PREFIX="${PREFIX:-"/usr/local"}" 26 | ARTIFACT_DIR="${ARTIFACT_DIR:-"/tmp/dist"}" 27 | RUNTIME_LIB_DIR="${RUNTIME_LIB_DIR:-"$ARTIFACT_DIR/runtime"}" 28 | 29 | export PKG_CONFIG="pkg-config" 30 | export LD_LIBRARY_PATH="${PREFIX}/lib" 31 | export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig" 32 | export MANPATH="${PREFIX}/share/man" 33 | export INFOPATH="${PREFIX}/share/info" 34 | export ACLOCAL_PATH="${PREFIX}/share/aclocal" 35 | export LIBRARY_PATH="${PREFIX}/lib" 36 | export C_INCLUDE_PATH="${PREFIX}/include" 37 | export CPLUS_INCLUDE_PATH="${PREFIX}/include" 38 | export CFLAGS="-static-libgcc -static-libstdc++ -I${PREFIX}/include -O2 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fPIC -DPIC -fstack-clash-protection -pthread ${CFLAGS:-""}" 39 | export CXXFLAGS="${CFLAGS}" 40 | export LDFLAGS="-static-libgcc -static-libstdc++ -L${PREFIX}/lib -O2 -pipe -fstack-protector-strong -fstack-clash-protection -Wl,-z,relro,-z,now -pthread -lm ${LDFLAGS:-""}" 41 | export STAGE_CFLAGS="-fno-semantic-interposition -fvisibility=hidden" 42 | export STAGE_CXXFLAGS="${STAGE_CFLAGS}" 43 | export PATH="${PREFIX}/bin:$PATH" 44 | 45 | mkdir -p ${WORKDIR} ${PREFIX}/{bin,share,lib/pkgconfig,include} 46 | 47 | FFMPEG_CONFIGURE_OPTIONS=() 48 | FFMPEG_EXTRA_LIBS=("-lm" "-lpthread" "-lstdc++") 49 | 50 | # 51 | # CPU configuration 52 | # 53 | 54 | CPU_NUM=$(expr $(nproc) / 2) 55 | 56 | # 57 | # Build Tools config 58 | # 59 | 60 | # Cmake build toolchain 61 | cat << EOS > ${WORKDIR}/toolchains.cmake 62 | SET(CMAKE_SYSTEM_NAME ${TARGET_OS}) 63 | SET(CMAKE_PREFIX_PATH ${PREFIX}) 64 | SET(CMAKE_INSTALL_PREFIX ${PREFIX}) 65 | SET(CMAKE_C_COMPILER ${CROSS_PREFIX}gcc) 66 | SET(CMAKE_CXX_COMPILER ${CROSS_PREFIX}g++) 67 | SET(CMAKE_AR ${CROSS_PREFIX}ar) 68 | SET(CMAKE_RANLIB ${CROSS_PREFIX}ranlib) 69 | EOS 70 | -------------------------------------------------------------------------------- /scripts/windows/base.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | 4 | # 5 | # Windows-specific environment setup (cross-compilation) 6 | # 7 | 8 | # Source common scripts 9 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 10 | source "${SCRIPT_DIR}/../common/helpers.sh" 11 | source "${SCRIPT_DIR}/../common/build-tools.sh" 12 | source "${SCRIPT_DIR}/../common/versions.sh" 13 | 14 | TARGET_OS="Windows" 15 | HOST_OS="linux" 16 | HOST_ARCH=$(uname -m) 17 | BUILD_TARGET="x86_64-w64-mingw32" 18 | CROSS_PREFIX="${BUILD_TARGET}-" 19 | 20 | # 21 | # Environment Variables 22 | # 23 | 24 | WORKDIR="${WORKDIR:-$(mktemp -d)}" 25 | PREFIX="${PREFIX:-"/usr/local"}" 26 | ARTIFACT_DIR="${ARTIFACT_DIR:-"/tmp/dist"}" 27 | RUNTIME_LIB_DIR="${RUNTIME_LIB_DIR:-"$ARTIFACT_DIR/runtime"}" 28 | 29 | export PKG_CONFIG="pkg-config" 30 | export LD_LIBRARY_PATH="${PREFIX}/lib" 31 | export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig" 32 | export MANPATH="${PREFIX}/share/man" 33 | export INFOPATH="${PREFIX}/share/info" 34 | export ACLOCAL_PATH="${PREFIX}/share/aclocal" 35 | export LIBRARY_PATH="${PREFIX}/lib" 36 | export C_INCLUDE_PATH="${PREFIX}/include" 37 | export CPLUS_INCLUDE_PATH="${PREFIX}/include" 38 | export CFLAGS="-static-libgcc -static-libstdc++ -I${PREFIX}/include -O2 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong ${CFLAGS:-""}" 39 | export CXXFLAGS="${CFLAGS}" 40 | export LDFLAGS="-static-libgcc -static-libstdc++ -L${PREFIX}/lib -O2 -pipe -fstack-protector-strong ${LDFLAGS:-""}" 41 | export STAGE_CFLAGS="-fno-semantic-interposition" 42 | export STAGE_CXXFLAGS="${STAGE_CFLAGS}" 43 | export PATH="${PREFIX}/bin:$PATH" 44 | 45 | mkdir -p ${WORKDIR} ${PREFIX}/{bin,share,lib/pkgconfig,include} 46 | 47 | FFMPEG_CONFIGURE_OPTIONS=() 48 | FFMPEG_EXTRA_LIBS=("-lm" "-lpthread" "-lstdc++") 49 | 50 | # 51 | # CPU configuration 52 | # 53 | 54 | CPU_NUM=$(expr $(nproc) / 2) 55 | 56 | # 57 | # Build Tools config 58 | # 59 | 60 | # Cmake build toolchain 61 | cat << EOS > ${WORKDIR}/toolchains.cmake 62 | SET(CMAKE_SYSTEM_NAME ${TARGET_OS}) 63 | SET(CMAKE_PREFIX_PATH ${PREFIX}) 64 | SET(CMAKE_INSTALL_PREFIX ${PREFIX}) 65 | SET(CMAKE_C_COMPILER ${CROSS_PREFIX}gcc) 66 | SET(CMAKE_CXX_COMPILER ${CROSS_PREFIX}g++) 67 | SET(CMAKE_AR ${CROSS_PREFIX}ar) 68 | SET(CMAKE_RANLIB ${CROSS_PREFIX}ranlib) 69 | SET(CMAKE_RC_COMPILER ${CROSS_PREFIX}windres) 70 | SET(CMAKE_ASM_YASM_COMPILER yasm) 71 | EOS 72 | 73 | # Meson build toolchain 74 | cat << EOS > ${WORKDIR}/${BUILD_TARGET}.txt 75 | [binaries] 76 | c = '${CROSS_PREFIX}gcc' 77 | cpp = '${CROSS_PREFIX}g++' 78 | ar = '${CROSS_PREFIX}ar' 79 | strip = '${CROSS_PREFIX}strip' 80 | exe_wrapper = 'wine64' 81 | 82 | [host_machine] 83 | system = 'windows' 84 | cpu_family = 'x86_64' 85 | cpu = 'x86_64' 86 | endian = 'little' 87 | EOS 88 | -------------------------------------------------------------------------------- /scripts/common/helpers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | 4 | # 5 | # Helper Functions 6 | # 7 | 8 | echoerr () { 9 | echo "$@" 1>&2; 10 | } 11 | 12 | download_and_unpack_file () { 13 | cd ${WORKDIR} 14 | local url="$1" 15 | local output_name="${2:-$(basename ${url})}" 16 | local output_dir="$(echo ${output_name} | sed s/\.tar\.*//)" 17 | if [ ! -e "${output_name}" ]; then 18 | echoerr -n "downloading ${url} ..." 19 | curl -4 "${url}" --retry 50 -o "${output_name}" -L -s --fail 20 | echoerr "done." 21 | fi 22 | echoerr -n "unpacking ${output_name} into ${output_dir} ..." 23 | rm -rf "${output_dir}" 24 | mkdir -p "${output_dir}" 25 | tar -xf "${output_name}" --strip-components 1 -C "${output_dir}" 26 | echoerr "done." 27 | cd ${output_dir} 28 | } 29 | 30 | get_latest_version() { 31 | local url=$1 32 | local prefix=$2 33 | local major_version="${3:-""}" 34 | 35 | if [ -n "${major_version}" ]; then 36 | local url="${url}/${major_version}" 37 | fi 38 | 39 | local version_pattern="${prefix}\K[0-9]+(\.[0-9]+)+" 40 | 41 | local html_content=$(curl -sL "$url") 42 | 43 | local latest_version=$(echo "$html_content" | \ 44 | grep -oP $version_pattern | \ 45 | sort -V | tail -n1) 46 | 47 | echo "$latest_version" 48 | } 49 | 50 | git_clone() { 51 | cd ${WORKDIR} 52 | local repo_url="$1" 53 | local branch="${2:-"master"}" 54 | local version="${3:-""}" 55 | local package="$(basename ${repo_url} | sed s/\.git//)" 56 | if [ -n "${version}" ]; then 57 | local to_dir="${package}-${version}" 58 | else 59 | local to_dir="${package}-$(echo ${branch} | sed s/^v//)" 60 | fi 61 | 62 | if [ -d "${to_dir}/.git" ]; then 63 | # Repository already exists - clean and reset it 64 | echoerr -n "cleaning existing repository ${to_dir} ..." 65 | cd ${to_dir} 66 | git fetch origin "${branch}" --depth 1 2>/dev/null || true 67 | git checkout -f "${branch}" 2>/dev/null || git checkout -f -B "${branch}" "origin/${branch}" 68 | git reset --hard "origin/${branch}" 2>/dev/null || git reset --hard "${branch}" 69 | git clean -fdx 70 | echoerr "done." 71 | else 72 | # Clone fresh repository 73 | echoerr -n "downloading (via git clone) ${to_dir} from $repo_url ..." 74 | rm -rf "${to_dir}" 75 | git clone -c advice.detachedHead=false "${repo_url}" -b "${branch}" --depth 1 "${to_dir}" 76 | echoerr "done." 77 | cd ${to_dir} 78 | fi 79 | } 80 | 81 | get_latest_tag() { 82 | local repo_url=$1 83 | local prefix="${2:-""}" 84 | 85 | local version_pattern="^${prefix}\K[0-9]+(\.[0-9]+)+$" 86 | 87 | latest_tag=$(git ls-remote --tags "$repo_url" | awk -F/ '{print $NF}' | \ 88 | grep -oP "$version_pattern" | \ 89 | sort -V | tail -n1) 90 | 91 | echo "$latest_tag" 92 | } 93 | 94 | svn_checkout() { 95 | cd ${WORKDIR} 96 | local repo_url="$1" 97 | local to_dir="$(basename ${repo_url})" 98 | echoerr -n "svn checking out to ${to_dir} ..." 99 | svn checkout "${repo_url}" "${to_dir}" --non-interactive --trust-server-cert 100 | cd ${to_dir} 101 | echoerr "done." 102 | } 103 | 104 | mkcd () { 105 | rm -rf "$1" 106 | mkdir -p "$1" 107 | cd "$1" 108 | } 109 | 110 | cp_archive () { 111 | if [[ $HOST_OS == "macos" ]]; then 112 | # BSD cp doesn't support --archive, --parents, --no-dereference 113 | # Use rsync as alternative for --parents functionality 114 | /usr/bin/rsync -a --relative "$@" 115 | else 116 | cp --archive --parents --no-dereference $@ 117 | fi 118 | } 119 | 120 | gen_implib () { 121 | local in="$1" 122 | local out="$2" 123 | 124 | local tmpdir="$(mktemp -d)" 125 | trap "rm -rf '$tmpdir'" EXIT 126 | pushd "$tmpdir" 127 | 128 | set -x 129 | python3 /opt/implib/implib-gen.py --target x86_64-linux-gnu --dlopen --lazy-load --verbose "$in" 130 | ${CROSS_PREFIX}gcc $CFLAGS $STAGE_CFLAGS -DIMPLIB_HIDDEN_SHIMS -c *.tramp.S *.init.c 131 | ${CROSS_PREFIX}ar -rcs "$out" *.tramp.o *.init.o 132 | set +x 133 | 134 | popd 135 | } 136 | 137 | do_strip () { 138 | local target_dir="$1" 139 | local file_pattern="$2" 140 | 141 | if [[ $HOST_OS == "macos" ]]; then 142 | # BSD find doesn't support -executable, use -perm instead 143 | # -perm +111 matches files with execute permission for user, group, or other 144 | /usr/bin/find ${target_dir} -type f -name "${file_pattern}" -perm +111 -exec strip -S {} \; 145 | else 146 | find ${target_dir} -type f -name "${file_pattern}" -executable -exec strip --strip-debug {} \; 147 | fi 148 | } 149 | -------------------------------------------------------------------------------- /nonfree.Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax = docker/dockerfile:1.5 2 | 3 | ARG FFMPEG_VERSION="7.0.2" 4 | ARG TARGET_OS="linux" 5 | ARG CUDA_SDK_VERSION="12.2.0" 6 | FROM ghcr.io/akashisn/ffmpeg-library:${TARGET_OS} AS ffmpeg-library 7 | 8 | # 9 | # cuda build env base image 10 | # 11 | FROM nvidia/cuda:${CUDA_SDK_VERSION}-devel-ubuntu22.04 AS cuda-build-env 12 | 13 | SHELL ["/bin/bash", "-e", "-c"] 14 | ENV DEBIAN_FRONTEND=noninteractive 15 | ENV NVIDIA_VISIBLE_DEVICES all 16 | ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,video 17 | 18 | # Install ca-certificates 19 | RUN </dev/null || echo "") 17 | if [ -z "$TAG" ]; then 18 | echo "Error: Current commit is not tagged with a version tag" 19 | exit 1 20 | fi 21 | if [[ ! "$TAG" =~ ^v ]]; then 22 | echo "Error: Tag must start with 'v' (found: $TAG)" 23 | exit 1 24 | fi 25 | echo "tag=$TAG" >> $GITHUB_OUTPUT 26 | echo "Found version tag: $TAG" 27 | 28 | - name: Verify all platform builds succeeded 29 | env: 30 | GH_TOKEN: ${{ github.token }} 31 | run: | 32 | TAG="${{ steps.check_tag.outputs.tag }}" 33 | echo "Verifying platform builds for tag $TAG (commit ${{ github.sha }})..." 34 | 35 | # Check Linux workflow - filter by both head_sha and head_branch (tag name) 36 | LINUX_STATUS=$(gh api repos/${{ github.repository }}/actions/workflows/ffmpeg-linux.yml/runs \ 37 | --jq ".workflow_runs[] | select(.head_sha == \"${{ github.sha }}\" and .head_branch == \"$TAG\") | select(.conclusion != null) | .conclusion" | head -1) 38 | 39 | # Check Windows workflow - filter by both head_sha and head_branch (tag name) 40 | WINDOWS_STATUS=$(gh api repos/${{ github.repository }}/actions/workflows/ffmpeg-windows.yml/runs \ 41 | --jq ".workflow_runs[] | select(.head_sha == \"${{ github.sha }}\" and .head_branch == \"$TAG\") | select(.conclusion != null) | .conclusion" | head -1) 42 | 43 | # Check macOS workflow - filter by both head_sha and head_branch (tag name) 44 | MACOS_STATUS=$(gh api repos/${{ github.repository }}/actions/workflows/ffmpeg-macos.yml/runs \ 45 | --jq ".workflow_runs[] | select(.head_sha == \"${{ github.sha }}\" and .head_branch == \"$TAG\") | select(.conclusion != null) | .conclusion" | head -1) 46 | 47 | echo "Linux build status: ${LINUX_STATUS:-not found}" 48 | echo "Windows build status: ${WINDOWS_STATUS:-not found}" 49 | echo "macOS build status: ${MACOS_STATUS:-not found}" 50 | 51 | # Verify all builds succeeded 52 | if [ "$LINUX_STATUS" != "success" ] || [ "$WINDOWS_STATUS" != "success" ] || [ "$MACOS_STATUS" != "success" ]; then 53 | echo "Error: Not all platform builds have succeeded for tag $TAG" 54 | echo "Please ensure all three platform workflows (ffmpeg-linux, ffmpeg-windows, ffmpeg-macos) triggered by tag $TAG have completed successfully" 55 | exit 1 56 | fi 57 | 58 | echo "All platform builds succeeded for tag $TAG!" 59 | 60 | - name: Download Linux artifacts 61 | env: 62 | GH_TOKEN: ${{ github.token }} 63 | run: | 64 | TAG="${{ steps.check_tag.outputs.tag }}" 65 | mkdir -p /tmp/artifacts 66 | RUN_ID=$(gh api repos/${{ github.repository }}/actions/workflows/ffmpeg-linux.yml/runs \ 67 | --jq ".workflow_runs[] | select(.head_sha == \"${{ github.sha }}\" and .head_branch == \"$TAG\" and .conclusion == \"success\") | .id" | head -1) 68 | echo "Downloading Linux artifacts from run ID: $RUN_ID (tag: $TAG)" 69 | gh run download $RUN_ID -D /tmp/artifacts 70 | 71 | - name: Download Windows artifacts 72 | env: 73 | GH_TOKEN: ${{ github.token }} 74 | run: | 75 | TAG="${{ steps.check_tag.outputs.tag }}" 76 | RUN_ID=$(gh api repos/${{ github.repository }}/actions/workflows/ffmpeg-windows.yml/runs \ 77 | --jq ".workflow_runs[] | select(.head_sha == \"${{ github.sha }}\" and .head_branch == \"$TAG\" and .conclusion == \"success\") | .id" | head -1) 78 | echo "Downloading Windows artifacts from run ID: $RUN_ID (tag: $TAG)" 79 | gh run download $RUN_ID -D /tmp/artifacts 80 | 81 | - name: Download macOS artifacts 82 | env: 83 | GH_TOKEN: ${{ github.token }} 84 | run: | 85 | TAG="${{ steps.check_tag.outputs.tag }}" 86 | RUN_ID=$(gh api repos/${{ github.repository }}/actions/workflows/ffmpeg-macos.yml/runs \ 87 | --jq ".workflow_runs[] | select(.head_sha == \"${{ github.sha }}\" and .head_branch == \"$TAG\" and .conclusion == \"success\") | .id" | head -1) 88 | echo "Downloading macOS artifacts from run ID: $RUN_ID (tag: $TAG)" 89 | gh run download $RUN_ID -D /tmp/artifacts 90 | 91 | - name: List downloaded artifacts 92 | run: | 93 | echo "Downloaded artifacts:" 94 | find /tmp/artifacts -type f -name "*.tar.xz" 95 | 96 | - name: Create GitHub Release 97 | uses: softprops/action-gh-release@v2 98 | with: 99 | tag_name: ${{ steps.check_tag.outputs.tag }} 100 | files: /tmp/artifacts/**/*.tar.xz 101 | fail_on_unmatched_files: true 102 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax = docker/dockerfile:1.20 2 | 3 | ARG FFMPEG_VERSION="8.0" 4 | FROM akashisn/ffmpeg:${FFMPEG_VERSION} AS ffmpeg-linux-image 5 | FROM ghcr.io/akashisn/ffmpeg-windows:${FFMPEG_VERSION} AS ffmpeg-windows-image 6 | 7 | # 8 | # build env base image 9 | # 10 | FROM ubuntu:22.04 AS build-env 11 | 12 | SHELL ["/bin/bash", "-e", "-c"] 13 | ENV DEBIAN_FRONTEND=noninteractive 14 | 15 | # Install ca-certificates 16 | RUN < ${PKG_CONFIG_PATH}/x265.pc 58 | prefix=${PREFIX} 59 | exec_prefix=\${prefix} 60 | libdir=\${exec_prefix}/lib 61 | includedir=\${prefix}/include 62 | 63 | Name: x265 64 | Description: H.265 (HEVC) encoder library 65 | Version: 5.0 66 | 67 | Libs: -L\${libdir} -lx265 -lpthread -lstdc++ 68 | Cflags: -I\${includedir} 69 | EOS 70 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-libx265") 71 | 72 | # Build libaom 73 | LIBAOM_REPO="https://aomedia.googlesource.com/aom.git" 74 | LIBAOM_TAG_PREFIX="v" 75 | LIBAOM_VERSION="3.13.1" # get_latest_tag ${LIBAOM_REPO} ${LIBAOM_TAG_PREFIX} 76 | git_clone ${LIBAOM_REPO} ${LIBAOM_TAG_PREFIX}${LIBAOM_VERSION} 77 | mkcd _build 78 | do_cmake "-DBUILD_SHARED_LIBS=0 -DENABLE_DOCS=0 -DENABLE_TESTS=0 -DENABLE_EXAMPLES=0" .. 79 | do_make_and_make_install 80 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-libaom") 81 | 82 | 83 | # 84 | # Audio 85 | # 86 | 87 | # Build opus 88 | OPUS_REPO="https://github.com/xiph/opus.git" 89 | OPUS_TAG_PREFIX="v" 90 | OPUS_VERSION="1.6" # get_latest_tag ${OPUS_REPO} ${OPUS_TAG_PREFIX} 91 | git_clone ${OPUS_REPO} ${OPUS_TAG_PREFIX}${OPUS_VERSION} 92 | mkcd build 93 | do_cmake "-DBUILD_SHARED_LIBS=0 -DBUILD_TESTING=0" .. 94 | do_make_and_make_install 95 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-libopus") 96 | 97 | # Build mp3lame 98 | svn_checkout "https://svn.code.sf.net/p/lame/svn/trunk/lame" 99 | do_configure "--disable-shared --enable-static --enable-nasm --disable-decoder --disable-gtktest --disable-cpml --disable-frontend" 100 | do_make_and_make_install 101 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-libmp3lame") 102 | 103 | 104 | #------------------------------------------------------------------------------ 105 | # Prepare FFmpeg Build Options 106 | #------------------------------------------------------------------------------ 107 | 108 | # Write library options to files for FFmpeg configure 109 | echo -n "${FFMPEG_CONFIGURE_OPTIONS[@]}" > ${PREFIX}/ffmpeg_configure_options 110 | 111 | #============================================================================== 112 | # Build FFmpeg 113 | #============================================================================== 114 | 115 | # Build ffmpeg 116 | FFMPEG_VERSION="${FFMPEG_VERSION:-"8.0"}" 117 | git_clone "https://github.com/FFmpeg/FFmpeg.git" n${FFMPEG_VERSION} 118 | 119 | # Configure for macOS 120 | ./configure `cat ${PREFIX}/ffmpeg_configure_options` \ 121 | --arch=${HOST_ARCH} \ 122 | --disable-autodetect \ 123 | --disable-debug \ 124 | --disable-doc \ 125 | --enable-gpl \ 126 | --enable-version3 \ 127 | --enable-videotoolbox \ 128 | --enable-neon \ 129 | --pkg-config-flags="--static" \ 130 | --prefix=${PREFIX} | tee ${PREFIX}/configure_options 1>&2 131 | 132 | # Build 133 | do_make_and_make_install 134 | do_strip ${PREFIX}/bin "ff*" 135 | 136 | 137 | #============================================================================== 138 | # Finalize - Copy build artifacts to output directory 139 | #============================================================================== 140 | 141 | # Copy FFmpeg build options (for reference) 142 | cp_archive ${PREFIX}/ffmpeg_configure_options ${ARTIFACT_DIR} 143 | 144 | # Copy FFmpeg binaries and configuration 145 | cp_archive ${PREFIX}/configure_options ${ARTIFACT_DIR} 146 | cp_archive ${PREFIX}/bin/ff* ${ARTIFACT_DIR} 147 | -------------------------------------------------------------------------------- /CLAUDE.md: -------------------------------------------------------------------------------- 1 | # CLAUDE.md 2 | 3 | This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. 4 | 5 | ## Project Overview 6 | 7 | This repository builds FFmpeg binaries with extensive codec support for Linux, Windows, and macOS platforms. It uses Docker for Linux/Windows builds and native macOS runners for Apple Silicon builds. The builds include hardware acceleration support (NVIDIA CUDA, Intel QSV/VAAPI, Apple VideoToolbox). 8 | 9 | ## Build System Architecture 10 | 11 | ### Multi-Stage Docker Build Pattern 12 | 13 | The Dockerfile uses a multi-stage build with distinct stages: 14 | 15 | 1. **build-env**: Base Ubuntu 22.04 environment with all build tools (clang, cmake, meson, mingw-w64, etc.) 16 | 2. **ffmpeg-linux-build**: Builds all third-party libraries and Linux FFmpeg binary in a single stage 17 | 3. **ffmpeg-linux**: Final Ubuntu-based image with FFmpeg and runtime libraries 18 | 4. **ffmpeg-windows-build**: Builds all third-party libraries and Windows FFmpeg binary in a single stage 19 | 5. **ffmpeg-windows**: Scratch image with Windows FFmpeg binaries 20 | 6. **ffmpeg-linux-export**: Exports Linux binaries for release artifacts 21 | 7. **ffmpeg-windows-export**: Exports Windows binaries for release artifacts 22 | 8. **vainfo-build/vainfo**: Builds vainfo utility (references external ffmpeg-library image for dependencies) 23 | 24 | ### Script Organization (OS-Separated Structure) 25 | 26 | Scripts are organized by OS in `scripts/` directory: 27 | 28 | ``` 29 | scripts/ 30 | ├── common/ # Shared helper functions and build tools 31 | │ ├── helpers.sh # Core functions: download_and_unpack_file, git_clone, mkcd, gen_implib, do_strip, cp_archive 32 | │ │ # BSD/GNU compatibility: do_strip uses -perm +111 on macOS, cp_archive uses rsync on macOS 33 | │ ├── build-tools.sh # Build wrappers: do_configure, do_cmake, do_meson, do_make_and_make_install 34 | │ └── versions.sh # (Future) Centralized version definitions 35 | ├── linux/ # Linux-specific scripts 36 | │ ├── base.sh # Linux environment setup (CFLAGS, LDFLAGS, toolchain config) 37 | │ └── build.sh # Integrated build: libraries + FFmpeg (includes libdrm, libva, media-driver, etc.) 38 | ├── windows/ # Windows cross-compilation scripts 39 | │ ├── base.sh # mingw-w64 cross-compilation setup 40 | │ └── build.sh # Integrated build: libraries + FFmpeg (excludes Linux-specific hardware accel libs) 41 | └── macos/ # macOS native build scripts 42 | ├── base.sh # macOS environment setup 43 | └── build.sh # Integrated build script (libraries + FFmpeg with VideoToolbox) 44 | ``` 45 | 46 | **Key Design Principles:** 47 | - Each OS has independent base.sh that sources common scripts and sets OS-specific environment 48 | - Linux-only libraries: libpciaccess, libdrm, libva, gmmlib, media-driver, intel-vaapi-driver, oneVPL-intel-gpu, MediaSDK 49 | - Windows-only: MFX_dispatch, d3d11va/dxva2 support 50 | - All scripts use `FFMPEG_CONFIGURE_OPTIONS` array to build FFmpeg configure flags 51 | - Shared libraries built with static linking where possible for portability 52 | 53 | **BSD/GNU Compatibility (macOS Native Builds):** 54 | - `do_strip()`: Uses `-perm +111` instead of `-executable` on BSD find (macOS) 55 | - `cp_archive()`: Uses `rsync -a --relative` instead of GNU cp's `--archive --parents` on macOS 56 | - All helper functions in `scripts/common/helpers.sh` check `$HOST_OS` for platform-specific behavior 57 | - macOS builds use `/usr/bin/find` and `/usr/bin/rsync` explicitly to avoid GNU tools from Homebrew 58 | 59 | ### Implib.so for Dynamic Library Delay-Loading 60 | 61 | Linux builds use [Implib.so](https://github.com/yugr/Implib.so) to create static wrapper libraries for dynamic dependencies (libva, libdrm, libmfx). This allows FFmpeg to run without hardware acceleration libraries present, loading them only when QSV/VAAPI is used. See `gen_implib()` function in `scripts/common/helpers.sh`. 62 | 63 | ## Build Commands 64 | 65 | ### Docker Builds 66 | 67 | ```bash 68 | # Build Linux FFmpeg (builds libraries and FFmpeg in a single stage) 69 | docker build --target ffmpeg-linux --tag ffmpeg:linux . 70 | 71 | # Build Windows FFmpeg (builds libraries and FFmpeg in a single stage) 72 | docker build --target ffmpeg-windows --tag ffmpeg-win . 73 | 74 | # Build with specific FFmpeg version 75 | docker build --build-arg FFMPEG_VERSION=6.1.2 --target ffmpeg-linux . 76 | 77 | # Build vainfo utility 78 | docker build --target vainfo --tag vainfo . 79 | 80 | # Export binaries locally 81 | docker buildx build --target ffmpeg-linux-export --output type=local,dest=./build . 82 | docker buildx build --target ffmpeg-windows-export --output type=local,dest=./build . 83 | ``` 84 | 85 | ### macOS Native Build 86 | 87 | ```bash 88 | # Full build (runs on Apple Silicon, integrates library build and FFmpeg build) 89 | ./scripts/macos/build.sh 90 | 91 | # With specific FFmpeg version 92 | FFMPEG_VERSION=7.0.2 ./scripts/macos/build.sh 93 | 94 | # Build output location (defined in base.sh) 95 | # - Binaries: /tmp/dist/opt/ffmpeg/bin/ 96 | # - Build artifacts: /tmp/ffmpeg-build/ 97 | ``` 98 | 99 | ## GitHub Actions Workflows 100 | 101 | ### Workflow Triggers 102 | 103 | Each platform has its own independent workflow for better isolation and parallel execution: 104 | 105 | - **ffmpeg-linux.yml**: Linux FFmpeg builds 106 | - Triggered by: workflow_dispatch, push to tags (v*) 107 | - Matrix: FFmpeg versions `[8.0, 7.0.2, 6.1.2, 5.1.6]` 108 | - Actions: 109 | - Builds third-party libraries and FFmpeg in a single Docker stage 110 | - Pushes final images to Docker Hub: `akashisn/ffmpeg:{version}` 111 | - Exports binaries using `ffmpeg-linux-export` target 112 | - Creates tar.xz archives: `ffmpeg-{version}-linux-amd64.tar.xz` 113 | - Uploads artifacts to GitHub Actions (for release workflow) 114 | 115 | - **ffmpeg-windows.yml**: Windows FFmpeg builds (cross-compiled on Ubuntu) 116 | - Triggered by: workflow_dispatch, push to tags (v*) 117 | - Matrix: FFmpeg versions `[8.0, 7.0.2, 6.1.2, 5.1.6]` 118 | - Actions: 119 | - Builds third-party libraries and FFmpeg in a single Docker stage 120 | - Pushes final images to GHCR: `ghcr.io/akashisn/ffmpeg-windows:{version}` 121 | - Exports binaries using `ffmpeg-windows-export` target 122 | - Creates tar.xz archives: `ffmpeg-{version}-windows-x64.tar.xz` 123 | - Uploads artifacts to GitHub Actions (for release workflow) 124 | 125 | - **ffmpeg-macos.yml**: macOS native builds (Apple Silicon) 126 | - Triggered by: workflow_dispatch, push to tags (v*) 127 | - Matrix: FFmpeg versions `[8.0, 7.0.2, 6.1.2, 5.1.6]` 128 | - Runs on `macos-26` runner 129 | - Actions: 130 | - Builds FFmpeg natively with VideoToolbox support 131 | - Creates tar.xz archives: `ffmpeg-{version}-macos-arm64.tar.xz` 132 | - Uploads artifacts to GitHub Actions (for release workflow) 133 | - Build script receives FFMPEG_VERSION environment variable 134 | 135 | - **vainfo.yml**: Utility for checking Intel QSV/VAAPI support (Linux only) 136 | - Triggered by workflow_dispatch 137 | - Builds vainfo utility image 138 | 139 | - **ffmpeg-release.yml**: Release workflow (manual trigger only) 140 | - Triggered by: workflow_dispatch (manual trigger only) 141 | - Prerequisites: 142 | - Current commit must be tagged with a version tag (starting with 'v') 143 | - All three platform workflows (Linux/Windows/macOS) must have completed successfully for this tag 144 | - Actions: 145 | - Verifies current commit is tagged 146 | - Checks that all three platform workflows succeeded for this tag (filters by both commit SHA and tag name) 147 | - Downloads artifacts from all three platform workflows using gh CLI 148 | - Creates GitHub release with all tar.xz archives attached 149 | - No building occurs in this workflow; it only aggregates and publishes artifacts 150 | - Safety: Filters workflow runs by both `head_sha` (commit) and `head_branch` (tag name) to ensure only artifacts from the correct tag are used, preventing accidental inclusion of builds from other branches 151 | 152 | ### Workflow Dependencies 153 | 154 | ``` 155 | Tag Push (v*) 156 | ↓ (parallel) 157 | ├── ffmpeg-linux (builds & uploads artifacts) 158 | ├── ffmpeg-windows (builds & uploads artifacts) 159 | └── ffmpeg-macos (builds & uploads artifacts) 160 | ↓ (all complete successfully) 161 | Manual trigger: workflow_dispatch on ffmpeg-release 162 | ├─ Verifies current commit is tagged 163 | ├─ Checks all 3 workflows succeeded 164 | └─ Downloads artifacts & creates GitHub release 165 | ``` 166 | 167 | The release workflow is manually triggered after confirming all platform builds have completed successfully. It verifies prerequisites before creating the release. 168 | 169 | All platform workflows use Docker layer caching (type=gha) for faster builds (Linux/Windows only; macOS builds natively). 170 | 171 | ## Important Technical Details 172 | 173 | ### FFmpeg Version Compatibility 174 | 175 | - **FFmpeg 6.0+**: Uses `--enable-libvpl` (oneVPL) for Intel QSV support 176 | - **FFmpeg 5.x and earlier**: Uses `--enable-libmfx` (legacy MediaSDK) 177 | 178 | The `build-ffmpeg.sh` scripts automatically detect version and adjust configuration. See version comparison logic in `scripts/{linux,windows}/build-ffmpeg.sh`. 179 | 180 | ### Hardware Acceleration Support 181 | 182 | **Linux:** 183 | - NVIDIA CUDA (nvenc/nvdec/cuvid) via nv-codec-headers 184 | - Intel QSV via oneVPL → oneVPL-intel-gpu/MediaSDK 185 | - Intel VAAPI via libva + media-driver/intel-vaapi-driver 186 | 187 | **Windows:** 188 | - NVIDIA CUDA (same as Linux) 189 | - Intel QSV via libvpl/libmfx 190 | - DirectX (d3d11va, dxva2) 191 | 192 | **macOS:** 193 | - Apple VideoToolbox (hardware H.264/H.265 encode/decode) 194 | 195 | ### Cross-Compilation for Windows 196 | 197 | Windows builds use mingw-w64 toolchain on Ubuntu. Key environment variables in `scripts/windows/base.sh`: 198 | - `CROSS_PREFIX=x86_64-w64-mingw32-` 199 | - `BUILD_TARGET=x86_64-w64-mingw32` 200 | - Meson cross-file: `${WORKDIR}/${BUILD_TARGET}.txt` 201 | - CMake toolchain: `${WORKDIR}/toolchains.cmake` 202 | 203 | ### Library Building Pattern 204 | 205 | All platform `build.sh` scripts follow this pattern for library building: 206 | 1. Build dependencies in correct order (e.g., libogg before vorbis) 207 | 2. Use static libraries where possible (`--enable-static --disable-shared`) 208 | 3. Accumulate FFmpeg configure options in `FFMPEG_CONFIGURE_OPTIONS` array 209 | 4. Save configure options and extra libs to PREFIX for FFmpeg configure: 210 | ```bash 211 | echo -n "${FFMPEG_CONFIGURE_OPTIONS[@]}" > ${PREFIX}/ffmpeg_configure_options 212 | echo -n "${FFMPEG_EXTRA_LIBS[@]}" > ${PREFIX}/ffmpeg_extra_libs 213 | ``` 214 | 5. Build FFmpeg using the accumulated options in the same script 215 | 216 | ### Modifying Build Scripts 217 | 218 | Each platform has a unified build script that handles both library building and FFmpeg configuration: 219 | 220 | When adding/modifying libraries: 221 | 222 | 1. **Add to common libraries**: Edit library sections in `scripts/linux/build.sh` and `scripts/windows/build.sh` 223 | 2. **OS-specific libraries**: Add only to relevant OS script (e.g., libva → Linux only) 224 | 3. **Update configure options**: Add `FFMPEG_CONFIGURE_OPTIONS+=("--enable-libname")` 225 | 4. **Test both OS builds**: Ensure cross-compilation doesn't break 226 | 5. **Version updates**: Currently hardcoded in build.sh files (future: move to versions.sh) 227 | 228 | When modifying FFmpeg configure: 229 | - Linux: Edit FFmpeg configure section in `scripts/linux/build.sh` 230 | - Windows: Edit FFmpeg configure section in `scripts/windows/build.sh` (add cross-compile specific flags) 231 | - macOS: Edit FFmpeg configure section in `scripts/macos/build.sh` (minimal build, VideoToolbox only) 232 | 233 | ### Docker Layer Caching Strategy 234 | 235 | GitHub Actions uses `cache-from: type=gha` and `cache-to: type=gha,mode=max` for Docker layer caching. Each platform's build stages are cached independently, allowing faster incremental builds when only specific components change. 236 | 237 | ## Testing Locally 238 | 239 | ```bash 240 | # Test Linux FFmpeg build (includes libraries and FFmpeg) 241 | docker build --target ffmpeg-linux --tag test:ffmpeg . 242 | 243 | # Test Windows FFmpeg build 244 | docker build --target ffmpeg-windows --tag test:ffmpeg-win . 245 | 246 | # Test if configure options match previous build 247 | docker run test:ffmpeg cat /usr/local/configure_options > new_options.txt 248 | # Compare with expected configure_options from README.md 249 | 250 | # Test vainfo build 251 | docker build --target vainfo --tag test:vainfo . 252 | 253 | # Test macOS build 254 | ./scripts/macos/build.sh 255 | /tmp/dist/opt/ffmpeg/bin/ffmpeg -version 256 | /tmp/dist/opt/ffmpeg/bin/ffmpeg -hwaccels # Should show videotoolbox 257 | ``` 258 | 259 | ## Release Process 260 | 261 | 1. Tag the commit with version tag: `git tag v1.0.0 && git push origin v1.0.0` 262 | 2. Three platform workflows trigger automatically in parallel: 263 | - `ffmpeg-linux.yml` builds all FFmpeg versions for Linux 264 | - `ffmpeg-windows.yml` builds all FFmpeg versions for Windows 265 | - `ffmpeg-macos.yml` builds all FFmpeg versions for macOS 266 | 3. Each platform workflow: 267 | - Builds FFmpeg binaries 268 | - Pushes Docker images (Linux/Windows only) 269 | - Exports binaries and creates tar.xz archives 270 | - Uploads artifacts to GitHub Actions 271 | 4. Wait for all three platform workflows to complete successfully 272 | 5. Manually trigger `ffmpeg-release.yml` workflow: 273 | - Navigate to Actions tab on GitHub 274 | - Select "ffmpeg-release" workflow 275 | - Click "Run workflow" button 276 | - The workflow will: 277 | - Verify the current commit is tagged with a version tag (v*) 278 | - Check that all three platform workflows succeeded for this commit 279 | - Download all artifacts from the successful builds using gh CLI 280 | - Create GitHub release with all tar.xz archives: 281 | - `ffmpeg-{version}-linux-amd64.tar.xz` (multiple versions) 282 | - `ffmpeg-{version}-windows-x64.tar.xz` (multiple versions) 283 | - `ffmpeg-{version}-macos-arm64.tar.xz` (multiple versions) 284 | 285 | Archives contain: `bin/`, `lib/`, `configure_options`, and `run.sh` (Linux only) for setting LD_LIBRARY_PATH. 286 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ffmpeg-docker 2 | 3 | [![ffmpeg](https://github.com/AkashiSN/ffmpeg-docker/actions/workflows/ffmpeg.yml/badge.svg)](https://github.com/AkashiSN/ffmpeg-docker/actions/workflows/ffmpeg.yml) 4 | 5 | [![](https://dockeri.co/image/akashisn/ffmpeg)](https://hub.docker.com/r/akashisn/ffmpeg) 6 | 7 | ## Available release 8 | 9 | - Linux docker image (`akashisn/ffmpeg`) & binary release 10 | - `7.0.2` 11 | - `6.1.2` 12 | - `5.1.6` 13 | - `4.4.5` 14 | - Windows binary release 15 | - `7.0.2` 16 | - `6.1.2` 17 | - `5.1.6` 18 | - `4.4.5` 19 | 20 | ## Supported architecture 21 | 22 | - ffmpeg 23 | - `linux/amd64` 24 | 25 |
26 | configure options: 27 | 28 | ```bash 29 | --enable-zlib --enable-lzma --enable-gmp --enable-iconv --enable-gnutls --enable-libsrt 30 | --enable-libopenjpeg --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 31 | --enable-libaom --enable-libvmaf --enable-libopus --enable-libvorbis --enable-libopencore-amrnb 32 | --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libmp3lame --enable-libfreetype 33 | --enable-libfribidi --enable-libxml2 --enable-libfontconfig --enable-libass --enable-libaribb24 34 | --enable-sdl2 --enable-cuda-llvm --enable-ffnvcodec --enable-cuvid --enable-nvdec --enable-nvenc 35 | --enable-libdrm --enable-vaapi --enable-libvpl --disable-autodetect --disable-debug --disable-doc 36 | --enable-gpl --enable-version3 --extra-libs='-lm -lpthread -lstdc++' --pkg-config-flags=--static 37 | --prefix=/usr/local 38 | ``` 39 |
40 | 41 |
42 | Dependent library 43 | 44 | ```bash 45 | $ ldd ffmpeg 46 | linux-vdso.so.1 (0x00007ffed66ba000) 47 | libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f38fcc95000) 48 | libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f38fca69000) 49 | libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f38fc841000) 50 | /lib64/ld-linux-x86-64.so.2 (0x00007f3901805000) 51 | libmvec.so.1 => /lib/x86_64-linux-gnu/libmvec.so.1 (0x00007f38fc744000) 52 | libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f38fc724000) 53 | ``` 54 |
55 | 56 | - Windows ffmpeg 57 | - `windows/x64` 58 |
59 | configure options: 60 | 61 | ```bash 62 | --enable-zlib --enable-libopenjpeg --enable-libwebp --enable-lzma --enable-gmp --enable-iconv 63 | --enable-gnutls --enable-libsrt --enable-libvpx --enable-libx264 --enable-libx265 --enable-libaom 64 | --enable-libopus --enable-libvorbis --enable-libopencore-amrnb --enable-libopencore-amrwb 65 | --enable-libvo-amrwbenc --enable-libmp3lame --enable-libfreetype --enable-libfribidi --enable-libxml2 66 | --enable-libfontconfig --enable-libass --enable-libaribb24 --enable-sdl2 --enable-cuda-llvm 67 | --enable-ffnvcodec --enable-cuvid --enable-nvdec --enable-nvenc --enable-libmfx --enable-d3d11va 68 | --enable-dxva2 --arch=x86_64 --cross-prefix=x86_64-w64-mingw32- --disable-autodetect --disable-debug 69 | --disable-doc --disable-w32threads --enable-cross-compile --enable-gpl --enable-version3 70 | --extra-libs='-static -static-libgcc -static-libstdc++ -Wl,-Bstatic -lm -lpthread -lstdc++' 71 | --extra-cflags=--static --target-os=mingw64 --pkg-config=pkg-config --pkg-config-flags=--static -prefix=/usr/local 72 | ``` 73 |
74 | 75 |
76 | Dependent library 77 | 78 | ```bash 79 | $ LANG=C objdump -p ffmpeg.exe | grep 'DLL Name:' 80 | DLL Name: ADVAPI32.dll 81 | DLL Name: bcrypt.dll 82 | DLL Name: GDI32.dll 83 | DLL Name: KERNEL32.dll 84 | DLL Name: msvcrt.dll 85 | DLL Name: ole32.dll 86 | DLL Name: OLEAUT32.dll 87 | DLL Name: PSAPI.DLL 88 | DLL Name: SHELL32.dll 89 | DLL Name: SHLWAPI.dll 90 | DLL Name: USER32.dll 91 | DLL Name: AVICAP32.dll 92 | DLL Name: WS2_32.dll 93 | ``` 94 |
95 | 96 | ## HWaccels 97 | 98 | https://trac.ffmpeg.org/wiki/HWAccelIntro 99 | 100 | ```bash 101 | $ ffmpeg -hide_banner -hwaccels 102 | Hardware acceleration methods: 103 | cuda 104 | vaapi 105 | qsv 106 | drm 107 | ``` 108 | 109 | - `cuda`: NVIDIA's GPU accelerated video codecs (`nvenc/nvdec`) 110 | ```bash 111 | $ ffmpeg -hide_banner -encoders | grep nvenc 112 | V....D av1_nvenc NVIDIA NVENC av1 encoder (codec av1) 113 | V....D h264_nvenc NVIDIA NVENC H.264 encoder (codec h264) 114 | V....D hevc_nvenc NVIDIA NVENC hevc encoder (codec hevc) 115 | ``` 116 | - `vaapi`: Intel Media Driver for VAAPI 117 | ```bash 118 | $ ffmpeg -hide_banner -encoders | grep vaapi 119 | V....D h264_vaapi H.264/AVC (VAAPI) (codec h264) 120 | V....D hevc_vaapi H.265/HEVC (VAAPI) (codec hevc) 121 | V....D mjpeg_vaapi MJPEG (VAAPI) (codec mjpeg) 122 | V....D mpeg2_vaapi MPEG-2 (VAAPI) (codec mpeg2video) 123 | V....D vp8_vaapi VP8 (VAAPI) (codec vp8) 124 | V....D vp9_vaapi VP9 (VAAPI) (codec vp9) 125 | ``` 126 | 127 | - `QSV`: Intel QSV (Intel Quick Sync Video) 128 | ```bash 129 | $ ffmpeg -hide_banner -encoders | grep qsv 130 | V..... av1_qsv AV1 (Intel Quick Sync Video acceleration) (codec av1) 131 | V..... h264_qsv H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (Intel Quick Sync Video acceleration) (codec h264) 132 | V..... hevc_qsv HEVC (Intel Quick Sync Video acceleration) (codec hevc) 133 | V..... mjpeg_qsv MJPEG (Intel Quick Sync Video acceleration) (codec mjpeg) 134 | V..... mpeg2_qsv MPEG-2 video (Intel Quick Sync Video acceleration) (codec mpeg2video) 135 | V..... vp9_qsv VP9 video (Intel Quick Sync Video acceleration) (codec vp9) 136 | ``` 137 | 138 | 139 | ## Intel QSV (Intel Quick Sync Video) 140 | 141 | https://trac.ffmpeg.org/wiki/Hardware/QuickSync 142 | 143 | You can use the following command to find out which codecs are supported by your CPU. 144 | 145 | ```bash 146 | $ sudo docker run --rm -it --device=/dev/dri akashisn/vainfo 147 | Trying display: drm 148 | libva info: VA-API version 1.19.0 149 | libva info: User environment variable requested driver 'iHD' 150 | libva info: Trying to open /usr/local/lib/dri/iHD_drv_video.so 151 | libva info: Found init function __vaDriverInit_1_19 152 | libva info: va_openDriver() returns 0 153 | vainfo: VA-API version: 1.19 (libva 2.19.0) 154 | vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.3.3 (1c13afa) 155 | vainfo: Supported profile and entrypoints 156 | VAProfileNone : VAEntrypointVideoProc 157 | VAProfileNone : VAEntrypointStats 158 | VAProfileMPEG2Simple : VAEntrypointVLD 159 | VAProfileMPEG2Simple : VAEntrypointEncSlice 160 | VAProfileMPEG2Main : VAEntrypointVLD 161 | VAProfileMPEG2Main : VAEntrypointEncSlice 162 | VAProfileH264Main : VAEntrypointVLD 163 | VAProfileH264Main : VAEntrypointEncSlice 164 | VAProfileH264Main : VAEntrypointFEI 165 | VAProfileH264Main : VAEntrypointEncSliceLP 166 | VAProfileH264High : VAEntrypointVLD 167 | VAProfileH264High : VAEntrypointEncSlice 168 | VAProfileH264High : VAEntrypointFEI 169 | VAProfileH264High : VAEntrypointEncSliceLP 170 | VAProfileVC1Simple : VAEntrypointVLD 171 | VAProfileVC1Main : VAEntrypointVLD 172 | VAProfileVC1Advanced : VAEntrypointVLD 173 | VAProfileJPEGBaseline : VAEntrypointVLD 174 | VAProfileJPEGBaseline : VAEntrypointEncPicture 175 | VAProfileH264ConstrainedBaseline: VAEntrypointVLD 176 | VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice 177 | VAProfileH264ConstrainedBaseline: VAEntrypointFEI 178 | VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP 179 | VAProfileVP8Version0_3 : VAEntrypointVLD 180 | VAProfileVP8Version0_3 : VAEntrypointEncSlice 181 | VAProfileHEVCMain : VAEntrypointVLD 182 | VAProfileHEVCMain : VAEntrypointEncSlice 183 | VAProfileHEVCMain : VAEntrypointFEI 184 | VAProfileHEVCMain10 : VAEntrypointVLD 185 | VAProfileHEVCMain10 : VAEntrypointEncSlice 186 | VAProfileVP9Profile0 : VAEntrypointVLD 187 | VAProfileVP9Profile2 : VAEntrypointVLD 188 | ``` 189 | 190 | - `VAEntrypointEncSlice`: Can encode 191 | - `VAEntrypointVLD` : Can decode 192 | 193 | 194 | ## Binary release 195 | 196 | You can find the pre-built binary files on the [release page](https://github.com/AkashiSN/ffmpeg-docker/releases). 197 | 198 | There are files in the assets with the following naming conventions: 199 | 200 | ``` 201 | ffmpeg-${version}-${"linux" or "windows"}-${arch}.tar.gz 202 | ``` 203 | 204 |
205 | Contains of archive file: 206 | 207 | ```bash 208 | $ ls 209 | bin configure_options lib run.sh 210 | 211 | $ ls bin/ 212 | ffmpeg ffplay ffprobe 213 | 214 | $ tree lib/ 215 | lib 216 | ├── dri 217 | │   ├── i965_drv_video.so 218 | │   └── iHD_drv_video.so 219 | ├── libdrm.so -> libdrm.so.2 220 | ├── libdrm.so.2 -> libdrm.so.2.123.0 221 | ├── libdrm.so.2.123.0 222 | ├── libdrm_amdgpu.so -> libdrm_amdgpu.so.1 223 | ├── libdrm_amdgpu.so.1 -> libdrm_amdgpu.so.1.123.0 224 | ├── libdrm_amdgpu.so.1.123.0 225 | ├── libdrm_intel.so -> libdrm_intel.so.1 226 | ├── libdrm_intel.so.1 -> libdrm_intel.so.1.123.0 227 | ├── libdrm_intel.so.1.123.0 228 | ├── libdrm_nouveau.so -> libdrm_nouveau.so.2 229 | ├── libdrm_nouveau.so.2 -> libdrm_nouveau.so.2.123.0 230 | ├── libdrm_nouveau.so.2.123.0 231 | ├── libdrm_radeon.so -> libdrm_radeon.so.1 232 | ├── libdrm_radeon.so.1 -> libdrm_radeon.so.1.123.0 233 | ├── libdrm_radeon.so.1.123.0 234 | ├── libigdgmm.so -> libigdgmm.so.12 235 | ├── libigdgmm.so.12 -> libigdgmm.so.12.5.0 236 | ├── libigdgmm.so.12.5.0 237 | ├── libigfxcmrt.so -> libigfxcmrt.so.7 238 | ├── libigfxcmrt.so.7 -> libigfxcmrt.so.7.2.0 239 | ├── libigfxcmrt.so.7.2.0 240 | ├── libmfx-gen 241 | │   └── enctools.so 242 | ├── libmfx-gen.so -> libmfx-gen.so.1.2 243 | ├── libmfx-gen.so.1.2 -> libmfx-gen.so.1.2.12 244 | ├── libmfx-gen.so.1.2.12 245 | ├── libmfx.so -> libmfx.so.1 246 | ├── libmfx.so.1 -> libmfx.so.1.35 247 | ├── libmfx.so.1.35 248 | ├── libmfxhw64.so -> libmfxhw64.so.1 249 | ├── libmfxhw64.so.1 -> libmfxhw64.so.1.35 250 | ├── libmfxhw64.so.1.35 251 | ├── libpciaccess.so -> libpciaccess.so.0 252 | ├── libpciaccess.so.0 -> libpciaccess.so.0.11.1 253 | ├── libpciaccess.so.0.11.1 254 | ├── libva-drm.so -> libva-drm.so.2.2200.0 255 | ├── libva-drm.so.2 -> libva-drm.so.2.2200.0 256 | ├── libva-drm.so.2.2200.0 257 | ├── libva.so -> libva.so.2.2200.0 258 | ├── libva.so.2 -> libva.so.2.2200.0 259 | ├── libva.so.2.2200.0 260 | └── mfx 261 | ├── libmfx_h264la_hw64.so 262 | ├── libmfx_hevc_fei_hw64.so 263 | ├── libmfx_hevcd_hw64.so 264 | ├── libmfx_hevce_hw64.so 265 | ├── libmfx_vp8d_hw64.so 266 | ├── libmfx_vp9d_hw64.so 267 | └── libmfx_vp9e_hw64.so 268 | 269 | 3 directories, 49 files 270 | 271 | $ cat run.sh 272 | #!/bin/sh 273 | export PATH=$(dirname $0)/bin:$PATH 274 | export LD_LIBRARY_PATH=$(dirname $0)/lib:$LD_LIBRARY_PATH 275 | export LIBVA_DRIVERS_PATH=$(dirname $0)/lib/dri 276 | export LIBVA_DRIVER_NAME=iHD 277 | exec $@ 278 | ``` 279 |
280 | 281 | If you use `run.sh`, you can run it after setting the `LD_LIBRARY_PATH` and other settings. 282 | 283 | And, if you want to encode with QSV, you need to run it with root privileges. 284 | 285 | sample: 286 | 287 | ```bash 288 | $ sudo ./run.sh ffmpeg -y \ 289 | -init_hw_device qsv:hw \ 290 | -hwaccel qsv \ 291 | -hwaccel_output_format qsv \ 292 | -extra_hw_frames 32 \ 293 | -i https://github.com/bower-media-samples/big-buck-bunny-1080p-60fps-30s/raw/master/video.mp4 \ 294 | -c:v h264_qsv \ 295 | -f mp4 \ 296 | video-h264_qsv.mp4 297 | ``` 298 | 299 | ## Docker image release 300 | 301 | When running in Docker, you need to mount the DRI device. 302 | 303 | sample: 304 | ```bash 305 | $ sudo docker run --rm -it --device=/dev/dri -v `pwd`:/workdir \ 306 | akashisn/ffmpeg:7.0.2 -y \ 307 | -loglevel verbose \ 308 | -init_hw_device qsv:hw \ 309 | -hwaccel qsv \ 310 | -hwaccel_output_format qsv \ 311 | -extra_hw_frames 32 \ 312 | -i video.mp4 \ 313 | -c:v h264_qsv \ 314 | -f mp4 \ 315 | video-h264_qsv.mp4 316 | ``` 317 | 318 | # Nonfree codecs 319 | 320 | If you want to use a non-free codec(e.g. `fdk-aac`, `libnpp` ), you can generate a binary in the current directory by executing the following command. 321 | 322 | **Generated binaries cannot be redistributed due to licensing issues. Please use them for your own use only.** 323 | 324 | ```powershell 325 | # for windows build 326 | > $Env:CUDA_SDK_VERSION = "12.0.1" 327 | > $Env:NVIDIA_DRIVER_VERSION = "528.33" 328 | > curl -L -o cuda_${Env:CUDA_SDK_VERSION}_${Env:NVIDIA_DRIVER_VERSION}_windows.exe https://developer.download.nvidia.com/compute/cuda/${Env:CUDA_SDK_VERSION}/local_installers/cuda_${Env:CUDA_SDK_VERSION}_${Env:NVIDIA_DRIVER_VERSION}_windows.exe 329 | > docker buildx build --build-arg HOST_TARGET=x86_64-w64-mingw32 --build-arg TARGET_OS=windows --build-arg CUDA_SDK_VERSION=${Env:CUDA_SDK_VERSION} --build-arg NVIDIA_DRIVER_VERSION=${Env:NVIDIA_DRIVER_VERSION} --output type=local,dest=build -t ffmpeg-nonfree:windows -f ./nonfree.Dockerfile . 330 | ``` 331 | 332 | ```bash 333 | # for linux build 334 | $ touch cuda_11.6.0_511.23_windows.exe # dummy file 335 | $ docker buildx build --output type=local,dest=build -t ffmpeg-nonfree:linux -f ./nonfree.Dockerfile . 336 | ``` 337 | 338 | # Technical information 339 | 340 | ## Intel Quick Sync Video 341 | 342 | QSV (Quick Sync Video) was previously supported by `libmfx.so` provided by MediaSDK, but since the development of MediaSDK has been discontinued, it has been taken over by the successor, oneAPI's oneVPL (`libvpl.so`). 343 | In FFmpeg, the option `--enable-libvpl` was added from version 6.0. Therefore, in this build, only version `6.0` supports QSV through oneVPL's dispatcher, and previous versions are built using the old MediaSDK dispatcher. 344 | Note that the MediaSDK may no longer be usable as it lacks support for new hardware. 345 | Moreover, oneVPL supports older hardware by calling `MediaSDK`. 346 | Therefore, unless there is a reason to use an older version of FFmpeg, it is recommended to use the version compatible with oneVPL. 347 | 348 | ```mermaid 349 | graph TD; 350 | VPL[oneVPL Dispatcher]-->oneVPL-intel-gpu; 351 | VPL[oneVPL Dispatcher]-->MediaSDK; 352 | ``` 353 | 354 | https://github.com/oneapi-src/oneVPL/tree/master#onevpl-architecture 355 | 356 | ### QSV in VM 357 | 358 | To execute QSV (Quick Sync Video) on a Virtual Machine, it is necessary to pass through Intel's integrated GPU (iGPU) to the VM. 359 | Pass-through technologies include Intel GVT-g, SR-IOV, etc., and the compatibility varies depending on the generation of the CPU[^1]. 360 | For Intel GVT-g, please refer to the ArchWiki[^2]. 361 | In Proxmox, if you are using systemd-boot instead of GRUB, kernel parameters can be set using `/etc/kernel/cmdline`. Also, don't forget to apply the changes by running `proxmox-boot-tool refresh`. If necessary, adding `kvm.ignore_msrs=1` is recommended[^3]. 362 | 363 | [^1]: [Graphics Virtualization Technologies Support for Each Intel® Graphics Family](https://www.intel.com/content/www/us/en/support/articles/000093216/graphics/processor-graphics.html) 364 | 365 | [^2]:https://wiki.archlinux.org/title/Intel_GVT-g 366 | 367 | [^3]:https://kagasu.hatenablog.com/entry/2021/01/29/111659 368 | 369 | ## Dynamic Library 370 | 371 | Using [https://github.com/yugr/Implib.so](https://github.com/yugr/Implib.so), the dynamic library related to QSV is delay-loaded, so when you run `ldd` to check, it appears to have no dependencies. However, please note that it becomes necessary when using QSV. This resolves the inconvenience where FFmpeg wouldn't even start without the dynamic library even when QSV is not needed, achieving a pseudo-static link. Therefore, we have consolidated the tags which were previously separated based on whether QSV was available or not. 372 | -------------------------------------------------------------------------------- /scripts/windows/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 4 | source ${SCRIPT_DIR}/base.sh 5 | 6 | rm -rf ${ARTIFACT_DIR} 7 | mkdir -p ${RUNTIME_LIB_DIR} 8 | mkdir -p ${ARTIFACT_DIR} 9 | 10 | 11 | #============================================================================== 12 | # Build Libraries 13 | #============================================================================== 14 | 15 | # 16 | # Common library 17 | # 18 | 19 | # Build xorg-macros 20 | XORG_MACROS_REPO="https://gitlab.freedesktop.org/xorg/util/macros.git" 21 | XORG_MACROS_TAG_PREFIX="util-macros-" 22 | XORG_MACROS_VERSION="1.20.1" # get_latest_tag ${XORG_MACROS_REPO} ${XORG_MACROS_TAG_PREFIX} 23 | git_clone ${XORG_MACROS_REPO} ${XORG_MACROS_TAG_PREFIX}${XORG_MACROS_VERSION} ${XORG_MACROS_VERSION} 24 | do_configure 25 | do_make_and_make_install 26 | 27 | # Build zlib 28 | ZLIB_REPO="https://github.com/madler/zlib.git" 29 | ZLIB_TAG_PREFIX="v" 30 | ZLIB_VERSION="1.3.1" # get_latest_tag ${ZLIB_REPO} ${ZLIB_TAG_PREFIX} 31 | git_clone ${ZLIB_REPO} ${ZLIB_TAG_PREFIX}${ZLIB_VERSION} 32 | CC=${CROSS_PREFIX}gcc AR=${CROSS_PREFIX}ar RANLIB=${CROSS_PREFIX}ranlib ./configure --prefix=${PREFIX} --static 33 | do_make_and_make_install 34 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-zlib") 35 | 36 | # Build bzip2 37 | BZIP2_REPO="https://gitlab.com/bzip2/bzip2.git" 38 | BZIP2_TAG_PREFIX="bzip2-" 39 | BZIP2_VERSION="1.0.8" # get_latest_tag ${BZIP2_REPO} ${BZIP2_TAG_PREFIX} 40 | git_clone ${BZIP2_REPO} ${BZIP2_TAG_PREFIX}${BZIP2_VERSION} ${BZIP2_VERSION} 41 | make CC=${CROSS_PREFIX}gcc AR=${CROSS_PREFIX}ar RANLIB=${CROSS_PREFIX}ranlib libbz2.a 42 | install -m 644 bzlib.h ${PREFIX}/include 43 | install -m 644 libbz2.a ${PREFIX}/lib 44 | cat < ${PKG_CONFIG_PATH}/bz2.pc 45 | prefix=${PREFIX} 46 | exec_prefix=\${prefix} 47 | libdir=\${exec_prefix}/lib 48 | includedir=\${prefix}/include 49 | 50 | Name: bzip2 51 | Description: A file compression library 52 | Version: ${BZIP2_VERSION} 53 | 54 | Libs: -L\${libdir} -lbz2 55 | Cflags: -I\${includedir} 56 | EOS 57 | ln -s ${PKG_CONFIG_PATH}/bz2.pc ${PKG_CONFIG_PATH}/bzip2.pc 58 | 59 | # Build lzma 60 | LZMA_REPO="https://github.com/tukaani-project/xz.git" 61 | LZMA_TAG_PREFIX="v" 62 | LZMA_VERSION="5.6.2" # get_latest_tag ${LZMA_REPO} ${LZMA_TAG_PREFIX} 63 | git_clone ${LZMA_REPO} ${LZMA_TAG_PREFIX}${LZMA_VERSION} 64 | ./autogen.sh --no-po4a --no-doxygen 65 | do_configure "--enable-static --disable-shared --with-pic --disable-symbol-versions 66 | --disable-xz --disable-xzdec --disable-lzmadec --disable-lzmainfo --disable-scripts --disable-doc" 67 | do_make_and_make_install 68 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-lzma") 69 | 70 | # Build Nettle (for gmp,gnutls) 71 | NETTLE_URL="https://ftp.jaist.ac.jp/pub/GNU/nettle" 72 | NETTLE_PREFIX="nettle-" 73 | NETTLE_VERSION="3.10" # get_latest_version ${NETTLE_URL} ${NETTLE_PREFIX} 74 | download_and_unpack_file ${NETTLE_URL}/${NETTLE_PREFIX}${NETTLE_VERSION}.tar.gz 75 | do_configure "--enable-static --disable-shared --libdir=${PREFIX}/lib --enable-mini-gmp --disable-openssl --disable-documentation" 76 | do_make_and_make_install 77 | 78 | # Build GMP 79 | GMP_URL="https://ftp.jaist.ac.jp/pub/GNU/gmp" 80 | GMP_PREFIX="gmp-" 81 | GMP_VERSION="6.3.0" # get_latest_version ${GMP_URL} ${GMP_PREFIX} 82 | download_and_unpack_file ${GMP_URL}/${GMP_PREFIX}${GMP_VERSION}.tar.xz 83 | do_configure "--enable-static --disable-shared --with-pic" 84 | do_make_and_make_install 85 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-gmp") 86 | 87 | # Build libtasn1 (for gnutls) 88 | LIBTASN1_URL="https://ftp.jaist.ac.jp/pub/GNU/libtasn1" 89 | LIBTASN1_PREFIX="libtasn1-" 90 | LIBTASN1_VERSION="4.19.0" # get_latest_version ${LIBTASN1_URL} ${LIBTASN1_PREFIX} 91 | download_and_unpack_file ${LIBTASN1_URL}/${LIBTASN1_PREFIX}${LIBTASN1_VERSION}.tar.gz 92 | do_configure "--enable-static --disable-shared" 93 | do_make_and_make_install 94 | 95 | # Build libunistring (for gnutls) 96 | LIBUNISTRING_URL="https://ftp.jaist.ac.jp/pub/GNU/libunistring" 97 | LIBUNISTRING_PREFIX="libunistring-" 98 | LIBUNISTRING_VERSION="1.2" # get_latest_version ${LIBUNISTRING_URL} ${LIBUNISTRING_PREFIX} 99 | download_and_unpack_file ${LIBUNISTRING_URL}/${LIBUNISTRING_PREFIX}${LIBUNISTRING_VERSION}.tar.xz 100 | do_configure "--enable-static --disable-shared" 101 | do_make_and_make_install 102 | 103 | # Build libiconv 104 | ICONV_URL="https://ftp.jaist.ac.jp/pub/GNU/libiconv" 105 | ICONV_PREFIX="libiconv-" 106 | ICONV_VERSION="1.17" # get_latest_version ${ICONV_URL} ${ICONV_PREFIX} 107 | download_and_unpack_file ${ICONV_URL}/${ICONV_PREFIX}${ICONV_VERSION}.tar.gz 108 | do_configure "--enable-static --disable-shared --with-pic --enable-extra-encodings" 109 | make install-lib 110 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-iconv") 111 | 112 | # Build GnuTLS 113 | GNUTLS_URL="https://www.gnupg.org/ftp/gcrypt/gnutls" 114 | GNUTLS_PREFIX="gnutls-" 115 | GNUTLS_MAJOR_VERSION="v3.8" 116 | GNUTLS_VERSION="3.8.7.1" # get_latest_version ${GNUTLS_URL} ${GNUTLS_PREFIX} ${GNUTLS_MAJOR_VERSION} 117 | download_and_unpack_file ${GNUTLS_URL}/${GNUTLS_MAJOR_VERSION}/${GNUTLS_PREFIX}${GNUTLS_VERSION}.tar.xz 118 | do_configure "--enable-static --disable-shared --with-pic --disable-tests --disable-doc --disable-tools --without-p11-kit" 119 | do_make_and_make_install 120 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-gnutls") 121 | 122 | # Build SRT 123 | SRT_REPO="https://github.com/Haivision/srt.git" 124 | SRT_TAG_PREFIX="v" 125 | SRT_VERSION="1.5.3" # get_latest_tag ${SRT_REPO} ${SRT_TAG_PREFIX} 126 | git_clone ${SRT_REPO} ${SRT_TAG_PREFIX}${SRT_VERSION} 127 | mkcd build 128 | do_cmake "-DENABLE_SHARED=0 -DENABLE_APPS=0 -DENABLE_CXX_DEPS=1 -DUSE_STATIC_LIBSTDCXX=1 129 | -DENABLE_ENCRYPTION=1 -DUSE_ENCLIB=gnutls" .. 130 | do_make_and_make_install 131 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-libsrt") 132 | 133 | 134 | # 135 | # Image 136 | # 137 | 138 | # Build libpng (for libwebp) 139 | LIBPNG_REPO="https://github.com/glennrp/libpng.git" 140 | LIBPNG_TAG_PREFIX="v" 141 | LIBPNG_VERSION="1.6.44" # get_latest_tag ${LIBPNG_REPO} ${LIBPNG_TAG_PREFIX} 142 | git_clone ${LIBPNG_REPO} ${LIBPNG_TAG_PREFIX}${LIBPNG_VERSION} 143 | do_configure "--enable-static --disable-shared --with-pic" 144 | do_make_and_make_install 145 | 146 | # Build libjpeg (for libwebp) 147 | LIBJPEG_VERSION="9f" 148 | download_and_unpack_file "http://www.ijg.org/files/jpegsrc.v${LIBJPEG_VERSION}.tar.gz" 149 | do_configure "--enable-static --disable-shared --with-pic" 150 | do_make_and_make_install 151 | 152 | # Build openjpeg 153 | OPENJPEG_REPO="https://github.com/uclouvain/openjpeg.git" 154 | OPENJPEG_TAG_PREFIX="v" 155 | OPENJPEG_VERSION="2.5.2" # get_latest_tag ${OPENJPEG_REPO} ${OPENJPEG_TAG_PREFIX} 156 | git_clone ${OPENJPEG_REPO} ${OPENJPEG_TAG_PREFIX}${OPENJPEG_VERSION} 157 | mkcd build 158 | do_cmake "-DBUILD_SHARED_LIBS=0 -DDBUILD_PKGCONFIG_FILES=1 -DBUILD_CODEC=0 -DWITH_ASTYLE=0 -DBUILD_TESTING=0" .. 159 | do_make_and_make_install 160 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-libopenjpeg") 161 | 162 | # Build libwebp 163 | LIBWEBP_REPO="https://chromium.googlesource.com/webm/libwebp.git" 164 | LIBWEBP_TAG_PREFIX="v" 165 | LIBWEBP_VERSION="1.4.0" # get_latest_tag ${LIBWEBP_REPO} ${LIBWEBP_TAG_PREFIX} 166 | git_clone ${LIBWEBP_REPO} ${LIBWEBP_TAG_PREFIX}${LIBWEBP_VERSION} 167 | do_configure "--enable-static --disable-shared --with-pic --enable-libwebpmux --enable-png --enable-jpeg 168 | --disable-libwebpextras --disable-libwebpdemux --disable-sdl --disable-gl --disable-tiff --disable-gif" 169 | do_make_and_make_install 170 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-libwebp") 171 | 172 | 173 | # 174 | # Video 175 | # 176 | 177 | # Build libvpx (Windows-specific configure) 178 | LIBVPX_REPO="https://chromium.googlesource.com/webm/libvpx.git" 179 | LIBVPX_TAG_PREFIX="v" 180 | LIBVPX_VERSION="1.14.1" # get_latest_tag ${LIBVPX_REPO} ${LIBVPX_TAG_PREFIX} 181 | git_clone ${LIBVPX_REPO} ${LIBVPX_TAG_PREFIX}${LIBVPX_VERSION} 182 | CROSS=${CROSS_PREFIX} ./configure --prefix="${PREFIX}" --target=x86_64-win64-gcc --disable-shared \ 183 | --enable-static --enable-pic --disable-examples --disable-tools --disable-docs \ 184 | --disable-unit-tests --enable-vp9-highbitdepth --as=yasm 185 | do_make_and_make_install 186 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-libvpx") 187 | 188 | # Build x264 189 | download_and_unpack_file "https://code.videolan.org/videolan/x264/-/archive/master/x264-master.tar.bz2" 190 | do_configure "--cross-prefix=${CROSS_PREFIX} --disable-shared --enable-static --enable-pic --disable-cli --disable-lavf --disable-swscale" 191 | do_make_and_make_install 192 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-libx264") 193 | 194 | # Build x265 195 | X265_VERSION="3.5" 196 | git_clone "https://bitbucket.org/multicoreware/x265_git" "${X265_VERSION}" 197 | mkcd build 198 | mkdir -p 8bit 10bit 12bit 199 | 200 | cd 12bit 201 | do_cmake "-DHIGH_BIT_DEPTH=1 -DEXPORT_C_API=0 -DENABLE_SHARED=0 -DBUILD_SHARED_LIBS=0 -DENABLE_CLI=0 -DENABLE_TESTS=0 -DMAIN12=1" ../../source 202 | make -j ${CPU_NUM} 203 | cp libx265.a ../8bit/libx265_main12.a 204 | 205 | cd ../10bit 206 | do_cmake "-DHIGH_BIT_DEPTH=1 -DEXPORT_C_API=0 -DENABLE_SHARED=0 -DBUILD_SHARED_LIBS=0 -DENABLE_CLI=0 -DENABLE_TESTS=0" ../../source 207 | make -j ${CPU_NUM} 208 | cp libx265.a ../8bit/libx265_main10.a 209 | 210 | cd ../8bit 211 | do_cmake '-DEXTRA_LIB="x265_main10.a;x265_main12.a" -DEXTRA_LINK_FLAGS=-L. -DLINKED_10BIT=1 -DLINKED_12BIT=1 212 | -DENABLE_SHARED=0 -DBUILD_SHARED_LIBS=0 -DENABLE_CLI=0 -DENABLE_TESTS=0' ../../source 213 | make -j ${CPU_NUM} 214 | 215 | mv libx265.a libx265_main.a 216 | 217 | ar -M < ${PREFIX}/ffmpeg_extra_libs 418 | echo -n "${FFMPEG_CONFIGURE_OPTIONS[@]}" > ${PREFIX}/ffmpeg_configure_options 419 | 420 | 421 | #============================================================================== 422 | # Build FFmpeg 423 | #============================================================================== 424 | 425 | # Build ffmpeg 426 | FFMPEG_VERSION="${FFMPEG_VERSION:-"8.0"}" 427 | git_clone "https://github.com/FFmpeg/FFmpeg.git" n${FFMPEG_VERSION} 428 | 429 | # Configure for Windows 430 | ./configure `cat ${PREFIX}/ffmpeg_configure_options` \ 431 | --arch="x86_64" \ 432 | --cross-prefix="${CROSS_PREFIX}" \ 433 | --disable-autodetect \ 434 | --disable-debug \ 435 | --disable-doc \ 436 | --disable-w32threads \ 437 | --enable-cross-compile \ 438 | --enable-gpl \ 439 | --enable-version3 \ 440 | --extra-libs="-static -Wl,-Bstatic `cat ${PREFIX}/ffmpeg_extra_libs`" \ 441 | --extra-cflags="--static" \ 442 | --target-os="mingw64" \ 443 | --pkg-config="pkg-config" \ 444 | --pkg-config-flags="--static" \ 445 | --prefix=${PREFIX} | tee ${PREFIX}/configure_options 1>&2 446 | 447 | # Build 448 | do_make_and_make_install 449 | do_strip ${PREFIX}/bin "ff*" 450 | 451 | 452 | #============================================================================== 453 | # Finalize - Copy build artifacts to output directory 454 | #============================================================================== 455 | 456 | # Copy library files 457 | cp_archive ${PREFIX}/lib/*{.a,.la} ${ARTIFACT_DIR} 458 | cp_archive ${PREFIX}/lib/pkgconfig ${ARTIFACT_DIR} 459 | cp_archive ${PREFIX}/include ${ARTIFACT_DIR} 460 | 461 | # Copy FFmpeg build options (for reference) 462 | cp_archive ${PREFIX}/ffmpeg_extra_libs ${ARTIFACT_DIR} 463 | cp_archive ${PREFIX}/ffmpeg_configure_options ${ARTIFACT_DIR} 464 | 465 | # Copy FFmpeg binaries and configuration 466 | cp_archive ${PREFIX}/configure_options ${ARTIFACT_DIR} 467 | cp_archive ${PREFIX}/bin/ff* ${ARTIFACT_DIR} 468 | -------------------------------------------------------------------------------- /scripts/linux/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 4 | source ${SCRIPT_DIR}/base.sh 5 | 6 | rm -rf ${ARTIFACT_DIR} 7 | mkdir -p ${RUNTIME_LIB_DIR} 8 | mkdir -p ${ARTIFACT_DIR} 9 | 10 | 11 | #============================================================================== 12 | # Build Libraries 13 | #============================================================================== 14 | 15 | # 16 | # Common library 17 | # 18 | 19 | # Build xorg-macros 20 | XORG_MACROS_REPO="https://gitlab.freedesktop.org/xorg/util/macros.git" 21 | XORG_MACROS_TAG_PREFIX="util-macros-" 22 | XORG_MACROS_VERSION="1.20.1" # get_latest_tag ${XORG_MACROS_REPO} ${XORG_MACROS_TAG_PREFIX} 23 | git_clone ${XORG_MACROS_REPO} ${XORG_MACROS_TAG_PREFIX}${XORG_MACROS_VERSION} ${XORG_MACROS_VERSION} 24 | do_configure 25 | do_make_and_make_install 26 | 27 | # Build zlib 28 | ZLIB_REPO="https://github.com/madler/zlib.git" 29 | ZLIB_TAG_PREFIX="v" 30 | ZLIB_VERSION="1.3.1" # get_latest_tag ${ZLIB_REPO} ${ZLIB_TAG_PREFIX} 31 | git_clone ${ZLIB_REPO} ${ZLIB_TAG_PREFIX}${ZLIB_VERSION} 32 | CC=${CROSS_PREFIX}gcc AR=${CROSS_PREFIX}ar RANLIB=${CROSS_PREFIX}ranlib ./configure --prefix=${PREFIX} --static 33 | do_make_and_make_install 34 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-zlib") 35 | 36 | # Build bzip2 37 | BZIP2_REPO="https://gitlab.com/bzip2/bzip2.git" 38 | BZIP2_TAG_PREFIX="bzip2-" 39 | BZIP2_VERSION="1.0.8" # get_latest_tag ${BZIP2_REPO} ${BZIP2_TAG_PREFIX} 40 | git_clone ${BZIP2_REPO} ${BZIP2_TAG_PREFIX}${BZIP2_VERSION} ${BZIP2_VERSION} 41 | make CC=${CROSS_PREFIX}gcc AR=${CROSS_PREFIX}ar RANLIB=${CROSS_PREFIX}ranlib libbz2.a 42 | install -m 644 bzlib.h ${PREFIX}/include 43 | install -m 644 libbz2.a ${PREFIX}/lib 44 | cat < ${PKG_CONFIG_PATH}/bz2.pc 45 | prefix=${PREFIX} 46 | exec_prefix=\${prefix} 47 | libdir=\${exec_prefix}/lib 48 | includedir=\${prefix}/include 49 | 50 | Name: bzip2 51 | Description: A file compression library 52 | Version: ${BZIP2_VERSION} 53 | 54 | Libs: -L\${libdir} -lbz2 55 | Cflags: -I\${includedir} 56 | EOS 57 | ln -s ${PKG_CONFIG_PATH}/bz2.pc ${PKG_CONFIG_PATH}/bzip2.pc 58 | 59 | # Build lzma 60 | LZMA_REPO="https://github.com/tukaani-project/xz.git" 61 | LZMA_TAG_PREFIX="v" 62 | LZMA_VERSION="5.6.2" # get_latest_tag ${LZMA_REPO} ${LZMA_TAG_PREFIX} 63 | git_clone ${LZMA_REPO} ${LZMA_TAG_PREFIX}${LZMA_VERSION} 64 | ./autogen.sh --no-po4a --no-doxygen 65 | do_configure "--enable-static --disable-shared --with-pic --disable-symbol-versions 66 | --disable-xz --disable-xzdec --disable-lzmadec --disable-lzmainfo --disable-scripts --disable-doc" 67 | do_make_and_make_install 68 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-lzma") 69 | 70 | # Build Nettle (for gmp,gnutls) 71 | NETTLE_URL="https://ftp.jaist.ac.jp/pub/GNU/nettle" 72 | NETTLE_PREFIX="nettle-" 73 | NETTLE_VERSION="3.10" # get_latest_version ${NETTLE_URL} ${NETTLE_PREFIX} 74 | download_and_unpack_file ${NETTLE_URL}/${NETTLE_PREFIX}${NETTLE_VERSION}.tar.gz 75 | do_configure "--enable-static --disable-shared --libdir=${PREFIX}/lib --enable-mini-gmp --disable-openssl --disable-documentation" 76 | do_make_and_make_install 77 | 78 | # Build GMP 79 | GMP_URL="https://ftp.jaist.ac.jp/pub/GNU/gmp" 80 | GMP_PREFIX="gmp-" 81 | GMP_VERSION="6.3.0" # get_latest_version ${GMP_URL} ${GMP_PREFIX} 82 | download_and_unpack_file ${GMP_URL}/${GMP_PREFIX}${GMP_VERSION}.tar.xz 83 | do_configure "--enable-static --disable-shared --with-pic" 84 | do_make_and_make_install 85 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-gmp") 86 | 87 | # Build libtasn1 (for gnutls) 88 | LIBTASN1_URL="https://ftp.jaist.ac.jp/pub/GNU/libtasn1" 89 | LIBTASN1_PREFIX="libtasn1-" 90 | LIBTASN1_VERSION="4.19.0" # get_latest_version ${LIBTASN1_URL} ${LIBTASN1_PREFIX} 91 | download_and_unpack_file ${LIBTASN1_URL}/${LIBTASN1_PREFIX}${LIBTASN1_VERSION}.tar.gz 92 | do_configure "--enable-static --disable-shared" 93 | do_make_and_make_install 94 | 95 | # Build libunistring (for gnutls) 96 | LIBUNISTRING_URL="https://ftp.jaist.ac.jp/pub/GNU/libunistring" 97 | LIBUNISTRING_PREFIX="libunistring-" 98 | LIBUNISTRING_VERSION="1.2" # get_latest_version ${LIBUNISTRING_URL} ${LIBUNISTRING_PREFIX} 99 | download_and_unpack_file ${LIBUNISTRING_URL}/${LIBUNISTRING_PREFIX}${LIBUNISTRING_VERSION}.tar.xz 100 | do_configure "--enable-static --disable-shared" 101 | do_make_and_make_install 102 | 103 | # Build libiconv 104 | ICONV_URL="https://ftp.jaist.ac.jp/pub/GNU/libiconv" 105 | ICONV_PREFIX="libiconv-" 106 | ICONV_VERSION="1.17" # get_latest_version ${ICONV_URL} ${ICONV_PREFIX} 107 | download_and_unpack_file ${ICONV_URL}/${ICONV_PREFIX}${ICONV_VERSION}.tar.gz 108 | do_configure "--enable-static --disable-shared --with-pic --enable-extra-encodings" 109 | make install-lib 110 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-iconv") 111 | 112 | # Build GnuTLS 113 | GNUTLS_URL="https://www.gnupg.org/ftp/gcrypt/gnutls" 114 | GNUTLS_PREFIX="gnutls-" 115 | GNUTLS_MAJOR_VERSION="v3.8" 116 | GNUTLS_VERSION="3.8.7.1" # get_latest_version ${GNUTLS_URL} ${GNUTLS_PREFIX} ${GNUTLS_MAJOR_VERSION} 117 | download_and_unpack_file ${GNUTLS_URL}/${GNUTLS_MAJOR_VERSION}/${GNUTLS_PREFIX}${GNUTLS_VERSION}.tar.xz 118 | do_configure "--enable-static --disable-shared --with-pic --disable-tests --disable-doc --disable-tools --without-p11-kit" 119 | do_make_and_make_install 120 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-gnutls") 121 | 122 | # Build SRT 123 | SRT_REPO="https://github.com/Haivision/srt.git" 124 | SRT_TAG_PREFIX="v" 125 | SRT_VERSION="1.5.3" # get_latest_tag ${SRT_REPO} ${SRT_TAG_PREFIX} 126 | git_clone ${SRT_REPO} ${SRT_TAG_PREFIX}${SRT_VERSION} 127 | mkcd build 128 | do_cmake "-DENABLE_SHARED=0 -DENABLE_APPS=0 -DENABLE_CXX_DEPS=1 -DUSE_STATIC_LIBSTDCXX=1 129 | -DENABLE_ENCRYPTION=1 -DUSE_ENCLIB=gnutls" .. 130 | do_make_and_make_install 131 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-libsrt") 132 | 133 | # Build libpciaccess (Linux only) 134 | LIBPCIACCESS_REPO="https://gitlab.freedesktop.org/xorg/lib/libpciaccess.git" 135 | LIBPCIACCESS_TAG_PREFIX="libpciaccess-" 136 | LIBPCIACCESS_VERSION="0.18.1" # get_latest_tag ${LIBPCIACCESS_REPO} ${LIBPCIACCESS_TAG_PREFIX} 137 | git_clone ${LIBPCIACCESS_REPO} ${LIBPCIACCESS_TAG_PREFIX}${LIBPCIACCESS_VERSION} ${LIBPCIACCESS_VERSION} 138 | mkcd build 139 | do_meson "-Dzlib=enabled" ../ 140 | do_ninja_and_ninja_install 141 | gen_implib ${PREFIX}/lib/{libpciaccess.so.0,libpciaccess.a} 142 | cp_archive ${PREFIX}/lib/libpciaccess.so* ${RUNTIME_LIB_DIR} 143 | rm ${PREFIX}/lib/libpciaccess.so* 144 | 145 | 146 | # 147 | # Image 148 | # 149 | 150 | # Build libpng (for libwebp) 151 | LIBPNG_REPO="https://github.com/glennrp/libpng.git" 152 | LIBPNG_TAG_PREFIX="v" 153 | LIBPNG_VERSION="1.6.44" # get_latest_tag ${LIBPNG_REPO} ${LIBPNG_TAG_PREFIX} 154 | git_clone ${LIBPNG_REPO} ${LIBPNG_TAG_PREFIX}${LIBPNG_VERSION} 155 | do_configure "--enable-static --disable-shared --with-pic" 156 | do_make_and_make_install 157 | 158 | # Build libjpeg (for libwebp) 159 | LIBJPEG_VERSION="9f" 160 | download_and_unpack_file "http://www.ijg.org/files/jpegsrc.v${LIBJPEG_VERSION}.tar.gz" 161 | do_configure "--enable-static --disable-shared --with-pic" 162 | do_make_and_make_install 163 | 164 | # Build openjpeg 165 | OPENJPEG_REPO="https://github.com/uclouvain/openjpeg.git" 166 | OPENJPEG_TAG_PREFIX="v" 167 | OPENJPEG_VERSION="2.5.2" # get_latest_tag ${OPENJPEG_REPO} ${OPENJPEG_TAG_PREFIX} 168 | git_clone ${OPENJPEG_REPO} ${OPENJPEG_TAG_PREFIX}${OPENJPEG_VERSION} 169 | mkcd build 170 | do_cmake "-DBUILD_SHARED_LIBS=0 -DDBUILD_PKGCONFIG_FILES=1 -DBUILD_CODEC=0 -DWITH_ASTYLE=0 -DBUILD_TESTING=0" .. 171 | do_make_and_make_install 172 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-libopenjpeg") 173 | 174 | # Build libwebp 175 | LIBWEBP_REPO="https://chromium.googlesource.com/webm/libwebp.git" 176 | LIBWEBP_TAG_PREFIX="v" 177 | LIBWEBP_VERSION="1.4.0" # get_latest_tag ${LIBWEBP_REPO} ${LIBWEBP_TAG_PREFIX} 178 | git_clone ${LIBWEBP_REPO} ${LIBWEBP_TAG_PREFIX}${LIBWEBP_VERSION} 179 | do_configure "--enable-static --disable-shared --with-pic --enable-libwebpmux --enable-png --enable-jpeg 180 | --disable-libwebpextras --disable-libwebpdemux --disable-sdl --disable-gl --disable-tiff --disable-gif" 181 | do_make_and_make_install 182 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-libwebp") 183 | 184 | 185 | # 186 | # Video 187 | # 188 | 189 | # Build libvpx 190 | LIBVPX_REPO="https://chromium.googlesource.com/webm/libvpx.git" 191 | LIBVPX_TAG_PREFIX="v" 192 | LIBVPX_VERSION="1.14.1" # get_latest_tag ${LIBVPX_REPO} ${LIBVPX_TAG_PREFIX} 193 | git_clone ${LIBVPX_REPO} ${LIBVPX_TAG_PREFIX}${LIBVPX_VERSION} 194 | ./configure --prefix="${PREFIX}" --disable-shared --enable-static --enable-pic --disable-examples \ 195 | --disable-tools --disable-docs --disable-unit-tests --enable-vp9-highbitdepth --as=yasm 196 | do_make_and_make_install 197 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-libvpx") 198 | 199 | # Build x264 200 | download_and_unpack_file "https://code.videolan.org/videolan/x264/-/archive/master/x264-master.tar.bz2" 201 | do_configure "--cross-prefix=${CROSS_PREFIX} --disable-shared --enable-static --enable-pic --disable-cli --disable-lavf --disable-swscale" 202 | do_make_and_make_install 203 | FFMPEG_CONFIGURE_OPTIONS+=("--enable-libx264") 204 | 205 | # Build x265 206 | X265_VERSION="3.5" 207 | git_clone "https://bitbucket.org/multicoreware/x265_git" "${X265_VERSION}" 208 | mkcd build 209 | mkdir -p 8bit 10bit 12bit 210 | 211 | cd 12bit 212 | do_cmake "-DHIGH_BIT_DEPTH=1 -DEXPORT_C_API=0 -DENABLE_SHARED=0 -DBUILD_SHARED_LIBS=0 -DENABLE_CLI=0 -DENABLE_TESTS=0 -DMAIN12=1" ../../source 213 | make -j ${CPU_NUM} 214 | cp libx265.a ../8bit/libx265_main12.a 215 | 216 | cd ../10bit 217 | do_cmake "-DHIGH_BIT_DEPTH=1 -DEXPORT_C_API=0 -DENABLE_SHARED=0 -DBUILD_SHARED_LIBS=0 -DENABLE_CLI=0 -DENABLE_TESTS=0" ../../source 218 | make -j ${CPU_NUM} 219 | cp libx265.a ../8bit/libx265_main10.a 220 | 221 | cd ../8bit 222 | do_cmake '-DEXTRA_LIB="x265_main10.a;x265_main12.a" -DEXTRA_LINK_FLAGS=-L. -DLINKED_10BIT=1 -DLINKED_12BIT=1 223 | -DENABLE_SHARED=0 -DBUILD_SHARED_LIBS=0 -DENABLE_CLI=0 -DENABLE_TESTS=0' ../../source 224 | make -j ${CPU_NUM} 225 | 226 | mv libx265.a libx265_main.a 227 | 228 | ar -M < ${PREFIX}/ffmpeg_extra_libs 515 | echo -n "${FFMPEG_CONFIGURE_OPTIONS[@]}" > ${PREFIX}/ffmpeg_configure_options 516 | 517 | 518 | #============================================================================== 519 | # Build FFmpeg 520 | #============================================================================== 521 | 522 | # Build ffmpeg 523 | FFMPEG_VERSION="${FFMPEG_VERSION:-"8.0"}" 524 | git_clone "https://github.com/FFmpeg/FFmpeg.git" n${FFMPEG_VERSION} 525 | 526 | # Configure for Linux 527 | ./configure `cat ${PREFIX}/ffmpeg_configure_options` \ 528 | --disable-autodetect \ 529 | --disable-debug \ 530 | --disable-doc \ 531 | --enable-gpl \ 532 | --enable-version3 \ 533 | --extra-libs="`cat ${PREFIX}/ffmpeg_extra_libs`" \ 534 | --pkg-config-flags="--static" \ 535 | --prefix=${PREFIX} | tee ${PREFIX}/configure_options 1>&2 536 | 537 | # Build 538 | do_make_and_make_install 539 | do_strip ${PREFIX}/bin "ff*" 540 | 541 | 542 | #============================================================================== 543 | # Finalize - Copy build artifacts to output directory 544 | #============================================================================== 545 | 546 | # Copy library files 547 | cp_archive ${PREFIX}/lib/*{.a,.la} ${ARTIFACT_DIR} 548 | cp_archive ${PREFIX}/lib/pkgconfig ${ARTIFACT_DIR} 549 | cp_archive ${PREFIX}/include ${ARTIFACT_DIR} 550 | 551 | # Copy FFmpeg build options (for reference) 552 | cp_archive ${PREFIX}/ffmpeg_extra_libs ${ARTIFACT_DIR} 553 | cp_archive ${PREFIX}/ffmpeg_configure_options ${ARTIFACT_DIR} 554 | 555 | # Copy FFmpeg binaries and configuration 556 | cp_archive ${PREFIX}/configure_options ${ARTIFACT_DIR} 557 | cp_archive ${PREFIX}/bin/ff* ${ARTIFACT_DIR} 558 | cp_archive ${PREFIX}/bin/vainfo ${ARTIFACT_DIR} 559 | 560 | # Copy runtime libraries 561 | cd ${RUNTIME_LIB_DIR} 562 | cp_archive * ${ARTIFACT_DIR} 563 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------