Skip to content

Build FFmpeg (GPL) #257

Build FFmpeg (GPL)

Build FFmpeg (GPL) #257

Workflow file for this run

name: 'Build FFmpeg (GPL)'
on:
workflow_dispatch:
inputs:
system:
type: choice
required: true
default: 'windows-2022'
description: 'System'
options:
- windows-2022
type:
type: choice
required: true
default: 'static'
description: Type
options:
- static
- shared
config:
type: choice
required: true
default: 'release'
description: 'Configuration'
options:
- debug
- release
ffmpegRef:
type: string
required: true
default: 'release/6.0'
description: 'FFmpeg refId'
workflow_call:
inputs:
system:
type: string
required: true
type:
type: string
required: true
config:
type: string
required: true
ffmpegRef:
type: string
required: true
env:
vsPath: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\
COMPONENTS: "--enable-libvpl --enable-libsvtav1 --enable-libsnappy --enable-libmp3lame --enable-libzimg --enable-libvorbis --enable-libopus --enable-libvpx --enable-libx264 --enable-libx265 --enable-libfdk-aac"
NASM_EXECUTABLE: nasm
cFlags: ${{ inputs.config == 'release' && '-MD' || '-MDd' }}
variant: ${{ inputs.type == 'static' && ' --pkg-config-flags="--static" --disable-shared --enable-static' || ' --disable-static --enable-shared' }}
msbuildConfig: ${{ inputs.config == 'release' && 'Release' || 'Debug' }}
jobs:
libvpl:
runs-on: ${{ inputs.system }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/libvpl
with:
refId: v2023.3.1
config: ${{ inputs.config }}
liboggvorbis:
runs-on: ${{ inputs.system }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/liboggvorbis
with:
libogg_refId: v1.3.5
libvorbis_refId: v1.3.7
config: ${{ inputs.config }}
libsvtav1:
runs-on: ${{ inputs.system }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/libsvtav1
with:
refId: v1.7.0
config: ${{ inputs.config }}
libsnappy:
runs-on: ${{ inputs.system }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/libsnappy
with:
refId: 1.1.10
config: ${{ inputs.config }}
libvpx:
runs-on: ${{ inputs.system }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/libvpx
with:
refId: v1.13.0
config: ${{ inputs.config }}
libmp3lame:
runs-on: ${{ inputs.system }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/libmp3lame
with:
refId: tags/RELEASE__3_100
config: ${{ inputs.config }}
libzimg:
runs-on: ${{ inputs.system }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/libzimg
with:
refId: release-3.0.5
config: ${{ inputs.config }}
libopus:
runs-on: ${{ inputs.system }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/libopus
with:
refId: v1.4
config: ${{ inputs.config }}
libfdkaac:
runs-on: ${{ inputs.system }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/libfdkaac
with:
refId: v2.0.2
config: ${{ inputs.config }}
libx264:
runs-on: ${{ inputs.system }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/libx264
with:
refId: stable
config: ${{ inputs.config }}
libx265-12:
runs-on: ${{ inputs.system }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/libx265-12
with:
refId: Release_3.5
config: ${{ inputs.config }}
libx265-10:
runs-on: ${{ inputs.system }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/libx265-10
with:
refId: Release_3.5
config: ${{ inputs.config }}
libx265:
runs-on: ${{ inputs.system }}
needs: [libx265-12,libx265-10]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/libx265
with:
refId: Release_3.5
config: ${{ inputs.config }}
ffmpeg:
runs-on: ${{ inputs.system }}
needs: [libvpl,libsvtav1,libsnappy,libvpx,libmp3lame,libzimg,liboggvorbis,libopus,libfdkaac,libx264,libx265]
steps:
- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
install: base-devel binutils mingw-w64-x86_64-cmake nasm
path-type: inherit
- name: Set up GIT
run: |
git config --global core.autocrlf false
git config --global core.eol lf
git config --global user.email "daniel.stankewitz@gmail.com"
git config --global user.name "Daniel Stankewitz"
- name: Checkout patches
uses: actions/checkout@v3.0.0
- name: Checkout FFmpeg
uses: actions/checkout@v3.0.0
with:
repository: FFmpeg/FFmpeg.git
ref: ${{ inputs.ffmpegRef }}
path: ffmpeg
- name: Checkout NvEnc
uses: actions/checkout@v3.0.0
with:
repository: FFmpeg/nv-codec-headers
ref: master
path: nvenc
- name: Checkout AMF
uses: actions/checkout@v3.0.0
with:
repository: GPUOpen-LibrariesAndSDKs/AMF
ref: master
path: amf
- name: Set up artifacts
uses: actions/download-artifact@v3
with:
path: build_artifacts
- name: Build FFmpeg
shell: cmd
run: |
call "${{ env.vsPath }}VC\Auxiliary\Build\vcvars64.bat"
md build dist
D:\a\_temp\setup-msys2\msys2.cmd -c 'cd ffmpeg ; git apply --ignore-whitespace ../libfdkaac.patch ; cd ../build ; for file in `ls ../build_artifacts/**/*.tgz`; do tar -xzf $file; done ; rm -f bin/*.dll ; cd ../nvenc ; make PREFIX=../build install ; cp -a ../amf/amf/public/include ../build/include/AMF ; cd ../ffmpeg ; PKG_CONFIG_PATH=../build/lib/pkgconfig ./configure --toolchain=msvc --extra-cflags="${{ env.cFlags }} -I../build/include" --extra-ldflags="-LIBPATH:../build/lib" --prefix=../build --extra-libs=Ole32.lib --extra-libs=Advapi32.lib --disable-doc ${{ env.variant }} --enable-runtime-cpudetect --enable-w32threads --enable-gpl ${{ env.COMPONENTS }} ; make -j 2 ; make install ; cd ../build/lib ; for file in *.a; do mv "$file" "`basename "$file" .a`.lib" ; done ; rm -rf fdk-aac.lib cmake pkgconfig *.la ../share ; cd .. ; tar czf ../dist/ffmpeg-win64-${{ inputs.type }}-${{ inputs.config }}.tar.gz *'
- name: Publish FFmpeg artifacts
uses: actions/upload-artifact@v3
with:
name: FFmpeg ${{ inputs.system }} ${{ inputs.config }}${{ inputs.config }} package build
path: dist/ffmpeg-win64-${{ inputs.type }}-${{ inputs.config }}.tar.gz