Skip to content

Commit d09bdc5

Browse files
committed
CI: Add build and test FFmpeg+libvmaf on Windows (MSVC)
1 parent a861995 commit d09bdc5

1 file changed

Lines changed: 74 additions & 5 deletions

File tree

.github/workflows/ffmpeg.yml

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ jobs:
1616
- os: ubuntu-latest
1717
CC: gcc
1818
CXX: g++
19+
ffmpeg_build: autotools
1920
- os: macos-latest
2021
CC: clang
2122
CXX: clang++
23+
ffmpeg_build: autotools
24+
- os: windows-latest
25+
CC: cl
26+
CXX: cl
27+
ffmpeg_build: meson
2228
runs-on: ${{ matrix.os }}
2329
env:
2430
CC: ${{ matrix.CC }}
@@ -31,7 +37,7 @@ jobs:
3137
- name: Install meson and ninja
3238
run: |
3339
python -m pip install --upgrade pip
34-
pip install meson
40+
pip install meson ninja
3541
- name: Install dependencies (ubuntu)
3642
if: matrix.os == 'ubuntu-latest'
3743
run: |
@@ -41,20 +47,70 @@ jobs:
4147
if: matrix.os == 'macos-latest'
4248
run: |
4349
brew install -q ninja nasm
50+
- name: Setup MSVC
51+
if: matrix.os == 'windows-latest'
52+
uses: ilammy/msvc-dev-cmd@v1
4453
- uses: actions/checkout@v6
45-
- name: Build vmaf
54+
- name: Install pkg-config (Windows)
55+
if: matrix.os == 'windows-latest'
56+
run: |
57+
choco install pkgconfiglite -y
58+
- name: Build vmaf (unix)
59+
if: matrix.os != 'windows-latest'
4660
run: |
4761
meson setup libvmaf libvmaf/build --buildtype release
62+
meson compile -C libvmaf/build
4863
sudo ninja -vC libvmaf/build install
49-
- name: Prepare FFmpeg
64+
- name: Build vmaf (MSVC)
65+
if: matrix.os == 'windows-latest'
66+
run: |
67+
meson setup libvmaf libvmaf/build --buildtype release --default-library static --prefix "C:/vmaf"
68+
meson compile -C libvmaf/build
69+
meson install -C libvmaf/build
70+
- name: Rename static libs to .lib for MSVC
71+
if: matrix.os == 'windows-latest'
72+
shell: pwsh
73+
run: |
74+
Rename-Item -Path C:\vmaf\lib\libpthreadVC3.a -NewName libpthreadVC3.lib
75+
Rename-Item -Path C:\vmaf\lib\libpthreadVCE3.a -NewName libpthreadVCE3.lib
76+
Rename-Item -Path C:\vmaf\lib\libpthreadVSE3.a -NewName libpthreadVSE3.lib
77+
Rename-Item -Path C:\vmaf\lib\libvmaf.a -NewName libvmaf.lib
78+
- name: Add libvmaf to MSVC paths
79+
if: matrix.os == 'windows-latest'
80+
run: |
81+
echo "INCLUDE=C:/vmaf/include;$env:INCLUDE" >> $env:GITHUB_ENV
82+
echo "LIB=C:/vmaf/lib;$env:LIB" >> $env:GITHUB_ENV
83+
echo "PATH=C:/vmaf/bin;$env:PATH" >> $env:GITHUB_ENV
84+
- name: Add libvmaf to pkg-config path
85+
if: matrix.os == 'windows-latest'
86+
run: |
87+
echo "PKG_CONFIG_PATH=C:/vmaf/lib/pkgconfig;$env:PKG_CONFIG_PATH" >> $env:GITHUB_ENV
88+
- name: Prepare FFmpeg (autotools)
89+
if: matrix.ffmpeg_build == 'autotools'
5090
run: |
5191
git clone -q --branch master --depth=1 "https://github.com/FFmpeg/FFmpeg" ffmpeg
5292
cd ffmpeg
5393
./configure --enable-version3 --enable-libvmaf --disable-indevs --cc="$CC" --cxx="$CXX" || { less ffbuild/config.log; exit 1; }
54-
- name: Make FFmpeg
94+
- name: Make FFmpeg (autotools)
95+
if: matrix.ffmpeg_build == 'autotools'
5596
run: |
5697
sudo make -C ffmpeg --quiet -j $(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu) install
98+
- name: Clone FFmpeg Meson port
99+
if: matrix.ffmpeg_build == 'meson'
100+
run: |
101+
git clone --depth=1 https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg.git ffmpeg-meson
102+
- name: Configure FFmpeg (Meson)
103+
if: matrix.ffmpeg_build == 'meson'
104+
run: |
105+
cd ffmpeg-meson
106+
meson setup build --buildtype release -Dlibvmaf=enabled
107+
- name: Build FFmpeg (Meson)
108+
if: matrix.ffmpeg_build == 'meson'
109+
run: |
110+
meson compile -C ffmpeg-meson/build
111+
meson install -C ffmpeg-meson/build
57112
- name: Test ffmpeg
113+
if: matrix.ffmpeg_build == 'autotools'
58114
run: |
59115
curl "https://gist.githubusercontent.com/1480c1/0c4575da638ef6e8203feffd0597de16/raw/akiyo_cif.tar.xz.base64" | base64 -d | tar xJ
60116
vmaf_score=$(ffmpeg -hide_banner -nostats -i encoded.mkv -i orig.mkv -filter_complex libvmaf -f null - 2>&1 | grep 'VMAF score' | tr ' ' '\n' | tail -n1)
@@ -66,4 +122,17 @@ jobs:
66122
echo "vmaf score matches"
67123
exit 0
68124
fi
69-
continue-on-error: true
125+
- name: Test ffmpeg (MSVC)
126+
if: matrix.ffmpeg_build == 'meson'
127+
run: |
128+
curl "https://gist.githubusercontent.com/1480c1/0c4575da638ef6e8203feffd0597de16/raw/akiyo_cif.tar.xz.base64" | base64 -d | tar xJ
129+
vmaf_score=$("C:/Program Files/ffmpeg/bin/ffmpeg.exe" -hide_banner -nostats -i encoded.mkv -i orig.mkv -filter_complex libvmaf -f null - 2>&1 | Select-String "VMAF score" | ForEach-Object { $_.ToString().Split()[-1] })
130+
echo $vmaf_score
131+
if ($vmaf_score -ne "93.663925") {
132+
echo "vmaf score doesn't match 93.663925"
133+
exit 1
134+
} else {
135+
echo "vmaf score matches"
136+
exit 0
137+
}
138+
continue-on-error: true

0 commit comments

Comments
 (0)