Skip to content

Commit 3d811a9

Browse files
committed
Add ffmpeg windows
1 parent 37aa93e commit 3d811a9

3 files changed

Lines changed: 84 additions & 0 deletions

File tree

.github/scripts/build_ffmpeg.bat

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@echo off
2+
3+
set PROJ_FOLDER=%cd%
4+
5+
choco install -y --no-progress msys2 --package-parameters "/NoUpdate"
6+
C:\tools\msys64\usr\bin\env MSYSTEM=MINGW64 /bin/bash -l -c "pacman -S --noconfirm --needed base-devel mingw-w64-x86_64-toolchain diffutils"
7+
C:\tools\msys64\usr\bin\env MSYSTEM=MINGW64 /bin/bash -l -c "cd ${PROJ_FOLDER} && packaging/vc_env_helper.bat bash .github/scripts/build_ffmpeg.sh"
8+
9+
:end

.github/workflows/ffmpeg.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,37 @@ jobs:
8787
if-no-files-found: error
8888
retention-days: 7
8989
overwrite: true
90+
91+
win-64:
92+
strategy:
93+
fail-fast: false
94+
matrix:
95+
ffmpeg_version: ["4.4.5", "5.1.6", "6.1.2", "7.1.1", "8.0", "master"]
96+
runs-on: windows-latest
97+
steps:
98+
- uses: actions/checkout@v4
99+
with:
100+
persist-credentials: false
101+
102+
- name: Build
103+
shell: bash
104+
run: |
105+
export FFMPEG_VERSION="${{ matrix.ffmpeg_version }}"
106+
export FFMPEG_ROOT="${PWD}/ffmpeg"
107+
108+
.github/scripts/build_ffmpeg.bat
109+
110+
tar -cf ffmpeg.tar.gz ffmpeg/include ffmpeg/lib
111+
112+
artifact_dir="${GITHUB_WORKSPACE}/artifacts/$(date +%Y-%m-%d)/"
113+
mkdir -p "${artifact_dir}"
114+
mv ffmpeg.tar.gz "${artifact_dir}/ffmpeg_${FFMPEG_VERSION}_win64.tar.gz"
115+
116+
- uses: actions/upload-artifact@v4
117+
name: Upload build artifact
118+
with:
119+
name: "ffmpg_${{ matrix.ffmpeg_version }}_windows"
120+
path: "${{ github.workspace }}/artifacts"
121+
if-no-files-found: error
122+
retention-days: 7
123+
overwrite: true

packaging/vc_env_helper.bat

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
@echo on
2+
3+
set VC_VERSION_LOWER=17
4+
set VC_VERSION_UPPER=18
5+
6+
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do (
7+
if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" (
8+
set "VS15INSTALLDIR=%%i"
9+
set "VS15VCVARSALL=%%i\VC\Auxiliary\Build\vcvarsall.bat"
10+
goto vswhere
11+
)
12+
)
13+
14+
:vswhere
15+
if "%VSDEVCMD_ARGS%" == "" (
16+
call "%VS15VCVARSALL%" x64 || exit /b 1
17+
) else (
18+
call "%VS15VCVARSALL%" x64 %VSDEVCMD_ARGS% || exit /b 1
19+
)
20+
21+
@echo on
22+
23+
if "%CU_VERSION%" == "xpu" call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
24+
25+
set DISTUTILS_USE_SDK=1
26+
27+
set args=%1
28+
shift
29+
:start
30+
if [%1] == [] goto done
31+
set args=%args% %1
32+
shift
33+
goto start
34+
35+
:done
36+
if "%args%" == "" (
37+
echo Usage: vc_env_helper.bat [command] [args]
38+
echo e.g. vc_env_helper.bat cl /c test.cpp
39+
)
40+
41+
%args% || exit /b 1

0 commit comments

Comments
 (0)