-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
501 lines (453 loc) · 15.3 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
# syntax=docker/dockerfile:1
#
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(©) 2024 Intel Corporation
# Intel® Tiber™ Broadcast Suite
#
# build stage
ARG IMAGE_CACHE_REGISTRY=docker.io
FROM ${IMAGE_CACHE_REGISTRY}/library/ubuntu:22.04 AS buildstage
ARG nproc=100
# common env
ENV \
nproc=$nproc \
DEBIAN_FRONTEND="noninteractive" \
MAKEFLAGS=-j${nproc}
# versions
ENV \
GMMLIB=22.3.12 \
IHD=23.3.5 \
LIBMFX=22.5.4 \
LIBVA=2.20.0 \
LIBVMAF=2.3.1 \
LIBVPL=2023.3.1 \
ONEVPL=23.3.4 \
SVTAV1=1.7.0 \
VULKANSDK=vulkan-sdk-1.3.268.0 \
VSR=v23.11 \
CARTWHEEL_COMMIT_ID=6.1 \
FFMPEG_COMMIT_ID=n6.1.1 \
XDP_VER=d7edea3590052581c5fda5f8cfa40ae7be94f05c \
BPF_VER=42065ea6627ff6e1ab4c65e51042a70fbf30ff7c \
MTL_VER=MTL_enabling_for_Intel_Tiber_Broadcast_Suite \
MCM_VER=24.06.01 \
JPEG_XS_VER=0.9.0 \
DPDK_VER=23.11
SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"]
# Install dependencies
RUN \
echo "**** INSTALL BUILD PACKAGES ****" && \
apt-get update --fix-missing && \
apt-get full-upgrade -y && \
apt-get install --no-install-recommends -y \
ca-certificates \
build-essential \
libarchive-tools \
libnuma-dev \
libjson-c-dev \
libpcap-dev \
libgtest-dev \
libsdl2-dev \
libsdl2-ttf-dev \
libssl-dev \
libtool \
libx11-dev \
libx11-xcb-dev \
libwayland-dev \
libxcb-dri3-dev \
libxcb-present-dev \
libxext-dev \
libxfixes-dev \
libxml2-dev \
libdrm-dev \
librdmacm-dev \
zlib1g-dev \
libelf-dev \
git \
cmake \
meson \
m4 \
clang \
llvm \
curl \
g++ \
nasm \
autoconf \
automake \
pkg-config \
diffutils \
gcc \
xxd \
wget \
zip \
python3-pyelftools \
systemtap-sdt-dev \
sudo \
libbsd-dev \
ocl-icd-opencl-dev \
libcap2-bin && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /tmp/libva
RUN \
echo "**** DOWNLOAD LIBVA ****" && \
curl -Lf \
https://github.com/intel/libva/archive/${LIBVA}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/libva
RUN \
echo "**** BUILD LIBVA ****" && \
meson setup build --strip -Dprefix=/usr -Dlibdir=/usr/lib/x86_64-linux-gnu -Ddefault_library=shared && \
ninja -j${nproc} -C build && \
meson install -C build && \
strip -d "/usr/lib/x86_64-linux-gnu/libva"*.so
WORKDIR /tmp/gmmlib/build
RUN \
echo "**** DOWNLOAD and BUILD GMMLIB ****" && \
curl -Lf \
https://github.com/intel/gmmlib/archive/refs/tags/intel-gmmlib-${GMMLIB}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/gmmlib && \
cmake \
-DCMAKE_BUILD_TYPE=Release .. && \
make && \
make install && \
strip -d /usr/local/lib/libigdgmm.so
WORKDIR /tmp/ihd/build
RUN \
echo "**** DOWNLOAD and BUILD IHD ****" && \
curl -Lf \
https://github.com/intel/media-driver/archive/refs/tags/intel-media-${IHD}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/ihd && \
cmake \
-DLIBVA_INSTALL_PATH=/usr/lib/x86_64-linux-gnu \
-DLIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri/ .. && \
make && \
make install && \
strip -d /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
WORKDIR /tmp/libvpl/build
RUN \
echo "**** DOWNLOAD and BUILD LIBVPL ****" && \
curl -Lf \
https://github.com/oneapi-src/oneVPL/archive/refs/tags/v${LIBVPL}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/libvpl && \
cmake \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=/usr/lib/x86_64-linux-gnu \
.. && \
cmake --build . --config Release && \
cmake --build . --config Release --target install && \
strip -d /usr/lib/x86_64-linux-gnu/libvpl.so
COPY /patches /tmp/patches
WORKDIR /tmp/onevpl/build
RUN \
echo "**** DOWNLOAD and PATCH ONEVPL ****" && \
curl -Lf \
https://github.com/oneapi-src/oneVPL-intel-gpu/archive/refs/tags/intel-onevpl-${ONEVPL}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/onevpl && \
git -C /tmp/onevpl apply /tmp/patches/onevpl/*.patch
RUN \
echo "**** BUILD ONEVPL ****" && \
cmake \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=/usr/lib/x86_64-linux-gnu .. && \
make && \
make install && \
strip -d /usr/lib/x86_64-linux-gnu/libmfx-gen.so
WORKDIR /tmp/vmaf/libvmaf
RUN \
echo "**** DOWNLOAD VMAF ****" && \
curl -Lf \
https://github.com/Netflix/vmaf/archive/refs/tags/v${LIBVMAF}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/vmaf && \
meson setup \
--prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu \
--buildtype release build && \
ninja -j${nproc} -vC build && \
ninja -j${nproc} -vC build install
WORKDIR /tmp/svt-av1/Build
RUN \
echo "**** DOWNLOAD SVT-AV1 ****" && \
curl -Lf \
https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v${SVTAV1}/SVT-AV1-v${SVTAV1}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/svt-av1
RUN \
echo "**** BUILD SVT-AV1 ****" && \
cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release && \
make && \
make install
WORKDIR /tmp/vulkan-headers
RUN \
echo "**** DOWNLOAD VULKAN HEADERS ****" && \
curl -Lf \
https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/${VULKANSDK}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/vulkan-headers
RUN \
echo "**** BUILD VULKAN HEADERS ****" && \
cmake -S . -B build/ && \
cmake --install build --prefix /usr/local
WORKDIR /tmp/Media-Transport-Library
RUN \
echo "**** DOWNLOAD MTL ****" && \
curl -Lf \
https://github.com/OpenVisualCloud/Media-Transport-Library/archive/refs/tags/${MTL_VER}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/Media-Transport-Library
WORKDIR /tmp/dpdk
RUN \
echo "**** DOWNLOAD DPDK ****" && \
curl -Lf \
https://github.com/DPDK/dpdk/archive/refs/tags/v${DPDK_VER}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/dpdk
RUN \
echo "**** BUILD DPDK ****" && \
git apply /tmp/Media-Transport-Library/patches/dpdk/$DPDK_VER/*.patch && \
meson build && \
ninja -C build && \
ninja -C build install
# Build the xdp-tools project
WORKDIR /tmp/xdp-tools
RUN curl -Lf https://github.com/xdp-project/xdp-tools/archive/${XDP_VER}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/xdp-tools && \
curl -Lf https://github.com/libbpf/libbpf/archive/${BPF_VER}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/xdp-tools/lib/libbpf && \
./configure && \
make && \
make install && \
DESTDIR=/buildout make install && \
make -C /tmp/xdp-tools/lib/libbpf/src install && \
DESTDIR=/buildout make -C /tmp/xdp-tools/lib/libbpf/src install
WORKDIR /tmp/Media-Transport-Library
RUN \
echo "**** BUILD MTL ****" && \
git -C /tmp/Media-Transport-Library apply /tmp/patches/imtl/*.patch && \
./build.sh
WORKDIR /tmp/jpegxs/Build/linux
RUN \
echo "**** DOWNLOAD JPEG-XS ****" && \
curl -Lf \
https://github.com/OpenVisualCloud/SVT-JPEG-XS/archive/refs/tags/v${JPEG_XS_VER}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/jpegxs && \
chmod +x ./build.sh /tmp/jpegxs/imtl-plugin/build.sh
RUN \
echo "**** BUILD JPEG-XS ****" && \
./build.sh install --prefix=/tmp/jpegxs/Build/linux/install
ENV LD_LIBRARY_PATH="/tmp/jpegxs/Build/linux/install/lib"
ENV PKG_CONFIG_PATH="/tmp/jpegxs/Build/linux/install/lib/pkgconfig"
WORKDIR /tmp/jpegxs/imtl-plugin
RUN \
echo "**** BUILD JPEG-XS MTL PLUGIN ****" && \
./build.sh
WORKDIR /tmp/ffmpeg
RUN \
echo "**** DOWNLOAD FFMPEG ****" && \
curl -Lf \
https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/ffmpeg
WORKDIR /tmp/cartwheel
RUN \
echo "**** APPLY CARTWHEEL PATCHES ****" && \
curl -Lf \
https://github.com/intel/cartwheel-ffmpeg/archive/${CARTWHEEL_COMMIT_ID}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/cartwheel && \
git -C /tmp/ffmpeg apply /tmp/cartwheel/patches/*.patch
RUN \
echo "**** APPLY MTL PATCHES ****" && \
cp /tmp/Media-Transport-Library/ecosystem/ffmpeg_plugin/mtl_*.c -rf /tmp/ffmpeg/libavdevice/ && \
cp /tmp/Media-Transport-Library/ecosystem/ffmpeg_plugin/mtl_*.h -rf /tmp/ffmpeg/libavdevice/ && \
git -C /tmp/ffmpeg/ apply /tmp/Media-Transport-Library/ecosystem/ffmpeg_plugin/6.1/*.patch
RUN \
echo "**** APPLY JPEG-XS PATCHES ****" && \
git -C /tmp/ffmpeg apply --whitespace=fix /tmp/jpegxs/ffmpeg-plugin/*.patch
RUN \
echo "**** APPLY FFMPEG patches ****" && \
git -C /tmp/ffmpeg apply /tmp/patches/ffmpeg/hwupload_async.diff && \
git -C /tmp/ffmpeg apply /tmp/patches/ffmpeg/qsv_aligned_malloc.diff && \
git -C /tmp/ffmpeg apply /tmp/patches/ffmpeg/qsvvpp_async.diff && \
git -C /tmp/ffmpeg apply /tmp/patches/ffmpeg/filtergraph_async.diff
WORKDIR /tmp
RUN \
echo "**** DOWNLOAD AND INSTALL IPP ****" && \
no_proxy="" wget --progress=dot:giga \
https://registrationcenter-download.intel.com/akdlm/IRC_NAS/046b1402-c5b8-4753-9500-33ffb665123f/l_ipp_oneapi_p_2021.10.1.16_offline.sh && \
chmod +x l_ipp_oneapi_p_2021.10.1.16_offline.sh && \
./l_ipp_oneapi_p_2021.10.1.16_offline.sh -a -s --eula accept && \
echo "source /opt/intel/oneapi/ipp/latest/env/vars.sh" | tee -a ~/.bash_profile
ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
WORKDIR /tmp/vsr
RUN \
echo "**** DOWNLOAD VIDEO SUPER RESOLUTION ****" && \
curl -Lf \
https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/archive/refs/tags/${VSR}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/vsr
RUN \
echo "**** BUILD VIDEO SUPER RESOLUTION ****" && \
. /opt/intel/oneapi/ipp/latest/env/vars.sh && \
git -C /tmp/vsr/ apply /tmp/patches/vsr/0003-missing-header-fix.patch && \
./build.sh -DCMAKE_INSTALL_PREFIX="/tmp/vsr/install" -DENABLE_RAISR_OPENCL=ON
RUN \
echo "**** APPLY VIDEO SUPER RESOLUTION PATCHES ****" && \
git -C /tmp/ffmpeg apply /tmp/patches/vsr/0001-ffmpeg-raisr-filter.patch && \
git -C /tmp/ffmpeg apply /tmp/patches/vsr/0002-libavfilter-raisr_opencl-Add-raisr_opencl-filter.patch && \
cp /tmp/vsr/ffmpeg/vf_raisr*.c /tmp/ffmpeg/libavfilter
WORKDIR /tmp/mcm
RUN \
echo "**** DOWNLOAD MEDIA COMMUNICATIONS MESH ****" && \
curl -Lf \
https://github.com/OpenVisualCloud/Media-Communications-Mesh/archive/refs/tags/${MCM_VER}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/mcm
RUN \
echo "**** BUILD MEDIA COMMUNICATIONS MESH ****" && \
cmake -S /tmp/mcm/sdk -B /tmp/mcm/sdk/out && \
cmake --build /tmp/mcm/sdk/out && \
cmake --install /tmp/mcm/sdk/out
WORKDIR /tmp/ffmpeg/
RUN \
echo "**** APPLY MEDIA COMMUNICATIONS MESH PATCHES ****" && \
git -C /tmp/ffmpeg apply -v --whitespace=fix --ignore-space-change /tmp/mcm/ffmpeg-plugin/6.1/*.patch && \
cp -f /tmp/mcm/ffmpeg-plugin/mcm_* /tmp/ffmpeg/libavdevice/
RUN \
echo "**** BUILD FFMPEG ****" && \
. /opt/intel/oneapi/ipp/latest/env/vars.sh && \
./configure \
--disable-debug \
--disable-doc \
--disable-shared \
--enable-static \
--enable-ffprobe \
--enable-libsvtav1 \
--enable-libvpl \
--enable-libvmaf \
--enable-version3 \
--enable-libxml2 \
--enable-mtl \
--enable-opencl \
--enable-stripping \
--enable-vaapi \
--enable-vulkan \
--enable-libsvtjpegxs \
--enable-libipp \
--enable-mcm \
--enable-pthreads \
--extra-cflags="-march=native -fopenmp -I/tmp/vsr/install/include/ -I/opt/intel/oneapi/ipp/latest/include/ipp/" \
--extra-ldflags="-fopenmp -L/tmp/vsr/install/lib" \
--extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lpthread -lm -lz -lbsd -lrdmacm' \
--enable-cross-compile && \
make
RUN \
echo "**** ARRANGE FILES ****" && \
ldconfig && \
mkdir -p \
/buildout/usr/bin \
/buildout/usr/lib/x86_64-linux-gnu/libmfx-gen \
/buildout/usr/lib/x86_64-linux-gnu/mfx \
/buildout/usr/local/lib/vpl \
/buildout/usr/local/lib/x86_64-linux-gnu/dri \
/buildout/usr/local/lib/x86_64-linux-gnu/dpdk/pmds-24.0/ \
/buildout/etc/OpenCL/vendors \
/buildout/usr/local/etc/ && \
cp \
/tmp/ffmpeg/ffmpeg \
/buildout/usr/bin && \
cp \
/tmp/ffmpeg/ffprobe \
/buildout/usr/bin && \
cp \
/tmp/ffmpeg/ffplay \
/buildout/usr/bin && \
cp -a \
/usr/local/lib/lib*so* \
/buildout/usr/local/lib/ && \
cp -a \
/usr/lib/x86_64-linux-gnu/lib*so* \
/buildout/usr/lib/x86_64-linux-gnu/ && \
cp -a \
/usr/local/lib/x86_64-linux-gnu/lib*so* \
/buildout/usr/local/lib/x86_64-linux-gnu/ && \
cp -a \
/usr/local/lib/x86_64-linux-gnu/dpdk/pmds-24.0/* \
/buildout/usr/local/lib/x86_64-linux-gnu/dpdk/pmds-24.0/ && \
cp -a \
/usr/lib/x86_64-linux-gnu/dri/*.so \
/buildout/usr/local/lib/x86_64-linux-gnu/dri && \
cp -a \
/tmp/jpegxs/Build/linux/install/lib/* \
/buildout/usr/lib/x86_64-linux-gnu/ && \
cp -a \
/tmp/jpegxs/imtl-plugin/kahawai.json \
/buildout/usr/local/etc/jpegxs.json && \
cp -a \
/tmp/vsr/install/lib/* \
/buildout/usr/lib/x86_64-linux-gnu/ && \
cp -a \
/tmp/vsr/filters* \
/buildout/ && \
cp -a \
/opt/intel/oneapi/ipp/2021.10/lib/libipp*.so.* \
/buildout/usr/lib/x86_64-linux-gnu/ && \
cp -a \
/tmp/Media-Transport-Library/build/lib/libmtl.so* \
/buildout/usr/lib/x86_64-linux-gnu/ && \
cp -a \
/tmp/mcm/sdk/out/lib/libmcm_dp.so* \
/buildout/usr/lib/x86_64-linux-gnu/
# runtime stage
ARG IMAGE_CACHE_REGISTRY
FROM ${IMAGE_CACHE_REGISTRY}/library/ubuntu:22.04 AS finalstage
LABEL org.opencontainers.image.authors="[email protected],[email protected]"
LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Intel-Tiber-Broadcast-Suite"
LABEL org.opencontainers.image.title="Intel® Tiber™ Broadcast Suite"
LABEL org.opencontainers.image.description="Intel® Tiber™ Broadcast Suite. Open Visual Cloud from Intel® Corporation, collaboration on FFmpeg with plugins on Ubuntu. Release image"
LABEL org.opencontainers.image.documentation="https://github.com/OpenVisualCloud/Intel-Tiber-Broadcast-Suite/tree/main/docs"
LABEL org.opencontainers.image.version="0.9.0"
LABEL org.opencontainers.image.vendor="Intel® Corporation"
LABEL org.opencontainers.image.licenses="BSD 3-Clause License"
ENV \
DEBIAN_FRONTEND="noninteractive" \
LIBVA_DRIVERS_PATH="/usr/local/lib/x86_64-linux-gnu/dri" \
LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu" \
NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" \
NVIDIA_VISIBLE_DEVICES="all"
ENV TZ=Europe/Warsaw
ENV KAHAWAI_CFG_PATH="/usr/local/etc/jpegxs.json"
# Install dependencies
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
RUN \
echo "**** INSTALL RUNTIME PACKAGES ****" && \
apt-get update --fix-missing && \
apt-get full-upgrade -y && \
apt-get install --no-install-recommends -y \
sudo \
ca-certificates \
libtool \
libnuma1 \
libsdl2-2.0-0 \
libpcap0.8 \
libssl3 \
libxcb-shape0 \
librdmacm1 \
libsdl2-ttf-2.0-0 \
libcap-ng0 \
libatomic1 \
intel-opencl-icd \
opencl-headers \
ocl-icd-libopencl1 \
libjson-c5 \
zlib1g \
libelf1 \
libcap2-bin && \
apt-get remove linux-libc-dev -y && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* &&\
groupadd -g 2110 vfio && \
groupadd -g 1001 imtl && \
groupadd -g 1002 mcm && \
useradd -m -s /bin/bash -G vfio,imtl,mcm -u 1003 ffmpeg-vpp && \
usermod -aG sudo ffmpeg-vpp
COPY --chown=ffmpeg-vpp --from=buildstage /buildout/ /
RUN ldconfig
EXPOSE 8001/tcp 8002/tcp
EXPOSE 20000-20100
HEALTHCHECK --interval=30s --timeout=5s CMD ps aux | grep "ffmpeg" || exit 1
USER "ffmpeg-vpp"
CMD ["--help"]
SHELL ["/bin/bash", "-c"]
ENTRYPOINT ["/usr/bin/ffmpeg"]