Skip to content

Commit a856506

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

1 file changed

Lines changed: 65 additions & 4 deletions

File tree

.github/workflows/ffmpeg.yml

Lines changed: 65 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,59 @@ 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 ninja nasm meson pkgconfiglite
52+
- name: Setup MSVC
53+
if: matrix.os == 'windows-latest'
54+
uses: ilammy/msvc-dev-cmd@v1
4455
- uses: actions/checkout@v6
45-
- name: Build vmaf
56+
- name: Build vmaf (unix)
57+
if: matrix.os != 'windows-latest'
4658
run: |
4759
meson setup libvmaf libvmaf/build --buildtype release
4860
sudo ninja -vC libvmaf/build install
49-
- name: Prepare FFmpeg
61+
- name: Build vmaf (windows)
62+
if: matrix.os == 'windows-latest'
63+
shell: pwsh
64+
run: |
65+
meson setup libvmaf libvmaf/build --buildtype release --prefix "C:/vmaf"
66+
meson install -C libvmaf/build
67+
- name: Prepare static libs for MSVC
68+
if: matrix.os == 'windows-latest'
69+
shell: pwsh
70+
run: |
71+
Rename-Item -Path C:\vmaf\lib\libpthreadVC3.a -NewName C:\vmaf\lib\pthreadVC3.lib
72+
Rename-Item -Path C:\vmaf\lib\libpthreadVCE3.a -NewName C:\vmaf\lib\pthreadVCE3.lib
73+
Rename-Item -Path C:\vmaf\lib\libpthreadVSE3.a -NewName C:\vmaf\lib\pthreadVSE3.lib
74+
Rename-Item -Path C:\vmaf\lib\libvmaf.a -NewName C:\vmaf\lib\vmaf.lib
75+
echo "INCLUDE=C:/vmaf/include;$env:INCLUDE" >> $env:GITHUB_ENV
76+
echo "LIB=C:/vmaf/lib;$env:LIB" >> $env:GITHUB_ENV
77+
echo "PATH=C:/vmaf/bin;$env:PATH" >> $env:GITHUB_ENV
78+
echo "PKG_CONFIG_PATH=C:/vmaf/lib/pkgconfig;$env:PKG_CONFIG_PATH" >> $env:GITHUB_ENV
79+
- name: Prepare FFmpeg (unix)
80+
if: matrix.os != 'windows-latest'
5081
run: |
5182
git clone -q --branch master --depth=1 "https://github.com/FFmpeg/FFmpeg" ffmpeg
5283
cd ffmpeg
5384
./configure --enable-version3 --enable-libvmaf --disable-indevs --cc="$CC" --cxx="$CXX" || { less ffbuild/config.log; exit 1; }
54-
- name: Make FFmpeg
85+
- name: Prepare FFmpeg (windows)
86+
if: matrix.os == 'windows-latest'
87+
run: |
88+
git clone --depth=1 https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg.git ffmpeg
89+
cd ffmpeg
90+
meson setup build --buildtype release -Dlibvmaf=enabled -Dprograms=enabled --prefix "C:/ffmpeg"
91+
- name: Make FFmpeg (unix)
92+
if: matrix.os != 'windows-latest'
5593
run: |
5694
sudo make -C ffmpeg --quiet -j $(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu) install
57-
- name: Test ffmpeg
95+
- name: Make FFmpeg (windows)
96+
if: matrix.os == 'windows-latest'
97+
run: |
98+
meson install -C ffmpeg/build
99+
- name: Test ffmpeg (unix)
100+
if: matrix.os != 'windows-latest'
58101
run: |
59102
curl "https://gist.githubusercontent.com/1480c1/0c4575da638ef6e8203feffd0597de16/raw/akiyo_cif.tar.xz.base64" | base64 -d | tar xJ
60103
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 +110,21 @@ jobs:
67110
exit 0
68111
fi
69112
continue-on-error: true
113+
- name: Test ffmpeg (MSVC)
114+
if: matrix.os == 'windows-latest'
115+
shell: pwsh
116+
run: |
117+
curl "https://gist.githubusercontent.com/1480c1/0c4575da638ef6e8203feffd0597de16/raw/akiyo_cif.tar.xz.base64" | base64 -d | tar xJ
118+
$ffmpeg = "C:/ffmpeg/bin/ffmpeg.exe"
119+
$vmaf_score = (& $ffmpeg -hide_banner -nostats -i encoded.mkv -i orig.mkv -filter_complex libvmaf -f null - 2>&1 |
120+
Select-String "VMAF score" |
121+
ForEach-Object { $_.ToString().Split()[-1] }).Trim()
122+
echo "VMAF score: $vmaf_score"
123+
if ($vmaf_score -ne "93.663925") {
124+
echo "vmaf score doesn't match 93.663925"
125+
exit 1
126+
} else {
127+
echo "vmaf score matches"
128+
exit 0
129+
}
130+
continue-on-error: true

0 commit comments

Comments
 (0)