forked from magiclen/ubuntu-ffffmpeg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.Jammy
480 lines (431 loc) · 12.6 KB
/
Dockerfile.Jammy
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
ARG ffmpeg_ver=7.1
ARG libvmaf_ver=3.0.0
ARG libopenjpeg_ver=2.5.2
ARG libflite_ver=2.2
ARG libaribcaption_ver=1.1.1
FROM nvidia/cuda:12.6.1-cudnn-devel-ubuntu22.04 AS builder
RUN apt update -y
RUN apt install -y curl build-essential automake libtool cmake meson ninja-build nasm yasm texinfo libxml2-utils git
RUN mkdir ffmpeg_build
WORKDIR /workspace
# nvenc #
RUN apt install -y git
RUN git clone https://github.com/FFmpeg/nv-codec-headers \
&& cd nv-codec-headers \
&& make install \
&& cd /workspace
# -----DESKTOP-----
# libbz2-dev for NOT --disable-bzlib
# libalsa-ocaml-dev for NOT --disable-alsa
# libsdl2-dev for NOT --disable-sdl2
# libva-dev for NOT --disable-vaapi
# llibvdpau-dev for NOT --disable-vdpau
# libx11-dev for NOT --disable-xlib
RUN apt install -y \
libbz2-dev \
libalsa-ocaml-dev \
libsdl2-dev \
libva-dev \
libvdpau-dev \
libx11-dev
# libpulse-dev for --enable-libpulse
# libxcb1-dev for --enable-libxcb
# libxcb-shm0-dev for --enable-libxcb-shm
# libxcb-shape0-dev for --enable-libxcb-shape
# libxcb-xfixes0-dev for --enable-libxcb-xfixes
RUN apt install -y \
libpulse-dev \
libxcb1-dev \
libxcb-shm0-dev \
libxcb-shape0-dev \
libxcb-xfixes0-dev
# -----UTILS-----
# clang for NOT --disable-cuda-llvm
# libssl-dev for --enable-openssl (TLS/SSL, rtmp)
# libbluray-dev for --enable-libbluray (Blu-Ray Discs playback)
# libdvdnav-dev for --enable-libdvdnav (DVD demuxing)
# libdvdread-dev for --enable-libdvdread (DVD demuxing)
# libmfx-dev for --enable-libmfx (Intel MediaSDK (Quick Sync Video) code)
# libomxil-bellagio-dev for --enable-omx (Open Media Acceleration)
# libvulkan-dev for NOT --disable-vulkan (Vulkan API)
# librabbitmq-dev for --enable-librabbitmq (RabbitMQ)
# libzmq3-dev for --enable-libzmq (ZeroMQ)
# libsmbclient-dev for --enable-libsmbclient (Samba)
# libsrt-openssl-dev for --enable-libsrt (Haivision SRT)
# libssh-dev for --enable-libssh (SFTP)
# libxml2-dev for --enable-libxml2 (XML parsing)
# libzvbi-dev for --enable-libzvbi (teletext)
# liblzma-dev for NOT --disable-lzma (compression)
# zlib1g-dev for NOT --disable-zlib (compression)
RUN apt install -y \
clang \
libssl-dev \
libbluray-dev \
libdvdnav-dev \
libdvdread-dev \
libmfx-dev \
libomxil-bellagio-dev \
libvulkan-dev \
librabbitmq-dev \
libzmq3-dev \
libsmbclient-dev \
libsrt-openssl-dev \
libssh-dev \
libxml2-dev \
libzvbi-dev \
liblzma-dev \
zlib1g-dev
# -----VIDEO & IMAGE-----
# fetch & compile & install libvmaf for --enable-libvmaf (video quality assessment)
ARG libvmaf_ver
RUN cd /ffmpeg_build && \
curl -fL https://github.com/Netflix/vmaf/archive/refs/tags/v${libvmaf_ver}.tar.gz -o vmaf.tar.gz && tar xzf vmaf.tar.gz && \
mkdir -p vmaf-${libvmaf_ver}/libvmaf/build && \
cd vmaf-${libvmaf_ver}/libvmaf/build && \
meson setup --buildtype=release --prefix "/ffmpeg_build" --libdir="/ffmpeg_build/lib" --default-library=static .. && \
ninja && ninja install
# fetch & compile & install libopenjpeg for --enable-libopenjpeg (JPEG 2000)
ARG libopenjpeg_ver
RUN cd /ffmpeg_build && \
curl -fL https://github.com/uclouvain/openjpeg/archive/refs/tags/v${libopenjpeg_ver}.tar.gz -o openjpeg.tar.gz && tar xzf openjpeg.tar.gz && \
mkdir -p openjpeg-${libopenjpeg_ver}/build && \
cd openjpeg-${libopenjpeg_ver}/build && \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/ffmpeg_build" -DBUILD_SHARED_LIBS=off .. && \
make -j$(nproc) && make install
# libaom-dev for --enable-libaom (AV1)
# libdav1d-dev for --enable-libdav1d (AV1 decoder)
# libsvtav1enc-dev for --enable-libsvtav1 (AV1 encoder)
# libopenh264-dev for --enable-libopenh264 (H.264/AVC)
# libvpx-dev for --enable-libvpx (VP8, VP9)
# libx264-dev for --enable-libx264 (H.264/AVC)
# libnuma-dev for libx265
# libx265-dev for --enable-libx265 (H.265/HEVC)
# libxvidcore-dev for --enable-libxvid (MPEG-4/Xvid encoder)
# libtheora-dev for --enable-libtheora (Theora)
# libsnappy-dev for --enable-libsnappy (HAP)
# libdavs2-dev for --enable-libdavs2 (AVS2 decoder)
# ocl-icd-opencl-dev for --enable-opencl (OpenCL processing)
# libopengl-dev for --enable-opengl (OpenGL rendering)
# libv4l-dev for --enable-libv4l2 (capture video)
# libdrm-dev for --enable-libdrm (not sure what it is for)
# libfrei0r-ocaml-dev for --enable-frei0r (frei0r video filtering)
# libzimg for --enable-libzimg (the zscale filter)
# libvidstab for --enable-libvidstab (video stabilization)
# libfreetype-dev for --enable-libfreetype (draw text)
# libfontconfig1-dev for --enable-libfontconfig1 (draw text)
# libfribidi-dev for --enable-libfribidi (draw text)
# libharfbuzz-dev for --enable-libharfbuzz (draw text)
# libwebp-dev for --enable-libwebp (WebP)
# libjpeg-dev for --enable-libopenjpeg (JPEG)
# librsvg2-dev for --enable-librsvg (SVG rasterization)
# libcaca-dev for --enable-libcaca (converts images into colored ASCII art)
# libtesseract-dev for --enable-libtesseract (the ocr filter)
# libqrencode-dev for --enable-libqrencode (QR encode generation)
# libplacebo-dev for --enable-libplacebo (not sure what it is for)
RUN apt install -y \
libaom-dev \
libdav1d-dev \
libsvtav1enc-dev \
libopenh264-dev \
libvpx-dev \
libx264-dev \
libnuma-dev \
libx265-dev \
libxvidcore-dev \
libtheora-dev \
libsnappy-dev \
libdavs2-dev \
ocl-icd-opencl-dev \
libopengl-dev \
libv4l-dev \
libdc1394-dev \
libdrm-dev \
libfrei0r-ocaml-dev \
libzimg-dev \
libvidstab-dev \
libfreetype-dev \
libfontconfig1-dev \
libfribidi-dev \
libharfbuzz-dev \
libwebp-dev \
libjpeg-dev \
librsvg2-dev \
libcaca-dev \
libtesseract-dev \
libqrencode-dev \
libplacebo-dev
# -----AUDIO-----
# fetch & compile & install libflite for --enable-libflite (speech synthesis)
ARG libflite_ver
RUN cd /ffmpeg_build && \
curl -fL https://github.com/festvox/flite/archive/refs/tags/v${libflite_ver}.tar.gz -o flite.tar.gz && tar xzf flite.tar.gz && \
cd flite-${libflite_ver} && \
./configure --prefix="/ffmpeg_build" --disable-shared && \
make -j$(nproc) && make install
# libopus-dev for --enable-libopus (OPUS)
# libvorbis-dev for --enable-libvorbis (OGG)
# libfdk-aac for --enable-libfdk-aac (AAC)
# libmp3lame-dev for --enable-libmp3lame (MP3)
# libshine-dev for --enable-libshine (fixed-point MP3 encoder)
# libtwolame-dev for --enable-libtwolame (MP2)
# libopencore-amrnb-dev for --enable-libopencore-amrnb (Adaptive Multi-Rate Narrowband)
# libopencore-amrwb-dev for --enable-libopencore-amrwb (Adaptive Multi-Rate Wideband)
# libvo-amrwbenc-dev for --enable-libvo-amrwbenc (Adaptive Multi-Rate Wideband)
# libspeex-dev for --enable-libspeex (Speex)
# libcodec2-dev for --enable-libcodec2 (speech codec)
# libopenal-dev for --enable-openal (capture audio)
# libmysofa-dev for --enable-libmysofa (the sofalizer filter)
# libpocketsphinx-dev for --enable-libpocketsphinx (the asr filter)
# libgsm1-dev for --enable-libgsm (13 kbit/s RPE/LTP speech compression)
# librubberband-dev for --enable-librubberband (time-stretching and pitch-shifting filtering)
# libsndio-dev for NOT --disable-sndio (MIDI)
# liblilv-dev, lv2-dev for --enable-lv2 (LV2 audio filtering)
# libladspa-ocaml-dev for --enable-ladspa (LADSPA audio filtering)
# libjack-jackd2-dev for --enable-libjack (JACK)
# libsoxr-dev for --enable-libsoxr (resampler)
# libchromaprint-dev for --enable-chromaprint (audio fingerprinter)
# libcdio-dev, libcdio-cdda-dev, libcdio-paranoia-dev for --enable-libcdio (audio CD grabbing)
# libgme-dev for --enable-libgme (Game Music Emu)
# libbs2b-dev for --enable-libbs2b (not sure what it is for)
# libopenmpt-dev for --enable-libopenmpt (not sure what it is for)
RUN apt install -y \
libopus-dev \
libvorbis-dev \
libfdk-aac-dev \
libmp3lame-dev \
libshine-dev \
libtwolame-dev \
libopencore-amrnb-dev \
libopencore-amrwb-dev \
libvo-amrwbenc-dev \
libspeex-dev \
libcodec2-dev \
libopenal-dev \
libmysofa-dev \
libpocketsphinx-dev \
libgsm1-dev \
librubberband-dev \
libsndio-dev \
liblilv-dev lv2-dev \
libladspa-ocaml-dev \
libjack-jackd2-dev \
libsoxr-dev \
libchromaprint-dev \
libcdio-dev libcdio-cdda-dev libcdio-paranoia-dev \
libgme-dev \
libbs2b-dev \
libopenmpt-dev
# -----SUBTITLE-----
# fetch & compile & install libaribcaption for --enable-libaribcaption (caption decoding)
ARG libaribcaption_ver
RUN cd /ffmpeg_build && \
curl -fL https://github.com/xqq/libaribcaption/archive/refs/tags/v${libaribcaption_ver}.tar.gz -o libaribcaption.tar.gz && tar xzf libaribcaption.tar.gz && \
mkdir -p libaribcaption-${libaribcaption_ver}/build && \
cd libaribcaption-${libaribcaption_ver}/build && \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/ffmpeg_build" .. && \
make -j$(nproc) && make install
# libass-dev for --enable-libass (ASS)
# libaribb24-dev for --enable-libaribb24 (caption decoding)
RUN apt install -y \
libass-dev \
libaribb24-dev
# -----FFMPEG-----
ARG ffmpeg_ver
RUN curl -fL https://ffmpeg.org/releases/ffmpeg-${ffmpeg_ver}.tar.bz2 -o ffmpeg.tar.bz2 && tar xjf ffmpeg.tar.bz2
WORKDIR /workspace/ffmpeg-${ffmpeg_ver}
RUN PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="/ffmpeg_build" \
--enable-cuda \
--enable-cuvid \
--enable-nvdec \
--enable-nvenc \
--enable-libnpp \
--extra-cflags="-I/ffmpeg_build/include -I/usr/local/cuda/include -Wno-implicit-function-declaration" \
--extra-ldflags="-L/ffmpeg_build/lib -L/usr/local/cuda/lib64" \
--extra-libs="-lasound -lm -lstdc++" \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
--enable-libpulse \
--enable-libxcb \
--enable-libxcb-shm \
--enable-libxcb-shape \
--enable-libxcb-xfixes \
--enable-openssl \
--enable-libbluray \
--enable-libdvdnav \
--enable-libdvdread \
--enable-libmfx \
--enable-omx \
--enable-librabbitmq \
--enable-libzmq \
--enable-libsmbclient \
--enable-libsrt \
--enable-libssh \
--enable-libxml2 \
--enable-libzvbi \
--enable-libvmaf \
--enable-libopenjpeg \
--enable-libaom \
--enable-libdav1d \
--enable-libsvtav1 \
--enable-libopenh264 \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-libxvid \
--enable-libtheora \
--enable-libsnappy \
--enable-libdavs2 \
--enable-opencl \
--enable-opengl \
--enable-libv4l2 \
--enable-libdc1394 \
--enable-libdrm \
--enable-frei0r \
--enable-libzimg \
--enable-libvidstab \
--enable-libfreetype \
--enable-libfontconfig \
--enable-libfribidi \
--enable-libharfbuzz \
--enable-libwebp \
--enable-librsvg \
--enable-libcaca \
--enable-libtesseract \
--enable-libqrencode \
--enable-libplacebo \
--enable-libflite \
--enable-libopus \
--enable-libvorbis \
--enable-libfdk-aac \
--enable-libmp3lame \
--enable-libshine \
--enable-libtwolame \
--enable-libopencore-amrnb \
--enable-libopencore-amrwb \
--enable-libvo-amrwbenc \
--enable-libspeex \
--enable-libcodec2 \
--enable-openal \
--enable-libmysofa \
--enable-pocketsphinx \
--enable-libgsm \
--enable-librubberband \
--enable-lv2 \
--enable-ladspa \
--enable-libjack \
--enable-libsoxr \
--enable-chromaprint \
--enable-libcdio \
--enable-libgme \
--enable-libbs2b \
--enable-libopenmpt \
--enable-libass \
--enable-libaribb24 \
--enable-libaribcaption \
|| (cat ffbuild/config.log | tail -n 50 && exit 1)
RUN make -j$(nproc)
RUN make install
RUN /ffmpeg_build/bin/ffmpeg --help
# ----- Runtime Environment -----
FROM ubuntu:22.04
RUN apt update -y
# If you want to run FFmpeg executable files on other Ubuntu-22.04-based systems, use the following command to install the required packages.
RUN apt install -y \
libjack-jackd2-0 \
libdrm2 \
libopenal1 \
libxcb1 \
libxcb-shm0 \
libxcb-shape0 \
libxcb-xfixes0 \
libcdio-paranoia2 \
libcdio-cdda2 \
libdc1394-25 \
libcaca0 \
libgl1 \
libpulse0 \
libsdl2-2.0-0 \
libsndio7.0 \
libv4l-0 \
libxv1 \
libpocketsphinx3 \
libsphinxbase3 \
libbs2b0 \
liblilv-0-0 \
librubberband2 \
libmysofa1 \
libfribidi0 \
libplacebo192 \
libtesseract4 \
libass9 \
libva2 \
libvidstab1.1 \
libzmq5 \
libzimg2 \
ocl-icd-libopencl1 \
libqrencode4 \
libfontconfig1 \
libfreetype6 \
libmfx1 \
libdvdnav4 \
libdvdread8 \
libxml2 \
libbz2-1.0 \
libgme0 \
libopenmpt0 \
libchromaprint1 \
libbluray2 \
librabbitmq4 \
libsrt1.4-openssl \
libssh-4 \
libsmbclient \
libvpx7 \
libwebpmux3 \
libwebp7 \
liblzma5 \
libaribb24-0 \
libdav1d5 \
libdavs2-16 \
libopencore-amrwb0 \
librsvg2-2 \
libaom3 \
libcodec2-1.0 \
libfdk-aac2 \
libgsm1 \
libmp3lame0 \
libopencore-amrnb0 \
libopus0 \
libshine3 \
libspeex1 \
libsvtav1enc0 \
libtheora0 \
libtwolame0 \
libvo-amrwbenc0 \
libvorbis0a \
libx264-163 \
libx265-199 \
libxvidcore4 \
libopenh264-6 \
libsoxr0 \
libgcc-s1 \
libnuma1 \
libjpeg8
RUN adduser --disabled-password \
--gecos "" \
--no-create-home \
user
WORKDIR /workspace
COPY --from=builder /ffmpeg_build/bin/ffmpeg /ffmpeg_build/bin/ffplay /ffmpeg_build/bin/ffprobe ./
COPY --from=builder /usr/local/cuda /usr/local/cuda
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH}
RUN chown user:user /workspace
USER user
RUN ldd ffmpeg
RUN ./ffmpeg --help
RUN ldd ffplay
RUN ./ffplay --help
RUN ldd ffprobe
RUN ./ffprobe --help
CMD cp * /output