├── .github └── workflows │ ├── build.yaml │ ├── release.yaml │ ├── settings.yaml │ ├── sync-labels.yaml │ ├── test.yaml │ └── update-issues.yaml ├── .gitignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── SECURITY.md ├── build-matrix.json ├── build-scripts ├── 00-packages.sh ├── 01-libvpx.sh ├── 02-svt-av1.sh ├── 03-x264.sh ├── 04-x265.sh ├── 05-lame.sh ├── 06-opus.sh ├── 07-mbedtls.sh ├── 90-ffmpeg.sh └── 99-check-static.sh ├── build.sh ├── ffmpeg-nvenc-jammy.patch ├── get-version.sh ├── is-alpine.sh └── versions.txt /.github/workflows/build.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # A workflow to build fresh binaries. 16 | # Builds ffmpeg and ffprobe on all OS & CPU combinations, then optionally 17 | # attaches them to a release. 18 | name: Build 19 | 20 | on: 21 | # Runs when called from another workflow, such as the release or test 22 | # workflows. 23 | workflow_call: 24 | inputs: 25 | ref: 26 | required: true 27 | type: string 28 | # If true, start a debug SSH server on failures. 29 | debug: 30 | required: false 31 | type: boolean 32 | default: false 33 | # If true, enable self-hosted runners in the build matrix. 34 | self_hosted: 35 | required: false 36 | type: boolean 37 | default: false 38 | 39 | # Runs on manual trigger. 40 | workflow_dispatch: 41 | inputs: 42 | # If true, start a debug SSH server on failures. 43 | debug: 44 | required: false 45 | type: boolean 46 | default: false 47 | # If true, enable self-hosted runners in the build matrix. 48 | self_hosted: 49 | required: false 50 | type: boolean 51 | default: false 52 | 53 | 54 | # NOTE: The versions of the software we build are stored in versions.txt. 55 | 56 | # By default, run all commands in a bash shell. On Windows, the default would 57 | # otherwise be powershell. Each shell command should begin with "set -e" (to 58 | # make any failed command fail the script immediately) and "set -x" (to log 59 | # what commands are being run). 60 | defaults: 61 | run: 62 | shell: bash 63 | 64 | jobs: 65 | # Configure the build matrix based on inputs. The list of objects in the 66 | # build matrix contents can't be changed by conditionals, but it can be 67 | # computed by another job and deserialized. 68 | matrix_config: 69 | runs-on: ubuntu-latest 70 | outputs: 71 | MATRIX: ${{ steps.configure.outputs.MATRIX }} 72 | steps: 73 | - uses: actions/checkout@v4 74 | with: 75 | path: repo-src 76 | ref: ${{ inputs.ref || github.ref }} 77 | persist-credentials: false 78 | 79 | - name: Configure Build Matrix 80 | id: configure 81 | shell: node {0} 82 | run: | 83 | const fs = require('fs'); 84 | const enableDebug = ${{ inputs.debug }}; 85 | const enableSelfHosted = ${{ inputs.self_hosted }}; 86 | 87 | // Use enableSelfHosted to decide what the build matrix below should 88 | // include. 89 | const buildMatrix = JSON.parse(fs.readFileSync("${{ github.workspace }}/repo-src/build-matrix.json")); 90 | const {hosted, selfHosted} = buildMatrix; 91 | const matrix = enableSelfHosted ? hosted.concat(selfHosted) : hosted; 92 | 93 | // Output a JSON object consumed by the build matrix below. 94 | fs.appendFileSync( 95 | process.env['GITHUB_OUTPUT'], 96 | `MATRIX=${ JSON.stringify(matrix) }\n`); 97 | 98 | // Log the outputs, for the sake of debugging this script. 99 | console.log({enableDebug, enableSelfHosted, matrix}); 100 | 101 | # On several different hosts, build ffmpeg's dependencies, then ffmpeg itself. 102 | # The deps are all built as static libraries. 103 | build: 104 | needs: matrix_config 105 | strategy: 106 | # Let other matrix entries complete, so we have all results on failure 107 | # instead of just the first failure. 108 | fail-fast: false 109 | matrix: 110 | include: ${{ fromJSON(needs.matrix_config.outputs.MATRIX) }} 111 | 112 | name: Build ${{ matrix.os_name }} ${{ matrix.target_arch }} ${{ matrix.container }} 113 | runs-on: ${{ matrix.os }} 114 | container: 115 | image: ${{ matrix.container }} 116 | # Access to the host filesystem is required to patch the environment for 117 | # Alpine Linux support. See the first Alpine step below for details. 118 | volumes: 119 | - /:/host 120 | 121 | steps: 122 | - name: Add msys2 to the Windows path 123 | if: runner.os == 'Windows' 124 | run: | 125 | # At this point, we're running Git Bash. After this step, we will be 126 | # running msys bash, just as we would be when debugging via SSH with 127 | # mxschmitt/action-tmate. 128 | echo "C:\\msys64\\usr\\bin" >> "$GITHUB_PATH" 129 | echo "C:\\msys64\\mingw64\\bin" >> "$GITHUB_PATH" 130 | 131 | # This is how we convince GitHub Actions Runner to run an Alpine Linux 132 | # container. We have to mask the fact that it's Alpine, install NodeJS, 133 | # then patch the Alpine version of NodeJS in over the one that ships with 134 | # GitHub Actions. This is because GitHub doesn't officially support 135 | # Alpine and because they hard-code the path to NodeJS in Node-based 136 | # actions. 137 | # See https://github.com/actions/runner/issues/801#issuecomment-2394425757 138 | - name: Patch native Alpine NodeJS into Runner environment 139 | if: startsWith(matrix.container, 'alpine') 140 | run: | 141 | apk add nodejs 142 | sed -i "s:^ID=alpine:ID=NotpineForGHA:" /etc/os-release 143 | # The first path here is for GitHub-hosted workflows, while the 144 | # second path is correct for our self-hosted workflows using the 145 | # myoung34/github-runner container. The commands that follow this 146 | # are correct so long as one of these paths exists. 147 | cd /host/home/runner/runners/*/externals/ || cd /host/actions-runner/externals 148 | rm -rf node20/* 149 | mkdir node20/bin 150 | ln -s /usr/bin/node node20/bin/node 151 | shell: sh # No bash in Alpine by default 152 | 153 | - name: Install Alpine Linux deps 154 | if: startsWith(matrix.container, 'alpine') 155 | run: apk add bash npm sudo 156 | shell: sh # No bash in Alpine until after this command 157 | 158 | - name: Install Ubuntu Linux deps 159 | if: startsWith(matrix.container, 'ubuntu') 160 | # Sudo is needed by the first build script, but isn't in the default 161 | # container image for Ubuntu. 162 | run: apt -y update && apt -y upgrade && apt -y install sudo 163 | 164 | - uses: actions/checkout@v4 165 | with: 166 | path: repo-src 167 | ref: ${{ inputs.ref || github.ref }} 168 | persist-credentials: false 169 | 170 | - name: Install OS packages 171 | run: ./repo-src/build-scripts/00-packages.sh 172 | 173 | - name: Install libvpx 174 | run: ./repo-src/build-scripts/01-libvpx.sh 175 | 176 | - name: Install SVT-AV1 177 | run: ./repo-src/build-scripts/02-svt-av1.sh 178 | 179 | - name: Install x264 180 | run: ./repo-src/build-scripts/03-x264.sh 181 | 182 | - name: Install x265 183 | run: ./repo-src/build-scripts/04-x265.sh 184 | 185 | - name: Install lame 186 | run: ./repo-src/build-scripts/05-lame.sh 187 | 188 | - name: Install opus 189 | run: ./repo-src/build-scripts/06-opus.sh 190 | 191 | - name: Install mbedtls 192 | run: ./repo-src/build-scripts/07-mbedtls.sh 193 | 194 | - name: Build ffmpeg and ffprobe 195 | run: ./repo-src/build-scripts/90-ffmpeg.sh 196 | 197 | - name: Prepare assets 198 | run: | 199 | set -e 200 | set -x 201 | 202 | mkdir assets 203 | SUFFIX="-${{ matrix.os_name }}-${{ matrix.target_arch }}${{ matrix.exe_ext}}" 204 | echo "SUFFIX=$SUFFIX" >> "$GITHUB_ENV" 205 | cp ffmpeg/ffmpeg assets/ffmpeg"$SUFFIX" 206 | cp ffmpeg/ffprobe assets/ffprobe"$SUFFIX" 207 | 208 | # Show sizes and MD5 sums that can be verified by users later if they 209 | # want to check for authenticity. 210 | cd assets 211 | wc -c * 212 | md5sum * 213 | 214 | # This makes it possible to debug failures in the next step by 215 | # downloading binaries that fail the check for static linkage. 216 | - name: Upload assets as artifacts 217 | uses: actions/upload-artifact@v4 218 | with: 219 | name: binaries${{ env.SUFFIX }} 220 | path: assets/* 221 | 222 | - name: Check that executables are static 223 | run: ./repo-src/build-scripts/99-check-static.sh 224 | 225 | - name: Debug 226 | uses: mxschmitt/action-tmate@v3.6 227 | with: 228 | limit-access-to-actor: true 229 | if: failure() && inputs.debug 230 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # A workflow to build and release fresh binaries. 16 | name: Release 17 | 18 | # Runs when a new tag is created. Creates a release for that tag, then builds 19 | # ffmpeg and ffprobe on all OS & CPU combinations, then attaches them to the 20 | # release. 21 | on: 22 | push: 23 | tags: 24 | - "*" 25 | 26 | # NOTE: Set the repository variable ENABLE_DEBUG to enable debugging via tmate on 27 | # failure. 28 | # NOTE: Set the repository variable ENABLE_SELF_HOSTED to enable self-hosted 29 | # runners such as linux-arm64. This is set on the official repo, but forks 30 | # will have to opt in after setting up their own self-hosted runners. 31 | 32 | jobs: 33 | build: 34 | uses: ./.github/workflows/build.yaml 35 | with: 36 | ref: ${{ github.ref }} 37 | 38 | publish_release: 39 | name: Publish release 40 | needs: [build] 41 | runs-on: ubuntu-latest 42 | permissions: 43 | # "Write" to contents is necessary to create a release. 44 | contents: write 45 | steps: 46 | - uses: actions/checkout@v4 47 | with: 48 | path: repo-src 49 | ref: ${{ github.ref }} 50 | persist-credentials: false 51 | 52 | - uses: actions/download-artifact@v4 53 | with: 54 | path: assets 55 | merge-multiple: true 56 | 57 | - name: Publish release 58 | env: 59 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 60 | run: | 61 | set -e 62 | set -x 63 | 64 | # Compile the release notes (the "body" of the release) with the date 65 | # and the versions of the software we built. 66 | 67 | # The format provided by "date -I" is "YYYY-MM-DD". 68 | echo "Date:" >> body.txt 69 | echo " - $(date -I)" >> body.txt 70 | echo "" >> body.txt 71 | 72 | echo "${{ github.repository }} version:" >> body.txt 73 | echo " - ${{ github.ref_name }}" >> body.txt 74 | echo "" >> body.txt 75 | 76 | echo "Software versions:" >> body.txt 77 | cat repo-src/versions.txt | \ 78 | sed -e 's/^/ - /' >> body.txt 79 | echo "" >> body.txt 80 | 81 | # Add the MD5 sums to the release notes. 82 | echo "MD5 sums:" >> body.txt 83 | (cd assets; md5sum * | sed -e 's/^/ - /') >> body.txt 84 | 85 | # Publish the release, including release notes and assets. 86 | gh release create \ 87 | -R ${{ github.repository }} \ 88 | --verify-tag \ 89 | --notes-file body.txt \ 90 | --title "${{ github.ref_name }}" \ 91 | "${{ github.ref_name }}" \ 92 | assets/* 93 | -------------------------------------------------------------------------------- /.github/workflows/settings.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Google LLC 2 | # 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file or at 5 | # https://developers.google.com/open-source/licenses/bsd 6 | 7 | # A reusable workflow to extract settings from a repository. 8 | # To enable a setting, create a "GitHub Environment" with the same name. 9 | # 10 | # This enables per-repo settings that aren't copied to a fork. This is better 11 | # than "vars" or "secrets", since those would require the use of 12 | # `pull_request_target` instead of `pull_request` triggers, which come with 13 | # additional risks such as the bypassing of "require approval" rules for 14 | # workflows. 15 | # 16 | # Without a setting for flags like "self_hosted", test workflows for a fork 17 | # would time out waiting for self-hosted runners that the fork doesn't have. 18 | name: Settings 19 | 20 | # Runs when called from another workflow. 21 | on: 22 | workflow_call: 23 | outputs: 24 | self_hosted: 25 | description: "Enable jobs requiring a self-hosted runner." 26 | value: ${{ jobs.settings.outputs.self_hosted }} 27 | debug: 28 | description: "Enable SSH debugging when a workflow fails." 29 | value: ${{ jobs.settings.outputs.debug }} 30 | 31 | jobs: 32 | settings: 33 | runs-on: ubuntu-latest 34 | outputs: 35 | self_hosted: ${{ steps.settings.outputs.self_hosted }} 36 | debug: ${{ steps.settings.outputs.debug }} 37 | env: 38 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 39 | steps: 40 | - id: settings 41 | run: | 42 | environments=$(gh api /repos/${{ github.repository }}/environments) 43 | for name in self_hosted debug; do 44 | exists=$(echo $environments | jq ".environments[] | select(.name == \"$name\")") 45 | if [[ "$exists" != "" ]]; then 46 | echo "$name=true" >> $GITHUB_OUTPUT 47 | echo "\"$name\" enabled." 48 | else 49 | echo "$name=" >> $GITHUB_OUTPUT 50 | echo "\"$name\" disabled." 51 | fi 52 | done 53 | -------------------------------------------------------------------------------- /.github/workflows/sync-labels.yaml: -------------------------------------------------------------------------------- 1 | # Install this in .github/workflows/ to automate label updates 2 | name: Sync Labels 3 | 4 | on: 5 | workflow_dispatch: 6 | # Allows for manual triggering. 7 | inputs: 8 | dry_run: 9 | description: "If true, don't make any actual changes" 10 | required: false 11 | default: false 12 | schedule: 13 | # Run every week on Sunday at 5:42 AM. 14 | - cron: '42 5 * * 0' 15 | 16 | jobs: 17 | sync-labels: 18 | runs-on: ubuntu-latest 19 | 20 | permissions: 21 | # "Write" to Issues to manage labels for the repo 22 | issues: write 23 | 24 | steps: 25 | - name: Checkout code 26 | uses: actions/checkout@v4 27 | with: 28 | repository: shaka-project/shaka-github-tools 29 | persist-credentials: false 30 | 31 | # TODO: revert to micnncim and new release after landing 32 | # https://github.com/micnncim/action-label-syncer/pull/68 33 | - uses: joeyparrish/action-label-syncer@v1.8.0 34 | with: 35 | dry_run: ${{ github.event.inputs.dry_run || false }} 36 | prune: true 37 | manifest: sync-labels/configs/${{ github.repository }}.yaml 38 | repository: ${{ github.repository }} 39 | token: ${{ github.token }} 40 | -------------------------------------------------------------------------------- /.github/workflows/test.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # A workflow test PRs by building fresh binaries. 16 | name: Test 17 | 18 | # Runs when a PR is uploaded or revised. Builds ffmpeg and ffprobe on all OS & 19 | # CPU combinations. 20 | on: 21 | pull_request: 22 | types: [opened, synchronize, reopened] 23 | 24 | # If another instance of this workflow is started for the same PR, cancel the 25 | # old one. If a PR is updated and a new test run is started, the old test run 26 | # will be cancelled automatically to conserve resources. 27 | concurrency: 28 | group: ${{ github.workflow }}-${{ github.event.number }} 29 | cancel-in-progress: true 30 | 31 | # NOTE: Create an environment called "debug" to enable debugging via tmate on 32 | # failure. 33 | # NOTE: Create an environment called "self_hosted" to enable self-hosted 34 | # runners from build-matrix.json. 35 | 36 | jobs: 37 | settings: 38 | name: Settings 39 | uses: ./.github/workflows/settings.yaml 40 | 41 | build: 42 | needs: settings 43 | uses: ./.github/workflows/build.yaml 44 | with: 45 | ref: refs/pull/${{ github.event.number }}/merge 46 | self_hosted: ${{ needs.settings.outputs.self_hosted != '' }} 47 | debug: ${{ needs.settings.outputs.debug != '' }} 48 | -------------------------------------------------------------------------------- /.github/workflows/update-issues.yaml: -------------------------------------------------------------------------------- 1 | # Install this in .github/workflows/ to automate issue maintenance. 2 | name: Update Issues 3 | 4 | on: 5 | workflow_dispatch: 6 | # Allows for manual triggering. 7 | schedule: 8 | # Run every 30 minutes 9 | - cron: '*/30 * * * *' 10 | 11 | jobs: 12 | update-issues: 13 | runs-on: ubuntu-latest 14 | 15 | permissions: 16 | # "Write" to Issues to add labels, milestones, comments, etc. 17 | issues: write 18 | # "Write" to Pull Requests for the same. 19 | pull-requests: write 20 | 21 | steps: 22 | - name: Checkout code 23 | uses: actions/checkout@v4 24 | with: 25 | repository: shaka-project/shaka-github-tools 26 | persist-credentials: false 27 | 28 | - name: Update Issues 29 | env: 30 | # Use SHAKA_BOT_TOKEN if found, otherwise the default GITHUB_TOKEN. 31 | GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN || secrets.GITHUB_TOKEN }} 32 | run: | 33 | cd update-issues 34 | npm ci 35 | node main.js 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # These are created if you run the Dockerfile, since we mount this folder as 2 | # the home directory. 3 | .bash_history 4 | .sudo_as_admin_successful 5 | .wget-hsts 6 | 7 | # Editor swap files 8 | *~ 9 | .*.sw* 10 | 11 | # A local build folder 12 | build 13 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # n7.1-1 2 | 3 | - Update FFmpeg to n7.1 (PR #48) 4 | - Upgrade all deps (PR #32) 5 | - Switch from libaom to libsvtav1 (PR #27) 6 | - Stabilize versions of x264, x265 (PR #19) 7 | - Enable Linux hardware encoding with Ubuntu-specific dynamic builds (PR #48, issue #10) 8 | - Fully-static Linux builds based on musl and Alpine Linux (PR #42, issue #28) 9 | - Add macOS arm64 builds (PR #41, issue #40) 10 | 11 | 12 | # n4.4-2 13 | 14 | Fix missing TLS support in FFmpeg and FFprobe (#2, PR #3) 15 | 16 | 17 | # n4.4-1 18 | 19 | Initial release (PR #1) 20 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, caste, color, religion, or sexual 10 | identity and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the overall 26 | community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or advances of 31 | any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email address, 35 | without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official email address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | *shaka-player-maintainers@googlegroups.com*. If for any reason, you are 64 | uncomfortable reaching out to the community leaders, please email 65 | *opensource@google.com*. 66 | All complaints will be reviewed and investigated promptly and fairly. 67 | 68 | All community leaders are obligated to respect the privacy and security of the 69 | reporter of any incident. 70 | 71 | ## Enforcement Guidelines 72 | 73 | Community leaders will follow these Community Impact Guidelines in determining 74 | the consequences for any action they deem in violation of this Code of Conduct: 75 | 76 | ### 1. Correction 77 | 78 | **Community Impact**: Use of inappropriate language or other behavior deemed 79 | unprofessional or unwelcome in the community. 80 | 81 | **Consequence**: A written warning from community leaders, providing 82 | clarity around the nature of the violation and an explanation of why the 83 | behavior was inappropriate. A public apology may be requested. 84 | 85 | ### 2. Warning 86 | 87 | **Community Impact**: A violation through a single incident or series of 88 | actions. 89 | 90 | **Consequence**: A warning with consequences for continued behavior. No 91 | interaction with the people involved, including unsolicited interaction with 92 | those enforcing the Code of Conduct, for a specified period of time. This 93 | includes avoiding interactions in community spaces as well as external channels 94 | like social media. Violating these terms may lead to a temporary or permanent 95 | ban. 96 | 97 | ### 3. Temporary Ban 98 | 99 | **Community Impact**: A serious violation of community standards, including 100 | sustained inappropriate behavior. 101 | 102 | **Consequence**: A temporary ban from any sort of interaction or public 103 | communication with the community for a specified period of time. No public or 104 | private interaction with the people involved, including unsolicited interaction 105 | with those enforcing the Code of Conduct, is allowed during this period. 106 | Violating these terms may lead to a permanent ban. 107 | 108 | ### 4. Permanent Ban 109 | 110 | **Community Impact**: Demonstrating a pattern of violation of community 111 | standards, including sustained inappropriate behavior, harassment of an 112 | individual, or aggression toward or disparagement of classes of individuals. 113 | 114 | **Consequence**: A permanent ban from any sort of public interaction within the 115 | community. 116 | 117 | ## Attribution 118 | 119 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 120 | version 2.1, available at 121 | [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. 122 | 123 | Community Impact Guidelines were inspired by 124 | [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at 128 | [https://www.contributor-covenant.org/translations][translations]. 129 | 130 | [homepage]: https://www.contributor-covenant.org 131 | [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html 132 | [Mozilla CoC]: https://github.com/mozilla/diversity 133 | [FAQ]: https://www.contributor-covenant.org/faq 134 | [translations]: https://www.contributor-covenant.org/translations 135 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # static-ffmpeg-binaries 2 | 3 | Static binaries of FFmpeg, for multiple OS & CPU combinations, built from 4 | source in a GitHub Actions workflow. 5 | 6 | To download binaries, visit the [releases page][releases]. 7 | 8 | 9 | # License 10 | 11 | The GitHub Actions workflows and other scripts in this repo are covered by the 12 | Apache license. 13 | Please see the [workflow source][workflow], [API client source][api-client], 14 | [version script source][version-script], and see [the Apache license][apache] 15 | for license details. 16 | 17 | The resulting FFmpeg binaries are built using GPL libraries, and are therefore 18 | published under the GPL license. 19 | Please see the [releases page][releases] for binaries, and see [FFmpeg's GPL 20 | license][gpl] for license details. 21 | 22 | 23 | # How are they built? 24 | 25 | FFmpeg and its key dependencies are all built from source and linked statically. 26 | Each run of the GitHub Actions workflow logs the MD5 sums of the binaries, and 27 | it places the MD5 sums into the release notes. You can see how they were built, 28 | and you can verify that they haven't been tampered with. The sums in the 29 | workflow logs, release notes, and the binaries should all match. 30 | You can read the details in the [workflow source][workflow]. 31 | 32 | Minimal third-party GitHub Actions have been used in this workflow, to protect 33 | against supply-chain attacks. The following actions are used: 34 | 35 | - mxschmitt/action-tmate: Used only on failure to debug failed builds, and 36 | only if debug is configured at the repo level. 37 | 38 | 39 | # Triggering a build 40 | 41 | Update the version numbers as needed in the [version file][version-file], then 42 | create a tag on the new commit. Full builds will be triggered, and binaries 43 | will be attached to a release on the new tag. 44 | 45 | 46 | # Tag names 47 | 48 | Tag names should follow the form of `$FFMPEG_VERSION-$WORKFLOW_RELEASE_NUMBER`. 49 | For example, the first time we release a build based on FFmpeg n4.4, the tag 50 | should be "n4.4-1". If we need to update the dependencies, or change the 51 | configuration, or make any other changes to the workflow that don't change the 52 | FFmpeg version, the next release would be "n4.4-2". When FFmpeg n4.5 is 53 | released upstream, we could update to that and then tag "n4.5-1". 54 | 55 | 56 | # Local builds 57 | 58 | You can do these steps on your actual device, or on a virtual device or 59 | container to avoid polluting your system. 60 | 61 | 1. Set up a build environment (packages, tools, etc) similar to what is done in 62 | the [workflow source][workflow] for your OS. 63 | 2. If you are using Linux or macOS, run `export SUDO=sudo`. 64 | 3. If you are using Linux, run `export RUNNER_OS=Linux`. 65 | 4. If you are using macOS, run `export RUNNER_OS=macOS`. 66 | 5. If you are using Linux, run `export RUNNER_OS=Windows`. 67 | 6. Set a temp path for `GITHUB_ENV`, for example `export GITHUB_ENV=/tmp/github.env`. 68 | 7. Create a build folder. For example, `mkdir -p build`. It does not need to 69 | be in the git working directory. 70 | 8. Change into that build directory. 71 | 9. Create a symlink to the repo root called `repo-src` to emulate the structure 72 | used by the workflow. For example, if `build` is inside the repo, use 73 | `ln -s ../ repo-src`. 74 | 10. Run the build scripts in [`build-scripts`][] in numerical order. 75 | 76 | 77 | # Docker builds 78 | 79 | You can run the above steps automatically in an Ubuntu Docker container with: 80 | 81 | ```sh 82 | docker build -t static-ffmpeg-binaries /path/to/static-ffmpeg-binaries 83 | docker run -v /path/to/static-ffmpeg-binaries:/src static-ffmpeg-binaries /src/build.sh 84 | ``` 85 | 86 | 87 | [releases]: https://github.com/shaka-project/static-ffmpeg-binaries/releases 88 | [workflow]: https://github.com/shaka-project/static-ffmpeg-binaries/blob/main/.github/workflows/release.yaml 89 | [api-client]: https://github.com/shaka-project/static-ffmpeg-binaries/blob/main/api-client/main.js 90 | [version-script]: https://github.com/shaka-project/static-ffmpeg-binaries/blob/main/get-version.sh 91 | [version-file]: https://github.com/shaka-project/static-ffmpeg-binaries/blob/main/versions.txt 92 | [apache]: https://github.com/shaka-project/static-ffmpeg-binaries/blob/main/LICENSE 93 | [gpl]: https://github.com/FFmpeg/FFmpeg/blob/master/COPYING.GPLv3 94 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | * This repository does not currently maintain release branches. **Only the latest release is supported.** 6 | 7 | * If a security issue is identified in a current release, the fix will trigger a new release from `main`. 8 | 9 | * If a security issue is identified in any release, we will disclose the issue and advise everyone to upgrade to the latest release. 10 | 11 | 12 | ## Reporting a Vulnerability 13 | 14 | Per Google policy, please use https://g.co/vulnz to report security vulnerabilities. Google uses this for intake and triage. For valid issues, we will do coordination and disclosure here on GitHub (including using a GitHub Security Advisory when necessary). 15 | 16 | The Google Security Team will process your report within a day, and respond within a week (although it will depend on the severity of your report). 17 | 18 | 19 | ## Remediation Actions 20 | 21 | * A GitHub issue will be created with the `type: vulnerability` label to coordinate a response. After remediation, we will also use this issue to disclose any details we withheld between receiving the private report and resolving the issue. 22 | 23 | * A GitHub Security Advisory may be created, if appropriate. For example, this would be done if the issue impacts users or dependent projects. This might be skipped for other issues, such as CI workflow vulnerabilities. 24 | 25 | * Vulnerabilities in NPM modules will be reported to NPM so that they show up in `npm audit`. 26 | 27 | 28 | -------------------------------------------------------------------------------- /build-matrix.json: -------------------------------------------------------------------------------- 1 | { 2 | "comment1": "runners hosted by GitHub, always enabled", 3 | "hosted": [ 4 | { 5 | "comment": "Alpine container for static Linux x64 binaries", 6 | "os": "ubuntu-latest", 7 | "container": "alpine:3.20", 8 | "os_name": "linux", 9 | "target_arch": "x64", 10 | "exe_ext": "" 11 | }, 12 | { 13 | "comment": "Ubuntu 24.04 x64 with hardware acceleration", 14 | "os": "ubuntu-latest", 15 | "container": "ubuntu:24.04", 16 | "os_name": "linux", 17 | "target_arch": "x64", 18 | "exe_ext": "-ubuntu-24.04" 19 | }, 20 | { 21 | "comment": "Ubuntu 22.04 x64 with hardware acceleration", 22 | "os": "ubuntu-latest", 23 | "container": "ubuntu:22.04", 24 | "os_name": "linux", 25 | "target_arch": "x64", 26 | "exe_ext": "-ubuntu-22.04" 27 | }, 28 | { 29 | "comment": "Alpine container for static Linux arm64 binaries", 30 | "os": "ubuntu-24.04-arm", 31 | "container": "alpine:3.20", 32 | "os_name": "linux", 33 | "target_arch": "arm64", 34 | "exe_ext": "" 35 | }, 36 | { 37 | "comment": "Ubuntu 24.04 arm64 with hardware acceleration", 38 | "os": "ubuntu-24.04-arm", 39 | "container": "ubuntu:24.04", 40 | "os_name": "linux", 41 | "target_arch": "arm64", 42 | "exe_ext": "-ubuntu-24.04" 43 | }, 44 | { 45 | "comment": "Ubuntu 22.04 arm64 with hardware acceleration", 46 | "os": "ubuntu-24.04-arm", 47 | "container": "ubuntu:22.04", 48 | "os_name": "linux", 49 | "target_arch": "arm64", 50 | "exe_ext": "-ubuntu-22.04" 51 | }, 52 | { 53 | "comment": "Explicit macOS version 13 is required for explicit x64 CPU.", 54 | "os": "macos-13", 55 | "os_name": "osx", 56 | "target_arch": "x64", 57 | "exe_ext": "" 58 | }, 59 | { 60 | "comment": "Latest macOS version is arm64 CPU.", 61 | "os": "macos-latest", 62 | "os_name": "osx", 63 | "target_arch": "arm64", 64 | "exe_ext": "" 65 | }, 66 | { 67 | "os": "windows-latest", 68 | "os_name": "win", 69 | "target_arch": "x64", 70 | "exe_ext": ".exe" 71 | } 72 | ], 73 | 74 | "comment2": "Self-hosted runners are not used since the introduction of GitHub-hosted Linux arm64 runners. The feature still exists if a new platform becomes necessary.", 75 | "selfHosted": [ 76 | ] 77 | } 78 | -------------------------------------------------------------------------------- /build-scripts/00-packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | set -x 19 | 20 | if [[ "$RUNNER_OS" == "Linux" ]]; then 21 | # Install missing packages on Linux. 22 | # 23 | # NOTE: In order to get a musl-based static build, we run our automated 24 | # builds inside an Alpine Linux container, not directly on GitHub's Ubuntu 25 | # VMs. 26 | if repo-src/is-alpine.sh; then 27 | sudo apk update 28 | sudo apk upgrade 29 | sudo apk add \ 30 | cmake \ 31 | curl \ 32 | diffutils \ 33 | g++ \ 34 | git \ 35 | libvdpau-dev \ 36 | linux-headers \ 37 | make \ 38 | nasm \ 39 | patch \ 40 | perl \ 41 | pkgconfig \ 42 | yasm 43 | else 44 | # This can be used by the developer on Ubuntu. The builds may or may not 45 | # work portably on other platforms. 46 | sudo apt -y update 47 | sudo apt -y upgrade 48 | sudo apt -y install \ 49 | clang \ 50 | cmake \ 51 | curl \ 52 | g++ \ 53 | git \ 54 | libffmpeg-nvenc-dev \ 55 | libva-dev \ 56 | make \ 57 | nasm \ 58 | npm \ 59 | pkg-config \ 60 | wget \ 61 | yasm 62 | fi 63 | 64 | # Use sudo in install commands on Linux. 65 | echo "SUDO=sudo" >> "$GITHUB_ENV" 66 | elif [[ "$RUNNER_OS" == "macOS" ]]; then 67 | # Use homebrew to install missing packages on mac. 68 | brew install \ 69 | md5sha1sum \ 70 | nasm \ 71 | yasm 72 | 73 | # Unlink pre-installed homebrew packages that conflict with our static 74 | # library builds below. They are still installed, but will no longer be 75 | # symlinked into default library paths, and the ffmpeg build will not pick up 76 | # pre-installed shared libraries we don't want. Only our static versions 77 | # will be used. The list of preinstalled packages in the GitHub Actions 78 | # environment may change over time, so this list may need to change, as well. 79 | # Ignore errors if one of these is not installed. 80 | for i in \ 81 | aom \ 82 | lame \ 83 | libvpx \ 84 | libx11 \ 85 | libxau \ 86 | libxcb \ 87 | libxdmcp \ 88 | mbedtls \ 89 | opus \ 90 | opusfile \ 91 | svt-av1 \ 92 | x264 \ 93 | x265 \ 94 | xz \ 95 | ; do brew unlink $i &>/dev/null || true; done 96 | 97 | # Use sudo in install commands on macOS. 98 | echo "SUDO=sudo" >> "$GITHUB_ENV" 99 | elif [[ "$RUNNER_OS" == "Windows" ]]; then 100 | # Install msys packages we will need. 101 | # 102 | # NOTE: Add tools to this list if you see errors like 103 | # "shared_info::initialize: size of shared memory region changed". The tools 104 | # reporting such errors need to be explicitly replaced by msys versions. The 105 | # list of preinstalled packages in the GitHub Actions environment may change 106 | # over time, so this list may need to change, as well. 107 | # 108 | # NOTE: pkg-config specifically must be installed because of 109 | # https://github.com/actions/runner-images/issues/5459, in which there is a 110 | # conflicting version that GitHub will not remove. 111 | # 112 | # NOTE: mingw-w64-x86_64-gcc must be installed because of conflicting GCC 113 | # toolchains installed with Strawberry Perl, Git, and one more through 114 | # Chocolatey. None of these build clean executables that only depend on 115 | # standard DLLs. 116 | pacman -Sy --noconfirm \ 117 | diffutils \ 118 | git \ 119 | make \ 120 | mingw-w64-x86_64-gcc \ 121 | nasm \ 122 | patch \ 123 | pkg-config \ 124 | yasm 125 | 126 | # Make sure that cmake generates makefiles and not ninja files. 127 | echo "CMAKE_GENERATOR=MSYS Makefiles" >> "$GITHUB_ENV" 128 | 129 | # Make sure that pkg-config searches the path where we will install things. 130 | echo "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig" >> "$GITHUB_ENV" 131 | fi 132 | -------------------------------------------------------------------------------- /build-scripts/01-libvpx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | set -x 19 | 20 | tag=$(repo-src/get-version.sh libvpx) 21 | git clone --depth 1 https://chromium.googlesource.com/webm/libvpx -b "$tag" 22 | cd libvpx 23 | 24 | # NOTE: disabling unit tests and examples significantly reduces build 25 | # time (by 80% as tested on a Jetson Nano) 26 | # NOTE: --enable-runtime-cpu-detect fails on macOS arm64. 27 | ./configure \ 28 | --enable-vp8 \ 29 | --enable-vp9 \ 30 | --disable-unit-tests \ 31 | --disable-examples \ 32 | --enable-static \ 33 | --disable-shared 34 | 35 | make 36 | $SUDO make install 37 | -------------------------------------------------------------------------------- /build-scripts/02-svt-av1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | set -x 19 | 20 | tag=$(repo-src/get-version.sh svt-av1) 21 | git clone --depth 1 https://gitlab.com/AOMediaCodec/SVT-AV1 -b "$tag" 22 | 23 | mkdir SVT-AV1-build 24 | cd SVT-AV1-build 25 | 26 | # NOTE: without CMAKE_INSTALL_PREFIX on Windows, files are installed 27 | # to c:\Program Files. 28 | cmake ../SVT-AV1 \ 29 | -DCMAKE_INSTALL_PREFIX=/usr/local \ 30 | -DBUILD_SHARED_LIBS=OFF \ 31 | -DBUILD_TESTING=OFF \ 32 | -DCOVERAGE=OFF \ 33 | -DBUILD_APPS=OFF \ 34 | -DREPRODUCIBLE_BUILDS=ON 35 | 36 | make 37 | $SUDO make install 38 | -------------------------------------------------------------------------------- /build-scripts/03-x264.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | set -x 19 | 20 | tag=$(repo-src/get-version.sh x264) 21 | git clone https://code.videolan.org/videolan/x264.git 22 | cd x264 23 | git checkout "$tag" 24 | 25 | # NOTE: disable OpenCL-based features because it uses dlopen and can interfere 26 | # with static builds. 27 | ./configure \ 28 | --disable-opencl \ 29 | --enable-static 30 | 31 | # Only build and install the static library. 32 | make libx264.a 33 | $SUDO make install-lib-static 34 | -------------------------------------------------------------------------------- /build-scripts/04-x265.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | set -x 19 | 20 | tag=$(repo-src/get-version.sh x265) 21 | git clone --depth 1 https://bitbucket.org/multicoreware/x265_git.git -b "$tag" 22 | cd x265_git/build 23 | 24 | # NOTE: without CMAKE_INSTALL_PREFIX on Windows, files are installed 25 | # to c:\Program Files. 26 | cmake ../source \ 27 | -DCMAKE_INSTALL_PREFIX=/usr/local \ 28 | -DENABLE_SHARED=OFF \ 29 | -DENABLE_CLI=OFF 30 | 31 | make 32 | $SUDO make install 33 | 34 | # This adjustment to the x265 linker flags is needed, at least on 35 | # arm, to successfully link against it statically. (-lgcc_s not 36 | # found (or needed), and -lpthread missing) 37 | $SUDO sed -e 's/-lgcc_s -lgcc -lgcc_s -lgcc/-lpthread -lgcc/' -i.bk /usr/local/lib/pkgconfig/x265.pc 38 | -------------------------------------------------------------------------------- /build-scripts/05-lame.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | set -x 19 | 20 | version=$(repo-src/get-version.sh lame) 21 | curl -L -o lame-"$version".tar.gz https://sourceforge.net/projects/lame/files/lame/"$version"/lame-"$version".tar.gz/download 22 | tar xzf lame-"$version".tar.gz 23 | cd lame-"$version" 24 | 25 | # Only build and install the library (--disable-front-end). The 26 | # frontend doesn't build on Windows, and we don't need it anyway. 27 | # On Windows, somehow prefix defaults to / instead of /usr/local, but 28 | # only on some projects. No idea why that is the default on Windows, 29 | # but --prefix=/usr/local fixes it. 30 | ./configure \ 31 | --prefix=/usr/local \ 32 | --disable-frontend \ 33 | --enable-static \ 34 | --disable-shared 35 | 36 | make 37 | $SUDO make install 38 | -------------------------------------------------------------------------------- /build-scripts/06-opus.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | set -x 19 | 20 | tag=$(repo-src/get-version.sh opus) 21 | git clone --depth 1 https://github.com/xiph/opus -b "$tag" 22 | cd opus 23 | 24 | # NOTE: without CMAKE_INSTALL_PREFIX on Windows, files are installed 25 | # to c:\Program Files. 26 | cmake . \ 27 | -DCMAKE_INSTALL_PREFIX=/usr/local \ 28 | -DOPUS_BUILD_SHARED_LIBRARY=OFF \ 29 | -DOPUS_BUILD_FRAMEWORK=OFF \ 30 | -DBUILD_SHARED_LIBS=OFF \ 31 | -DOPUS_BUILD_TESTING=OFF \ 32 | -DBUILD_TESTING=OFF \ 33 | -DOPUS_BUILD_PROGRAMS=OFF 34 | 35 | make 36 | $SUDO make install 37 | -------------------------------------------------------------------------------- /build-scripts/07-mbedtls.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | set -x 19 | 20 | tag=$(repo-src/get-version.sh mbedtls) 21 | git clone --depth 1 https://github.com/ARMmbed/mbedtls.git -b "$tag" 22 | 23 | cd mbedtls 24 | 25 | # Remove some compiler flags that cause build failures on macOS arm64. This 26 | # can't be done through CMake variables, so we have to patch the source. 27 | sed -e 's/-Wdocumentation//' -e 's/-Wno-documentation-deprecated-sync//' \ 28 | -i.bk library/CMakeLists.txt 29 | 30 | # NOTE: without CMAKE_INSTALL_PREFIX on Windows, files are installed 31 | # to c:\Program Files. 32 | cmake . \ 33 | -DCMAKE_INSTALL_PREFIX=/usr/local \ 34 | -DENABLE_PROGRAMS=OFF \ 35 | -DUNSAFE_BUILD=OFF \ 36 | -DGEN_FILES=OFF \ 37 | -DENABLE_TESTING=OFF 38 | 39 | make 40 | $SUDO make install 41 | -------------------------------------------------------------------------------- /build-scripts/90-ffmpeg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | set -x 19 | 20 | tag=$(repo-src/get-version.sh ffmpeg) 21 | git clone --depth 1 https://git.ffmpeg.org/ffmpeg.git -b "$tag" 22 | cd ffmpeg 23 | 24 | # Set some OS-specific environment variables and flags. 25 | if [[ "$RUNNER_OS" == "Linux" ]]; then 26 | if ../repo-src/is-alpine.sh; then 27 | # Truly static builds are only possible in musl-based Alpine Linux. 28 | # Go for a completely static binary, but this prevents the use of hardware 29 | # acceleration. 30 | export CFLAGS="-static" 31 | export LDFLAGS="-static" 32 | else 33 | # We can't build a truly static binary, so we might as well enable hardware 34 | # acceleration, which uses dynamic libraries and will depend heavily on the 35 | # OS distribution. 36 | PLATFORM_CONFIGURE_FLAGS="--enable-vaapi --enable-nvenc" 37 | # TODO: Is AMF an option for us in this context? 38 | 39 | # This version of ffmpeg will accept NVEnc 11.5.1.3+, but not Ubuntu 40 | # 22.04's packaged version, 11.5.1.1. This patch makes it flexible enough 41 | # to build with the older NVEnc version in Ubuntu Jammy. 42 | # For code archaeologists, the commits that set the minimum beyond 11.5.1.1 43 | # were https://github.com/ffmpeg/ffmpeg/commit/5c288a44 (released in n6.0) 44 | # and https://github.com/ffmpeg/ffmpeg/commit/05f8b2ca (released in n6.1). 45 | patch -p1 -i ../repo-src/ffmpeg-nvenc-jammy.patch 46 | fi 47 | elif [[ "$RUNNER_OS" == "macOS" ]]; then 48 | export CFLAGS="-static" 49 | # You can't do a _truly_ static build on macOS except the kernel. 50 | # So don't set LDFLAGS. See https://stackoverflow.com/a/3801032 51 | 52 | # Enable platform-specific hardware acceleration. 53 | PLATFORM_CONFIGURE_FLAGS="--enable-videotoolbox" 54 | 55 | # Disable x86 ASM on macOS. It fails to build with an error about "32-bit 56 | # absolute addressing is not supported in 64-bit mode". I'm not sure how 57 | # else to resolve this, and from my searches, it appears that others are not 58 | # having this problem with ffmpeg. This is still a problem with n7.1 59 | PLATFORM_CONFIGURE_FLAGS="$PLATFORM_CONFIGURE_FLAGS --disable-x86asm --disable-inline-asm" 60 | 61 | # Enable position independent code (PIC). This resolved a crash on arm64. 62 | PLATFORM_CONFIGURE_FLAGS="$PLATFORM_CONFIGURE_FLAGS --enable-pic" 63 | elif [[ "$RUNNER_OS" == "Windows" ]]; then 64 | # /usr/local/incude and /usr/local/lib are not in mingw's include 65 | # and linker paths by default, so add them. 66 | export CFLAGS="-static -I/usr/local/include" 67 | export LDFLAGS="-static -L/usr/local/lib" 68 | 69 | # Convince ffmpeg that we want to build for mingw64 (native 70 | # Windows), not msys (which involves some posix emulation). Since 71 | # we're in an msys environment, ffmpeg reasonably assumes we're 72 | # building for that environment if we don't specify this. 73 | PLATFORM_CONFIGURE_FLAGS="--target-os=mingw64" 74 | fi 75 | 76 | if ! ./configure \ 77 | --pkg-config-flags="--static" \ 78 | --disable-ffplay \ 79 | --enable-libvpx \ 80 | --enable-libsvtav1 \ 81 | --enable-libx264 \ 82 | --enable-libx265 \ 83 | --enable-libmp3lame \ 84 | --enable-libopus \ 85 | --enable-mbedtls \ 86 | --enable-runtime-cpudetect \ 87 | --enable-gpl \ 88 | --enable-version3 \ 89 | --enable-static \ 90 | $PLATFORM_CONFIGURE_FLAGS; then 91 | cat ffbuild/config.log 92 | exit 1 93 | fi 94 | 95 | make 96 | # No "make install" for ffmpeg. 97 | -------------------------------------------------------------------------------- /build-scripts/99-check-static.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | set -x 19 | 20 | cd ffmpeg 21 | 22 | if [[ "$RUNNER_OS" == "Linux" ]]; then 23 | # We only check for static binaries on Alpine Linux. In other distributions, 24 | # these are not possible due to the use of glibc. We allow glibc builds here 25 | # because while tied to the distro, they at least give us the chance for 26 | # hardware encoding. 27 | if ../repo-src/is-alpine.sh; then 28 | # If ldd succeeds, then these are dynamic executables, so we fail 29 | # this step if ldd succeeds. The output of ldd will still be logged. 30 | ldd ffmpeg && exit 1 31 | ldd ffprobe && exit 1 32 | fi 33 | elif [[ "$RUNNER_OS" == "Windows" ]]; then 34 | # These will still be dynamic executables. 35 | # Capture the full list of DLL dependencies. 36 | # With set -x, this also gets logged. 37 | ffmpeg_deps=$(ldd ffmpeg.exe) 38 | ffprobe_deps=$(ldd ffprobe.exe) 39 | 40 | # These should not link against anything outside of /c/Windows. The grep 41 | # command will succeed if it can find anything outside /c/Windows, and then 42 | # we fail if that succeeds. 43 | echo "$ffmpeg_deps" | grep -qvi /c/Windows/ && exit 1 44 | echo "$ffprobe_deps" | grep -qvi /c/Windows/ && exit 1 45 | elif [[ "$RUNNER_OS" == "macOS" ]]; then 46 | # These will still be dynamic executables. 47 | # Capture the full list of dynamic library dependencies. 48 | # With set -x, this also gets logged. 49 | ffmpeg_deps=$(otool -L ffmpeg) 50 | ffprobe_deps=$(otool -L ffprobe) 51 | 52 | # These should not link against anything outside of /usr/lib or 53 | # /System/Library. The grep command will succeed if it can find anything 54 | # outside these two folders, and then we fail if that succeeds. 55 | echo "$ffmpeg_deps" | grep '\t' | grep -Evq '(/System/Library|/usr/lib)' && exit 1 56 | echo "$ffprobe_deps" | grep '\t' | grep -Evq '(/System/Library|/usr/lib)' && exit 1 57 | fi 58 | 59 | # After commands that we expect to fail (greps and ldd commands 60 | # above), we still need a successful command at the end of the script 61 | # to make this step of the workflow a success. 62 | true 63 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # Build everything, assuming we're inside an Ubuntu container. This is useful 18 | # for quick automated builds and for testing build script changes. 19 | 20 | # Build with: 21 | # rm -rf build 22 | # docker run --rm -v $(pwd):/src -w /src ubuntu:24.04 /src/build.sh 23 | # Build outputs are: 24 | # build/ffmpeg/ffmpeg 25 | # build/ffmpeg/ffprobe 26 | 27 | # Fail on error 28 | set -e 29 | # Show commands as they are run 30 | set -x 31 | 32 | if [ ! -e build-scripts ]; then 33 | echo "Must be run from inside the static-ffmpeg-binaries repo." 1>&2 34 | exit 1 35 | fi 36 | 37 | # If run as root in a container, change to the ubuntu user. This script only 38 | # supports Ubuntu as a container, for simplicity. 39 | if [[ $(id -u) == "0" ]]; then 40 | # If we're on Ubuntu before 24.04, there's no default "ubuntu" user. 41 | # Here we add the "ubuntu" group and the "ubuntu" user in that group, 42 | # both with ID 1000. This brings older versions, e.g. Ubuntu 22.04, 43 | # to the starting state of Ubuntu 24.04+. 44 | groupadd -g 1000 ubuntu || true 45 | useradd -u 1000 -g 1000 -m -d /home/ubuntu ubuntu || true 46 | 47 | # Sudo is needed by the first build script, and vim is for interactive 48 | # debugging and editing in the container. 49 | apt -y update && apt -y upgrade && apt -y install vim sudo 50 | 51 | # Make sudo work without a password. 52 | echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers 53 | 54 | # Create build/ and make it owned by ubuntu inside this Docker container, not 55 | # the current user outside Docker. 56 | rm -rf build 57 | mkdir build 58 | chown ubuntu build 59 | 60 | if [ -z "$GITHUB_ENV" ]; then 61 | # Running outside of GitHub Actions? Set these important variables. 62 | export GITHUB_ENV=/tmp/github.env 63 | export SUDO=sudo 64 | export RUNNER_OS=Linux 65 | fi 66 | 67 | # Preserve the environment (-p), which contains important variables like 68 | # RUNNER_OS, etc. 69 | exec su -p ubuntu "$0" "$@" 70 | fi 71 | 72 | # If we are running outside a container, we may not have hit the "root" branch 73 | # above. Create the build/ folder if it doesn't exist. 74 | mkdir -p build 75 | 76 | # Set up the same symlink we get from our GitHub workflow, expected by the 77 | # build scripts. 78 | cd build 79 | ln -s ../ repo-src 80 | 81 | # Run each build script in order. 82 | for SCRIPT in ./repo-src/build-scripts/*; do 83 | "$SCRIPT" || exit 1 84 | done 85 | -------------------------------------------------------------------------------- /ffmpeg-nvenc-jammy.patch: -------------------------------------------------------------------------------- 1 | FFmpeg n7.1 will accept NVEnc 11.5.1.3+, but not Ubuntu 22.04's packaged 2 | version, 11.5.1.1. This patch makes it flexible enough to build with the older 3 | NVEnc version in Ubuntu Jammy. For code archaeologists, the commits that set 4 | the minimum beyond 11.5.1.1 were 5 | https://github.com/ffmpeg/ffmpeg/commit/5c288a44 (released in n6.0) and 6 | https://github.com/ffmpeg/ffmpeg/commit/05f8b2ca (released in n6.1). 7 | 8 | 9 | diff --git a/configure b/configure 10 | index d77a55b653..c28dcffbb0 100755 11 | --- a/configure 12 | +++ b/configure 13 | @@ -6761,7 +6761,7 @@ if ! disabled ffnvcodec; then 14 | ffnv_hdr_list="ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h" 15 | check_pkg_config ffnvcodec "ffnvcodec >= 12.1.14.0" "$ffnv_hdr_list" "" || \ 16 | check_pkg_config ffnvcodec "ffnvcodec >= 12.0.16.1 ffnvcodec < 12.1" "$ffnv_hdr_list" "" || \ 17 | - check_pkg_config ffnvcodec "ffnvcodec >= 11.1.5.3 ffnvcodec < 12.0" "$ffnv_hdr_list" "" || \ 18 | + check_pkg_config ffnvcodec "ffnvcodec >= 11.1.5.1 ffnvcodec < 12.0" "$ffnv_hdr_list" "" || \ 19 | check_pkg_config ffnvcodec "ffnvcodec >= 11.0.10.3 ffnvcodec < 11.1" "$ffnv_hdr_list" "" || \ 20 | check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.15 ffnvcodec < 8.2" "$ffnv_hdr_list" "" 21 | fi 22 | @@ -7388,7 +7388,7 @@ int main(void) { return 0; } 23 | EOF 24 | 25 | if enabled nvenc; then 26 | - check_type "ffnvcodec/nvEncodeAPI.h" "NV_ENC_PIC_PARAMS_AV1" 27 | + check_type "ffnvcodec/nvEncodeAPI.h" "NV_ENC_PIC_PARAMS_AV1" || add_cflags -DJAMMY 28 | fi 29 | 30 | if enabled_any nvdec cuvid; then 31 | diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c 32 | index 3de3847399..0815360a46 100644 33 | --- a/libavutil/hwcontext_cuda.c 34 | +++ b/libavutil/hwcontext_cuda.c 35 | @@ -363,11 +363,13 @@ static int cuda_context_init(AVHWDeviceContext *device_ctx, int flags) { 36 | hwctx->internal->cuda_device)); 37 | if (ret < 0) 38 | return ret; 39 | +#ifndef JAMMY 40 | } else if (flags & AV_CUDA_USE_CURRENT_CONTEXT) { 41 | ret = CHECK_CU(cu->cuCtxGetCurrent(&hwctx->cuda_ctx)); 42 | if (ret < 0) 43 | return ret; 44 | av_log(device_ctx, AV_LOG_INFO, "Using current CUDA context.\n"); 45 | +#endif 46 | } else { 47 | ret = CHECK_CU(cu->cuCtxCreate(&hwctx->cuda_ctx, desired_flags, 48 | hwctx->internal->cuda_device)); 49 | -------------------------------------------------------------------------------- /get-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # Pull a tag or version number from versions.txt. 18 | 19 | # Get the directory this script is in. 20 | dir=$(dirname "$0") 21 | # Get the key we want to look for in versions.txt. 22 | # This is the first (and only) argument to the script. 23 | key="$1" 24 | 25 | # 1. "cat" will output the text file to stdout. 26 | # 2. "grep" will filter for a line that begins with the desired key, 27 | # and only send matching lines to stdout. 28 | # ("^" is the regex character for "beginning of line") 29 | # 3. "sed" will transform the output of grep by removing everything up to 30 | # and including the colon and space characters, leaving only the value 31 | # as output to stdout. 32 | cat "$dir"/versions.txt | grep "^$key:" | sed -e 's/.*: //' 33 | -------------------------------------------------------------------------------- /is-alpine.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright 2024 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # Returns 0 if this is Alpine Linux. 18 | 19 | OS_ID=$(cat /etc/os-release | grep ^ID= | cut -f 2 -d =) 20 | if [ "$OS_ID" = "alpine" -o "$OS_ID" = "NotpineForGHA" ]; then 21 | # It is Alpine or the modified version we have to trick GitHub. 22 | exit 0 23 | fi 24 | 25 | # It is not Alpine. 26 | exit 1 27 | -------------------------------------------------------------------------------- /versions.txt: -------------------------------------------------------------------------------- 1 | ffmpeg: n7.1 2 | libvpx: v1.13.0 3 | svt-av1: v1.7.0 4 | x264: a8b68ebf 5 | x265: 3.5 6 | lame: 3.100 7 | opus: v1.4 8 | mbedtls: v3.4.1 9 | --------------------------------------------------------------------------------