Skip to content

Commit 1c9a78e

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

1 file changed

Lines changed: 76 additions & 4 deletions

File tree

.github/workflows/ffmpeg.yml

Lines changed: 76 additions & 4 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 }}
@@ -41,20 +47,69 @@ 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
4862
sudo ninja -vC libvmaf/build install
49-
- name: Prepare FFmpeg
63+
- name: Build vmaf (MSVC)
64+
if: matrix.os == 'windows-latest'
65+
run: |
66+
meson setup libvmaf libvmaf/build --buildtype release --default-library static --prefix "C:/vmaf"
67+
meson compile -C libvmaf/build
68+
meson install -C libvmaf/build
69+
- name: Rename static libs to .lib for MSVC
70+
if: matrix.os == 'windows-latest'
71+
shell: pwsh
72+
run: |
73+
Rename-Item -Path C:\vmaf\lib\libpthreadVC3.a -NewName C:\vmaf\lib\pthreadVC3.lib
74+
Rename-Item -Path C:\vmaf\lib\libpthreadVCE3.a -NewName C:\vmaf\lib\pthreadVCE3.lib
75+
Rename-Item -Path C:\vmaf\lib\libpthreadVSE3.a -NewName C:\vmaf\lib\pthreadVSE3.lib
76+
Rename-Item -Path C:\vmaf\lib\libvmaf.a -NewName C:\vmaf\lib\vmaf.lib
77+
- name: Add libvmaf to MSVC paths
78+
if: matrix.os == 'windows-latest'
79+
run: |
80+
echo "INCLUDE=C:/vmaf/include;$env:INCLUDE" >> $env:GITHUB_ENV
81+
echo "LIB=C:/vmaf/lib;$env:LIB" >> $env:GITHUB_ENV
82+
echo "PATH=C:/vmaf/bin;$env:PATH" >> $env:GITHUB_ENV
83+
- name: Add libvmaf to pkg-config path
84+
if: matrix.os == 'windows-latest'
85+
run: |
86+
echo "PKG_CONFIG_PATH=C:/vmaf/lib/pkgconfig;$env:PKG_CONFIG_PATH" >> $env:GITHUB_ENV
87+
- name: Prepare FFmpeg (autotools)
88+
if: matrix.ffmpeg_build == 'autotools'
5089
run: |
5190
git clone -q --branch master --depth=1 "https://github.com/FFmpeg/FFmpeg" ffmpeg
5291
cd ffmpeg
5392
./configure --enable-version3 --enable-libvmaf --disable-indevs --cc="$CC" --cxx="$CXX" || { less ffbuild/config.log; exit 1; }
54-
- name: Make FFmpeg
93+
- name: Make FFmpeg (autotools)
94+
if: matrix.ffmpeg_build == 'autotools'
5595
run: |
5696
sudo make -C ffmpeg --quiet -j $(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu) install
97+
- name: Clone FFmpeg Meson port
98+
if: matrix.ffmpeg_build == 'meson'
99+
run: |
100+
git clone --depth=1 https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg.git ffmpeg-meson
101+
- name: Configure FFmpeg (Meson)
102+
if: matrix.ffmpeg_build == 'meson'
103+
run: |
104+
cd ffmpeg-meson
105+
meson setup build --buildtype release -Dlibvmaf=enabled --prefix "C:/ffmpeg"
106+
- name: Build FFmpeg (Meson)
107+
if: matrix.ffmpeg_build == 'meson'
108+
run: |
109+
meson compile -C ffmpeg-meson/build
110+
meson install -C ffmpeg-meson/build
57111
- name: Test ffmpeg
112+
if: matrix.ffmpeg_build == 'autotools'
58113
run: |
59114
curl "https://gist.githubusercontent.com/1480c1/0c4575da638ef6e8203feffd0597de16/raw/akiyo_cif.tar.xz.base64" | base64 -d | tar xJ
60115
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 +121,21 @@ jobs:
66121
echo "vmaf score matches"
67122
exit 0
68123
fi
69-
continue-on-error: true
124+
- name: Test ffmpeg (MSVC)
125+
if: matrix.ffmpeg_build == 'meson'
126+
shell: pwsh
127+
run: |
128+
curl "https://gist.githubusercontent.com/1480c1/0c4575da638ef6e8203feffd0597de16/raw/akiyo_cif.tar.xz.base64" | base64 -d | tar xJ
129+
$ffmpeg = "C:/ffmpeg/bin/ffmpeg.exe"
130+
$vmaf_score = (& $ffmpeg -hide_banner -nostats -i encoded.mkv -i orig.mkv -filter_complex libvmaf -f null - 2>&1 |
131+
Select-String "VMAF score" |
132+
ForEach-Object { $_.ToString().Split()[-1] }).Trim()
133+
echo "VMAF score: $vmaf_score"
134+
if ($vmaf_score -ne "93.663925") {
135+
echo "vmaf score doesn't match 93.663925"
136+
exit 1
137+
} else {
138+
echo "vmaf score matches"
139+
exit 0
140+
}
141+
continue-on-error: true

0 commit comments

Comments
 (0)