Skip to content

Commit 9b01286

Browse files
committed
CI: Add build and test FFmpeg-libvmaf on MSVC
1 parent a861995 commit 9b01286

File tree

1 file changed

+66
-4
lines changed

1 file changed

+66
-4
lines changed

.github/workflows/ffmpeg.yml

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
- os: macos-latest
2020
CC: clang
2121
CXX: clang++
22+
- os: windows-latest
23+
CC: cl
24+
CXX: cl
2225
runs-on: ${{ matrix.os }}
2326
env:
2427
CC: ${{ matrix.CC }}
@@ -29,6 +32,7 @@ jobs:
2932
with:
3033
python-version: 3.11
3134
- name: Install meson and ninja
35+
if: matrix.os != 'windows-latest'
3236
run: |
3337
python -m pip install --upgrade pip
3438
pip install meson
@@ -41,20 +45,60 @@ jobs:
4145
if: matrix.os == 'macos-latest'
4246
run: |
4347
brew install -q ninja nasm
48+
- name: Install dependencies (windows)
49+
if: matrix.os == 'windows-latest'
50+
run: |
51+
choco install -y nasm pkgconfiglite
52+
pip install meson ninja
53+
- name: Setup MSVC
54+
if: matrix.os == 'windows-latest'
55+
uses: ilammy/msvc-dev-cmd@v1
4456
- uses: actions/checkout@v6
45-
- name: Build vmaf
57+
- name: Build vmaf (unix)
58+
if: matrix.os != 'windows-latest'
4659
run: |
4760
meson setup libvmaf libvmaf/build --buildtype release
4861
sudo ninja -vC libvmaf/build install
49-
- name: Prepare FFmpeg
62+
- name: Build vmaf (windows)
63+
if: matrix.os == 'windows-latest'
64+
shell: pwsh
65+
run: |
66+
meson setup libvmaf libvmaf/build --buildtype release --default-library static --prefix "C:/vmaf"
67+
meson install -C libvmaf/build
68+
- name: Prepare static libs for MSVC
69+
if: matrix.os == 'windows-latest'
70+
shell: pwsh
71+
run: |
72+
Rename-Item -Path C:\vmaf\lib\libpthreadVC3.a -NewName C:\vmaf\lib\pthreadVC3.lib
73+
Rename-Item -Path C:\vmaf\lib\libpthreadVCE3.a -NewName C:\vmaf\lib\pthreadVCE3.lib
74+
Rename-Item -Path C:\vmaf\lib\libpthreadVSE3.a -NewName C:\vmaf\lib\pthreadVSE3.lib
75+
Rename-Item -Path C:\vmaf\lib\libvmaf.a -NewName C:\vmaf\lib\vmaf.lib
76+
echo "INCLUDE=C:/vmaf/include;$env:INCLUDE" >> $env:GITHUB_ENV
77+
echo "LIB=C:/vmaf/lib;$env:LIB" >> $env:GITHUB_ENV
78+
echo "PATH=C:/vmaf/bin;$env:PATH" >> $env:GITHUB_ENV
79+
echo "PKG_CONFIG_PATH=C:/vmaf/lib/pkgconfig;$env:PKG_CONFIG_PATH" >> $env:GITHUB_ENV
80+
- name: Prepare FFmpeg (unix)
81+
if: matrix.os != 'windows-latest'
5082
run: |
5183
git clone -q --branch master --depth=1 "https://github.com/FFmpeg/FFmpeg" ffmpeg
5284
cd ffmpeg
5385
./configure --enable-version3 --enable-libvmaf --disable-indevs --cc="$CC" --cxx="$CXX" || { less ffbuild/config.log; exit 1; }
54-
- name: Make FFmpeg
86+
- name: Prepare FFmpeg (windows)
87+
if: matrix.os == 'windows-latest'
88+
run: |
89+
git clone --depth=1 https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg.git ffmpeg
90+
cd ffmpeg
91+
meson setup build --buildtype release -Dlibvmaf=enabled -Dprograms=enabled --prefix "C:/ffmpeg"
92+
- name: Make FFmpeg (unix)
93+
if: matrix.os != 'windows-latest'
5594
run: |
5695
sudo make -C ffmpeg --quiet -j $(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu) install
57-
- name: Test ffmpeg
96+
- name: Make FFmpeg (windows)
97+
if: matrix.os == 'windows-latest'
98+
run: |
99+
meson install -C ffmpeg/build
100+
- name: Test ffmpeg (unix)
101+
if: matrix.os != 'windows-latest'
58102
run: |
59103
curl "https://gist.githubusercontent.com/1480c1/0c4575da638ef6e8203feffd0597de16/raw/akiyo_cif.tar.xz.base64" | base64 -d | tar xJ
60104
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)
@@ -67,3 +111,21 @@ jobs:
67111
exit 0
68112
fi
69113
continue-on-error: true
114+
- name: Test ffmpeg (MSVC)
115+
if: matrix.os == 'windows-latest'
116+
shell: pwsh
117+
run: |
118+
curl "https://gist.githubusercontent.com/1480c1/0c4575da638ef6e8203feffd0597de16/raw/akiyo_cif.tar.xz.base64" | base64 -d | tar xJ
119+
$ffmpeg = "C:/ffmpeg/bin/ffmpeg.exe"
120+
$vmaf_score = (& $ffmpeg -hide_banner -nostats -i encoded.mkv -i orig.mkv -filter_complex libvmaf -f null - 2>&1 |
121+
Select-String "VMAF score" |
122+
ForEach-Object { $_.ToString().Split()[-1] }).Trim()
123+
echo "VMAF score: $vmaf_score"
124+
if ($vmaf_score -ne "93.663925") {
125+
echo "vmaf score doesn't match 93.663925"
126+
exit 1
127+
} else {
128+
echo "vmaf score matches"
129+
exit 0
130+
}
131+
continue-on-error: true

0 commit comments

Comments
 (0)