1{
2 lib,
3 config,
4 stdenv,
5 buildPackages,
6 removeReferencesTo,
7 addDriverRunpath,
8 pkg-config,
9 perl,
10 texinfo,
11 texinfo6,
12 yasm,
13
14 # You can fetch any upstream version using this derivation by specifying version and hash
15 # NOTICE: Always use this argument to override the version. Do not use overrideAttrs.
16 version, # ffmpeg ABI version. Also declare this if you're overriding the source.
17 hash ? "", # hash of the upstream source for the given ABI version
18 source ? fetchgit {
19 url = "https://git.ffmpeg.org/ffmpeg.git";
20 rev = "n${version}";
21 inherit hash;
22 },
23
24 ffmpegVariant ? "small", # Decides which dependencies are enabled by default
25
26 # Build with headless deps; excludes dependencies that are only necessary for
27 # GUI applications. To be used for purposes that don't generally need such
28 # components and i.e. only depend on libav
29 withHeadlessDeps ? ffmpegVariant == "headless" || withSmallDeps,
30
31 # Dependencies a user might customarily expect from a regular ffmpeg build.
32 # /All/ packages that depend on ffmpeg and some of its feaures should depend
33 # on the small variant. Small means the minimal set of features that satisfies
34 # all dependants in Nixpkgs
35 withSmallDeps ? ffmpegVariant == "small" || withFullDeps,
36
37 # Everything enabled; only guarded behind platform exclusivity or brokenness.
38 # If you need to depend on ffmpeg-full because ffmpeg is missing some feature
39 # your package needs, you should enable that feature in regular ffmpeg
40 # instead.
41 withFullDeps ? ffmpegVariant == "full",
42
43 fetchgit,
44 fetchpatch2,
45
46 # Feature flags
47 withAlsa ? withHeadlessDeps && stdenv.hostPlatform.isLinux, # Alsa in/output supporT
48 withAmf ? withHeadlessDeps && lib.meta.availableOn stdenv.hostPlatform amf, # AMD Media Framework video encoding
49 withAom ? withHeadlessDeps, # AV1 reference encoder
50 withAribb24 ? withFullDeps, # ARIB text and caption decoding
51 withAribcaption ? withFullDeps && lib.versionAtLeast version "6.1", # ARIB STD-B24 Caption Decoder/Renderer
52 withAss ? withHeadlessDeps && stdenv.hostPlatform == stdenv.buildPlatform, # (Advanced) SubStation Alpha subtitle rendering
53 withAvisynth ? withFullDeps, # AviSynth script files reading
54 withBluray ? withHeadlessDeps, # BluRay reading
55 withBs2b ? withFullDeps, # bs2b DSP library
56 withBzlib ? withHeadlessDeps,
57 withCaca ? withFullDeps, # Textual display (ASCII art)
58 withCdio ? withFullDeps && withGPL, # Audio CD grabbing
59 withCelt ? withFullDeps, # CELT decoder
60 withChromaprint ? withFullDeps, # Audio fingerprinting
61 withCodec2 ? withFullDeps, # codec2 en/decoding
62 withCuda ? withFullDeps && withNvcodec,
63 withCudaLLVM ? withHeadlessDeps,
64 withCudaNVCC ? withFullDeps && withUnfree && config.cudaSupport,
65 withCuvid ? withHeadlessDeps && withNvcodec,
66 withDav1d ? withHeadlessDeps, # AV1 decoder (focused on speed and correctness)
67 withDavs2 ? withFullDeps && withGPL, # AVS2 decoder
68 withDc1394 ? withFullDeps && !stdenv.hostPlatform.isDarwin, # IIDC-1394 grabbing (ieee 1394)
69 withDrm ? withHeadlessDeps && (with stdenv; isLinux || isFreeBSD), # libdrm support
70 withDvdnav ? withFullDeps && withGPL && lib.versionAtLeast version "7", # needed for DVD demuxing
71 withDvdread ? withFullDeps && withGPL && lib.versionAtLeast version "7", # needed for DVD demuxing
72 withFdkAac ? withFullDeps && (!withGPL || withUnfree), # Fraunhofer FDK AAC de/encoder
73 withNvcodec ?
74 withHeadlessDeps
75 && (
76 with stdenv;
77 !isDarwin
78 && !isAarch32
79 && !hostPlatform.isLoongArch64
80 && !hostPlatform.isRiscV
81 && hostPlatform == buildPlatform
82 ), # dynamically linked Nvidia code
83 withFlite ? withFullDeps, # Voice Synthesis
84 withFontconfig ? withHeadlessDeps, # Needed for drawtext filter
85 withFreetype ? withHeadlessDeps, # Needed for drawtext filter
86 withFrei0r ? withFullDeps && withGPL, # frei0r video filtering
87 withFribidi ? withHeadlessDeps, # Needed for drawtext filter
88 withGme ? withFullDeps, # Game Music Emulator
89 withGnutls ? withHeadlessDeps,
90 withGsm ? withFullDeps, # GSM de/encoder
91 withHarfbuzz ? withHeadlessDeps && lib.versionAtLeast version "6.1", # Needed for drawtext filter
92 withIconv ? withHeadlessDeps,
93 withIlbc ? withFullDeps, # iLBC de/encoding
94 withJack ? withFullDeps && !stdenv.hostPlatform.isDarwin, # Jack audio
95 withJxl ? withFullDeps && lib.versionAtLeast version "5", # JPEG XL de/encoding
96 withKvazaar ? withFullDeps, # HEVC encoding
97 withLadspa ? withFullDeps, # LADSPA audio filtering
98 withLc3 ? withFullDeps && lib.versionAtLeast version "7.1", # LC3 de/encoding
99 withLcevcdec ? withFullDeps && lib.versionAtLeast version "7.1", # LCEVC decoding
100 withLcms2 ? withFullDeps, # ICC profile support via lcms2
101 withLzma ? withHeadlessDeps, # xz-utils
102 withMetal ? false, # Unfree and requires manual downloading of files
103 withMfx ? false, # Hardware acceleration via intel-media-sdk/libmfx
104 withModplug ? withFullDeps && !stdenv.hostPlatform.isDarwin, # ModPlug support
105 withMp3lame ? withHeadlessDeps, # LAME MP3 encoder
106 withMysofa ? withFullDeps, # HRTF support via SOFAlizer
107 withNpp ? withFullDeps && withUnfree && config.cudaSupport, # Nvidia Performance Primitives-based code
108 withNvdec ? withHeadlessDeps && withNvcodec,
109 withNvenc ? withHeadlessDeps && withNvcodec,
110 withOpenal ? withFullDeps, # OpenAL 1.1 capture support
111 withOpencl ? withHeadlessDeps,
112 withOpencoreAmrnb ? withFullDeps && withVersion3, # AMR-NB de/encoder
113 withOpencoreAmrwb ? withFullDeps && withVersion3, # AMR-WB decoder
114 withOpengl ? withFullDeps && !stdenv.hostPlatform.isDarwin, # OpenGL rendering
115 withOpenh264 ? withFullDeps, # H.264/AVC encoder
116 withOpenjpeg ? withHeadlessDeps, # JPEG 2000 de/encoder
117 withOpenmpt ? withHeadlessDeps, # Tracked music files decoder
118 withOpus ? withHeadlessDeps, # Opus de/encoder
119 withPlacebo ? withFullDeps && !stdenv.hostPlatform.isDarwin, # libplacebo video processing library
120 withPulse ? withSmallDeps && stdenv.hostPlatform.isLinux, # Pulseaudio input support
121 withQrencode ? withFullDeps && lib.versionAtLeast version "7", # QR encode generation
122 withQuirc ? withFullDeps && lib.versionAtLeast version "7", # QR decoding
123 withRav1e ? withFullDeps, # AV1 encoder (focused on speed and safety)
124 withRist ? withHeadlessDeps, # Reliable Internet Stream Transport (RIST) protocol
125 withRtmp ? withFullDeps, # RTMP[E] support
126 withRubberband ? withFullDeps && withGPL && !stdenv.hostPlatform.isFreeBSD, # Rubberband filter
127 withSamba ? withFullDeps && !stdenv.hostPlatform.isDarwin && withGPLv3, # Samba protocol
128 withSdl2 ? withSmallDeps,
129 withShaderc ? withFullDeps && !stdenv.hostPlatform.isDarwin && lib.versionAtLeast version "5.0",
130 withShine ? withFullDeps, # Fixed-point MP3 encoding
131 withSnappy ? withFullDeps, # Snappy compression, needed for hap encoding
132 withSoxr ? withHeadlessDeps, # Resampling via soxr
133 withSpeex ? withHeadlessDeps, # Speex de/encoder
134 withSrt ? withHeadlessDeps, # Secure Reliable Transport (SRT) protocol
135 withSsh ? withHeadlessDeps, # SFTP protocol
136 withSvg ? withFullDeps, # SVG protocol
137 withSvtav1 ? withHeadlessDeps && !stdenv.hostPlatform.isAarch64 && !stdenv.hostPlatform.isMinGW, # AV1 encoder/decoder (focused on speed and correctness)
138 withTensorflow ? false, # Tensorflow dnn backend support (Increases closure size by ~390 MiB)
139 withTheora ? withHeadlessDeps, # Theora encoder
140 withTwolame ? withFullDeps, # MP2 encoding
141 withUavs3d ? withFullDeps, # AVS3 decoder
142 withV4l2 ? withHeadlessDeps && stdenv.hostPlatform.isLinux, # Video 4 Linux support
143 withV4l2M2m ? withV4l2,
144 withVaapi ? withHeadlessDeps && (with stdenv; isLinux || isFreeBSD), # Vaapi hardware acceleration
145 withVdpau ? withSmallDeps && !stdenv.hostPlatform.isMinGW, # Vdpau hardware acceleration
146 withVidStab ? withHeadlessDeps && withGPL, # Video stabilization
147 withVmaf ? withFullDeps && !stdenv.hostPlatform.isAarch64 && lib.versionAtLeast version "5", # Netflix's VMAF (Video Multi-Method Assessment Fusion)
148 withVoAmrwbenc ? withFullDeps && withVersion3, # AMR-WB encoder
149 withVorbis ? withHeadlessDeps, # Vorbis de/encoding, native encoder exists
150 withVpl ? withFullDeps && stdenv.hostPlatform.isLinux, # Hardware acceleration via intel libvpl
151 withVpx ? withHeadlessDeps && stdenv.buildPlatform == stdenv.hostPlatform, # VP8 & VP9 de/encoding
152 withVulkan ? withHeadlessDeps && !stdenv.hostPlatform.isDarwin,
153 withVvenc ? withFullDeps && lib.versionAtLeast version "7.1", # H.266/VVC encoding
154 withWebp ? withHeadlessDeps, # WebP encoder
155 withX264 ? withHeadlessDeps && withGPL, # H.264/AVC encoder
156 withX265 ? withHeadlessDeps && withGPL, # H.265/HEVC encoder
157 withXavs ? withFullDeps && withGPL, # AVS encoder
158 withXavs2 ? withFullDeps && withGPL, # AVS2 encoder
159 withXcb ? withXcbShm || withXcbxfixes || withXcbShape, # X11 grabbing using XCB
160 withXcbShape ? withFullDeps, # X11 grabbing shape rendering
161 withXcbShm ? withFullDeps, # X11 grabbing shm communication
162 withXcbxfixes ? withFullDeps, # X11 grabbing mouse rendering
163 withXevd ? withFullDeps && lib.versionAtLeast version "7.1" && !xevd.meta.broken, # MPEG-5 EVC decoding
164 withXeve ? withFullDeps && lib.versionAtLeast version "7.1" && !xeve.meta.broken, # MPEG-5 EVC encoding
165 withXlib ? withFullDeps, # Xlib support
166 withXml2 ? withHeadlessDeps, # libxml2 support, for IMF and DASH demuxers
167 withXvid ? withHeadlessDeps && withGPL, # Xvid encoder, native encoder exists
168 withZimg ? withHeadlessDeps,
169 withZlib ? withHeadlessDeps,
170 withZmq ? withFullDeps, # Message passing
171 withZvbi ? withHeadlessDeps, # Teletext support
172
173 # Licensing options (yes some are listed twice, filters and such are not listed)
174 withGPL ? true,
175 withVersion3 ? true, # When withGPL is set this implies GPLv3 otherwise it is LGPLv3
176 withGPLv3 ? withGPL && withVersion3,
177 withUnfree ? false,
178
179 # Build options
180 withSmallBuild ? false, # Optimize for size instead of speed
181 withRuntimeCPUDetection ? true, # Detect CPU capabilities at runtime (disable to compile natively)
182 withGrayscale ? withFullDeps, # Full grayscale support
183 withSwscaleAlpha ? buildSwscale, # Alpha channel support in swscale. You probably want this when buildSwscale.
184 withHardcodedTables ? withHeadlessDeps, # Hardcode decode tables instead of runtime generation
185 withSafeBitstreamReader ? withHeadlessDeps, # Buffer boundary checking in bitreaders
186 withMultithread ? true, # Multithreading via pthreads/win32 threads
187 withNetwork ? withHeadlessDeps, # Network support
188 withPixelutils ? withHeadlessDeps, # Pixel utils in libavutil
189 withStatic ? stdenv.hostPlatform.isStatic,
190 withShared ? !stdenv.hostPlatform.isStatic,
191 withPic ? true,
192 withThumb ? false, # On some ARM platforms
193
194 # Program options
195 buildFfmpeg ? withHeadlessDeps, # Build ffmpeg executable
196 buildFfplay ? withSmallDeps, # Build ffplay executable
197 buildFfprobe ? withHeadlessDeps, # Build ffprobe executable
198 buildQtFaststart ? withFullDeps, # Build qt-faststart executable
199 withBin ? buildFfmpeg || buildFfplay || buildFfprobe || buildQtFaststart,
200 # Library options
201 buildAvcodec ? withHeadlessDeps, # Build avcodec library
202 buildAvdevice ? withHeadlessDeps, # Build avdevice library
203 buildAvfilter ? withHeadlessDeps, # Build avfilter library
204 buildAvformat ? withHeadlessDeps, # Build avformat library
205 # Deprecated but depended upon by some packages.
206 # https://github.com/NixOS/nixpkgs/pull/211834#issuecomment-1417435991)
207 buildAvresample ? withHeadlessDeps && lib.versionOlder version "5", # Build avresample library
208 buildAvutil ? withHeadlessDeps, # Build avutil library
209 buildPostproc ? withHeadlessDeps, # Build postproc library
210 buildSwresample ? withHeadlessDeps, # Build swresample library
211 buildSwscale ? withHeadlessDeps, # Build swscale library
212 withLib ?
213 buildAvcodec
214 || buildAvdevice
215 || buildAvfilter
216 || buildAvformat
217 || buildAvutil
218 || buildPostproc
219 || buildSwresample
220 || buildSwscale,
221 # Documentation options
222 withDocumentation ? withHtmlDoc || withManPages || withPodDoc || withTxtDoc,
223 withHtmlDoc ? withHeadlessDeps, # HTML documentation pages
224 withManPages ? withHeadlessDeps, # Man documentation pages
225 withPodDoc ? withHeadlessDeps, # POD documentation pages
226 withTxtDoc ? withHeadlessDeps, # Text documentation pages
227 # Whether a "doc" output will be produced. Note that withManPages does not produce
228 # a "doc" output because its files go to "man".
229 withDoc ? withDocumentation && (withHtmlDoc || withPodDoc || withTxtDoc),
230
231 # Developer options
232 withDebug ? false,
233 withOptimisations ? true,
234 withExtraWarnings ? false,
235 withStripping ? false,
236
237 # External libraries options
238 alsa-lib,
239 amf,
240 amf-headers,
241 aribb24,
242 avisynthplus,
243 bzip2,
244 celt,
245 chromaprint,
246 codec2,
247 clang,
248 dav1d,
249 davs2,
250 fdk_aac,
251 flite,
252 fontconfig,
253 freetype,
254 frei0r,
255 fribidi,
256 game-music-emu,
257 gnutls,
258 gsm,
259 harfbuzz,
260 intel-media-sdk,
261 kvazaar,
262 ladspaH,
263 lame,
264 lcevcdec,
265 lcms2,
266 libaom,
267 libaribcaption,
268 libass,
269 libbluray,
270 libbs2b,
271 libcaca,
272 libcdio,
273 libcdio-paranoia,
274 libdc1394,
275 libdrm,
276 libdvdnav,
277 libdvdread,
278 libGL,
279 libGLU,
280 libiconv,
281 libilbc,
282 libjack2,
283 libjxl,
284 liblc3,
285 libmodplug,
286 libmysofa,
287 libopenmpt,
288 libopus,
289 libplacebo,
290 libplacebo_5,
291 libpulseaudio,
292 libraw1394,
293 librist,
294 librsvg,
295 libssh,
296 libtensorflow,
297 libtheora,
298 libv4l,
299 libva,
300 libva-minimal,
301 libvdpau,
302 libvmaf,
303 libvorbis,
304 libvpl,
305 libvpx,
306 libwebp,
307 libX11,
308 libxcb,
309 libXext,
310 libxml2,
311 libXv,
312 nv-codec-headers,
313 nv-codec-headers-12,
314 ocl-icd, # OpenCL ICD
315 openal,
316 opencl-headers, # OpenCL headers
317 opencore-amr,
318 openh264,
319 openjpeg,
320 qrencode,
321 quirc,
322 rav1e,
323 rtmpdump,
324 rubberband,
325 twolame,
326 samba,
327 SDL2,
328 shaderc,
329 shine,
330 snappy,
331 soxr,
332 speex,
333 srt,
334 svt-av1,
335 uavs3d,
336 vid-stab,
337 vo-amrwbenc,
338 vulkan-headers,
339 vulkan-loader,
340 vvenc,
341 x264,
342 x265,
343 xavs,
344 xavs2,
345 xevd,
346 xeve,
347 xvidcore,
348 xz,
349 zeromq,
350 zimg,
351 zlib,
352 zvbi,
353 # Darwin
354 apple-sdk_15,
355 xcode, # unfree contains metalcc and metallib
356 # Cuda Packages
357 cuda_cudart,
358 cuda_nvcc,
359 libnpp,
360 # Testing
361 testers,
362}:
363
364/*
365 Maintainer notes:
366
367 Version bumps:
368 It should always be safe to bump patch releases (e.g. 2.1.x, x being a patch release)
369 If adding a new branch, note any configure flags that were added, changed, or deprecated/removed
370 and make the necessary changes.
371
372 Known issues:
373 Cross-compiling will disable features not present on host OS
374 (e.g. dxva2 support [DirectX] will not be enabled unless natively compiled on Cygwin)
375*/
376
377let
378 inherit (lib)
379 optional
380 optionals
381 optionalString
382 enableFeature
383 versionOlder
384 versionAtLeast
385 ;
386in
387
388assert lib.elem ffmpegVariant [
389 "headless"
390 "small"
391 "full"
392];
393
394# Licensing dependencies
395assert withGPLv3 -> withGPL && withVersion3;
396
397# Build dependencies
398assert withPixelutils -> buildAvutil;
399assert !(withMfx && withVpl); # incompatible features
400# Program dependencies
401assert
402 buildFfmpeg
403 -> buildAvcodec && buildAvfilter && buildAvformat && (buildSwresample || buildAvresample);
404assert
405 buildFfplay
406 -> buildAvcodec && buildAvformat && buildSwscale && (buildSwresample || buildAvresample);
407assert buildFfprobe -> buildAvcodec && buildAvformat;
408# Library dependencies
409assert buildAvcodec -> buildAvutil; # configure flag since 0.6
410assert buildAvdevice -> buildAvformat && buildAvcodec && buildAvutil; # configure flag since 0.6
411assert buildAvformat -> buildAvcodec && buildAvutil; # configure flag since 0.6
412assert buildPostproc -> buildAvutil;
413assert buildSwscale -> buildAvutil;
414
415# External Library dependencies
416assert (withCuda || withCuvid || withNvdec || withNvenc) -> withNvcodec;
417
418stdenv.mkDerivation (
419 finalAttrs:
420 {
421 pname = "ffmpeg" + (optionalString (ffmpegVariant != "small") "-${ffmpegVariant}");
422 inherit version;
423 src = source;
424
425 postPatch = ''
426 patchShebangs .
427 ''
428 + lib.optionalString withFrei0r ''
429 substituteInPlace libavfilter/vf_frei0r.c \
430 --replace /usr/local/lib/frei0r-1 ${frei0r}/lib/frei0r-1
431 substituteInPlace doc/filters.texi \
432 --replace /usr/local/lib/frei0r-1 ${frei0r}/lib/frei0r-1
433 '';
434
435 patches =
436 [ ]
437 ++ optionals (lib.versionOlder version "5") [
438 (fetchpatch2 {
439 name = "rename_iszero";
440 url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/b27ae2c0b704e83f950980102bc3f12f9ec17cb0";
441 hash = "sha256-l1t4LcUDSW757diNu69NzvjenW5Mxb5aYtXz64Yl9gs=";
442 })
443 ]
444 ++ optionals (lib.versionAtLeast version "5.1") [
445 ./nvccflags-cpp14.patch
446 ]
447 ++ optionals (lib.versionAtLeast version "6.1" && lib.versionOlder version "6.2") [
448 (fetchpatch2 {
449 # this can be removed post 6.1
450 name = "fix_build_failure_due_to_PropertyKey_EncoderID";
451 url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/cb049d377f54f6b747667a93e4b719380c3e9475";
452 hash = "sha256-sxRXKKgUak5vsQTiV7ge8vp+N22CdTIvuczNgVRP72c=";
453 })
454 (fetchpatch2 {
455 name = "CVE-2024-31582.patch";
456 url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/99debe5f823f45a482e1dc08de35879aa9c74bd2";
457 hash = "sha256-+CQ9FXR6Vr/AmsbXFiCUXZcxKj1s8nInEdke/Oc/kUA=";
458 })
459 (fetchpatch2 {
460 name = "CVE-2024-31578.patch";
461 url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/3bb00c0a420c3ce83c6fafee30270d69622ccad7";
462 hash = "sha256-oZMZysBA+/gwaGEM1yvI+8wCadXWE7qLRL6Emap3b8Q=";
463 })
464 (fetchpatch2 {
465 name = "CVE-2023-49501.patch";
466 url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/4adb93dff05dd947878c67784d98c9a4e13b57a7";
467 hash = "sha256-7cwktto3fPMDGvCZCVtB01X8Q9S/4V4bDLUICSNfGgw=";
468 })
469 (fetchpatch2 {
470 name = "CVE-2023-49502.patch";
471 url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/737ede405b11a37fdd61d19cf25df296a0cb0b75";
472 hash = "sha256-mpSJwR9TX5ENjjCKvzuM/9e1Aj/AOiQW0+72oOMl9v8=";
473 })
474 (fetchpatch2 {
475 name = "CVE-2023-50007.patch";
476 url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/b1942734c7cbcdc9034034373abcc9ecb9644c47";
477 hash = "sha256-v0hNcqBtm8GCGAU9UbRUCE0slodOjZCHrkS8e4TrVcQ=";
478 })
479 (fetchpatch2 {
480 name = "CVE-2023-50008.patch";
481 url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/5f87a68cf70dafeab2fb89b42e41a4c29053b89b";
482 hash = "sha256-sqUUSOPTPLwu2h8GbAw4SfEf+0oWioz52BcpW1n4v3Y=";
483 })
484 ]
485 ++ optionals (lib.versionOlder version "7.1.1") [
486 (fetchpatch2 {
487 name = "texinfo-7.1.patch";
488 url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/4d9cdf82ee36a7da4f065821c86165fe565aeac2";
489 hash = "sha256-BZsq1WI6OgtkCQE8koQu0CNcb5c8WgTu/LzQzu6ZLuo=";
490 })
491 ]
492 ++ optionals (lib.versionOlder version "7" && stdenv.hostPlatform.isAarch32) [
493 (fetchpatch2 {
494 name = "binutils-2-43-compat.patch";
495 url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/654bd47716c4f36719fb0f3f7fd8386d5ed0b916";
496 hash = "sha256-OLiQHKBNp2p63ZmzBBI4GEGz3WSSP+rMd8ITfZSVRgY=";
497 })
498 ]
499 ++ optionals (lib.versionAtLeast version "7.1" && lib.versionOlder version "7.1.1") [
500 ./fix-fate-ffmpeg-spec-disposition-7.1.patch
501 ]
502 ++ optionals (lib.versionAtLeast version "7.1.1") [
503 # Expose a private API for Chromium / Qt WebEngine.
504 (fetchpatch2 {
505 url = "https://gitlab.archlinux.org/archlinux/packaging/packages/ffmpeg/-/raw/a02c1a15706ea832c0d52a4d66be8fb29499801a/add-av_stream_get_first_dts-for-chromium.patch";
506 hash = "sha256-DbH6ieJwDwTjKOdQ04xvRcSLeeLP2Z2qEmqeo8HsPr4=";
507 })
508 ]
509 ++ optionals (lib.versionOlder version "7.2") [
510 (fetchpatch2 {
511 name = "unbreak-svt-av1-3.0.0.patch";
512 url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/d1ed5c06e3edc5f2b5f3664c80121fa55b0baa95";
513 hash = "sha256-2NVkIhQVS1UQJVYuDdeH+ZvWYKVbtwW9Myu5gx7JnbA=";
514 })
515 ];
516
517 configurePlatforms = [ ];
518 setOutputFlags = false; # Only accepts some of them
519 configureFlags = [
520 #mingw64 is internally treated as mingw32, so 32 and 64 make no difference here
521 "--target_os=${
522 if stdenv.hostPlatform.isMinGW then "mingw64" else stdenv.hostPlatform.parsed.kernel.name
523 }"
524 "--arch=${stdenv.hostPlatform.parsed.cpu.name}"
525 "--pkg-config=${buildPackages.pkg-config.targetPrefix}pkg-config"
526 # Licensing flags
527 (enableFeature withGPL "gpl")
528 (enableFeature withVersion3 "version3")
529 (enableFeature withUnfree "nonfree")
530 # Build flags
531 (enableFeature withStatic "static")
532 (enableFeature withShared "shared")
533 (enableFeature withPic "pic")
534 (enableFeature withThumb "thumb")
535
536 (enableFeature withSmallBuild "small")
537 (enableFeature withRuntimeCPUDetection "runtime-cpudetect")
538 (enableFeature withGrayscale "gray")
539 (enableFeature withSwscaleAlpha "swscale-alpha")
540 (enableFeature withHardcodedTables "hardcoded-tables")
541 (enableFeature withSafeBitstreamReader "safe-bitstream-reader")
542
543 (enableFeature (withMultithread && stdenv.hostPlatform.isUnix) "pthreads")
544 (enableFeature (withMultithread && stdenv.hostPlatform.isWindows) "w32threads")
545 "--disable-os2threads" # We don't support OS/2
546
547 (enableFeature withNetwork "network")
548 (enableFeature withPixelutils "pixelutils")
549
550 "--datadir=${placeholder "data"}/share/ffmpeg"
551
552 # Program flags
553 (enableFeature buildFfmpeg "ffmpeg")
554 (enableFeature buildFfplay "ffplay")
555 (enableFeature buildFfprobe "ffprobe")
556 ]
557 ++ optionals withBin [
558 "--bindir=${placeholder "bin"}/bin"
559 ]
560 ++ [
561 # Library flags
562 (enableFeature buildAvcodec "avcodec")
563 (enableFeature buildAvdevice "avdevice")
564 (enableFeature buildAvfilter "avfilter")
565 (enableFeature buildAvformat "avformat")
566 ]
567 ++ optionals (lib.versionOlder version "5") [
568 # Ffmpeg > 4 doesn't know about the flag anymore
569 (enableFeature buildAvresample "avresample")
570 ]
571 ++ [
572 (enableFeature buildAvutil "avutil")
573 (enableFeature (buildPostproc && withGPL) "postproc")
574 (enableFeature buildSwresample "swresample")
575 (enableFeature buildSwscale "swscale")
576 ]
577 ++ optionals withLib [
578 "--libdir=${placeholder "lib"}/lib"
579 "--incdir=${placeholder "dev"}/include"
580 ]
581 ++ [
582 # Documentation flags
583 (enableFeature withDocumentation "doc")
584 (enableFeature withHtmlDoc "htmlpages")
585 (enableFeature withManPages "manpages")
586 ]
587 ++ optionals withManPages [
588 "--mandir=${placeholder "man"}/share/man"
589 ]
590 ++ [
591 (enableFeature withPodDoc "podpages")
592 (enableFeature withTxtDoc "txtpages")
593 ]
594 ++ optionals withDoc [
595 "--docdir=${placeholder "doc"}/share/doc/ffmpeg"
596 ]
597 ++ [
598 # External libraries
599 (enableFeature withAlsa "alsa")
600 (enableFeature withAmf "amf")
601 (enableFeature withAom "libaom")
602 (enableFeature withAribb24 "libaribb24")
603 ]
604 ++ optionals (versionAtLeast version "6.1") [
605 (enableFeature withAribcaption "libaribcaption")
606 ]
607 ++ [
608 (enableFeature withAss "libass")
609 (enableFeature withAvisynth "avisynth")
610 (enableFeature withBluray "libbluray")
611 (enableFeature withBs2b "libbs2b")
612 (enableFeature withBzlib "bzlib")
613 (enableFeature withCaca "libcaca")
614 (enableFeature withCdio "libcdio")
615 (enableFeature withCelt "libcelt")
616 (enableFeature withChromaprint "chromaprint")
617 (enableFeature withCodec2 "libcodec2")
618 (enableFeature withCuda "cuda")
619 (enableFeature withCudaLLVM "cuda-llvm")
620 (enableFeature withCudaNVCC "cuda-nvcc")
621 (enableFeature withCuvid "cuvid")
622 (enableFeature withDav1d "libdav1d")
623 (enableFeature withDavs2 "libdavs2")
624 (enableFeature withDc1394 "libdc1394")
625 (enableFeature withDrm "libdrm")
626 ]
627 ++ optionals (versionAtLeast version "7") [
628 (enableFeature withDvdnav "libdvdnav")
629 (enableFeature withDvdread "libdvdread")
630 ]
631 ++ [
632 (enableFeature withFdkAac "libfdk-aac")
633 (enableFeature withNvcodec "ffnvcodec")
634 (enableFeature withFlite "libflite")
635 (enableFeature withFontconfig "fontconfig")
636 (enableFeature withFontconfig "libfontconfig")
637 (enableFeature withFreetype "libfreetype")
638 (enableFeature withFrei0r "frei0r")
639 (enableFeature withFribidi "libfribidi")
640 (enableFeature withGme "libgme")
641 (enableFeature withGnutls "gnutls")
642 (enableFeature withGsm "libgsm")
643 ]
644 ++ optionals (versionAtLeast version "6.1") [
645 (enableFeature withHarfbuzz "libharfbuzz")
646 ]
647 ++ [
648 (enableFeature withIconv "iconv")
649 (enableFeature withIlbc "libilbc")
650 (enableFeature withJack "libjack")
651 ]
652 ++ optionals (versionAtLeast finalAttrs.version "5.0") [
653 (enableFeature withJxl "libjxl")
654 ]
655 ++ [
656 (enableFeature withKvazaar "libkvazaar")
657 (enableFeature withLadspa "ladspa")
658 ]
659 ++ optionals (versionAtLeast version "7.1") [
660 (enableFeature withLc3 "liblc3")
661 (enableFeature withLcevcdec "liblcevc-dec")
662 ]
663 ++ optionals (versionAtLeast version "5.1") [
664 (enableFeature withLcms2 "lcms2")
665 ]
666 ++ [
667 (enableFeature withLzma "lzma")
668 ]
669 ++ optionals (versionAtLeast version "5.0") [
670 (enableFeature withMetal "metal")
671 ]
672 ++ [
673 (enableFeature withMfx "libmfx")
674 (enableFeature withModplug "libmodplug")
675 (enableFeature withMp3lame "libmp3lame")
676 (enableFeature withMysofa "libmysofa")
677 (enableFeature withNpp "libnpp")
678 (enableFeature withNvdec "nvdec")
679 (enableFeature withNvenc "nvenc")
680 (enableFeature withOpenal "openal")
681 (enableFeature withOpencl "opencl")
682 (enableFeature withOpencoreAmrnb "libopencore-amrnb")
683 (enableFeature withOpencoreAmrwb "libopencore-amrwb")
684 (enableFeature withOpengl "opengl")
685 (enableFeature withOpenh264 "libopenh264")
686 (enableFeature withOpenjpeg "libopenjpeg")
687 (enableFeature withOpenmpt "libopenmpt")
688 (enableFeature withOpus "libopus")
689 ]
690 ++ optionals (versionAtLeast version "5.0") [
691 (enableFeature withPlacebo "libplacebo")
692 ]
693 ++ [
694 (enableFeature withPulse "libpulse")
695 ]
696 ++ optionals (versionAtLeast version "7") [
697 (enableFeature withQrencode "libqrencode")
698 (enableFeature withQuirc "libquirc")
699 ]
700 ++ [
701 (enableFeature withRav1e "librav1e")
702 (enableFeature withRist "librist")
703 (enableFeature withRtmp "librtmp")
704 (enableFeature withRubberband "librubberband")
705 (enableFeature withSamba "libsmbclient")
706 (enableFeature withSdl2 "sdl2")
707 ]
708 ++ optionals (versionAtLeast version "5.0") [
709 (enableFeature withShaderc "libshaderc")
710 ]
711 ++ [
712 (enableFeature withShine "libshine")
713 (enableFeature withSnappy "libsnappy")
714 (enableFeature withSoxr "libsoxr")
715 (enableFeature withSpeex "libspeex")
716 (enableFeature withSrt "libsrt")
717 (enableFeature withSsh "libssh")
718 (enableFeature withSvg "librsvg")
719 (enableFeature withSvtav1 "libsvtav1")
720 (enableFeature withTensorflow "libtensorflow")
721 (enableFeature withTheora "libtheora")
722 (enableFeature withTwolame "libtwolame")
723 (enableFeature withUavs3d "libuavs3d")
724 (enableFeature withV4l2 "libv4l2")
725 (enableFeature withV4l2M2m "v4l2-m2m")
726 (enableFeature withVaapi "vaapi")
727 (enableFeature withVdpau "vdpau")
728 ]
729 ++ optionals (versionAtLeast version "6.0") [
730 (enableFeature withVpl "libvpl")
731 ]
732 ++ [
733 (enableFeature withVidStab "libvidstab") # Actual min. version 2.0
734 (enableFeature withVmaf "libvmaf")
735 (enableFeature withVoAmrwbenc "libvo-amrwbenc")
736 (enableFeature withVorbis "libvorbis")
737 (enableFeature withVpx "libvpx")
738 (enableFeature withVulkan "vulkan")
739 ]
740 ++ optionals (versionAtLeast version "7.1") [
741 (enableFeature withVvenc "libvvenc")
742 ]
743 ++ [
744 (enableFeature withWebp "libwebp")
745 (enableFeature withX264 "libx264")
746 (enableFeature withX265 "libx265")
747 (enableFeature withXavs "libxavs")
748 (enableFeature withXavs2 "libxavs2")
749 (enableFeature withXcb "libxcb")
750 (enableFeature withXcbShape "libxcb-shape")
751 (enableFeature withXcbShm "libxcb-shm")
752 (enableFeature withXcbxfixes "libxcb-xfixes")
753 ]
754 ++ optionals (versionAtLeast version "7") [
755 (enableFeature withXevd "libxevd")
756 (enableFeature withXeve "libxeve")
757 ]
758 ++ [
759 (enableFeature withXlib "xlib")
760 (enableFeature withXml2 "libxml2")
761 (enableFeature withXvid "libxvid")
762 (enableFeature withZimg "libzimg")
763 (enableFeature withZlib "zlib")
764 (enableFeature withZmq "libzmq")
765 (enableFeature withZvbi "libzvbi")
766 # Developer flags
767 (enableFeature withDebug "debug")
768 (enableFeature withOptimisations "optimizations")
769 (enableFeature withExtraWarnings "extra-warnings")
770 (enableFeature withStripping "stripping")
771 ]
772 ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
773 "--cross-prefix=${stdenv.cc.targetPrefix}"
774 "--enable-cross-compile"
775 "--host-cc=${buildPackages.stdenv.cc}/bin/cc"
776 ]
777 ++ optionals stdenv.cc.isClang [
778 "--cc=${stdenv.cc.targetPrefix}clang"
779 "--cxx=${stdenv.cc.targetPrefix}clang++"
780 ]
781 ++ optionals withMetal [
782 "--metalcc=${xcode}/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal"
783 "--metallib=${xcode}/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metallib"
784 ];
785
786 # ffmpeg embeds the configureFlags verbatim in its binaries and because we
787 # configure binary, include, library dir etc., this causes references in
788 # outputs where we don't want them. Patch the generated config.h to remove all
789 # such references except for data.
790 postConfigure =
791 let
792 toStrip =
793 map placeholder (lib.remove "data" finalAttrs.outputs) # We want to keep references to the data dir.
794 ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) buildPackages.stdenv.cc
795 ++ lib.optional withMetal xcode;
796 in
797 "remove-references-to ${lib.concatStringsSep " " (map (o: "-t ${o}") toStrip)} config.h";
798
799 strictDeps = true;
800
801 nativeBuildInputs = [
802 removeReferencesTo
803 addDriverRunpath
804 perl
805 pkg-config
806 yasm
807 ]
808 # Texinfo version 7.1 introduced breaking changes, which older versions of ffmpeg do not handle.
809 ++ (if versionOlder version "5" then [ texinfo6 ] else [ texinfo ])
810 ++ optionals withCudaLLVM [ clang ]
811 ++ optionals withCudaNVCC [ cuda_nvcc ];
812
813 buildInputs =
814 [ ]
815 ++ optionals stdenv.hostPlatform.isDarwin [ apple-sdk_15 ]
816 ++ optionals withAlsa [ alsa-lib ]
817 ++ optionals withAmf [ amf-headers ]
818 ++ optionals withAom [ libaom ]
819 ++ optionals withAribb24 [ aribb24 ]
820 ++ optionals withAribcaption [ libaribcaption ]
821 ++ optionals withAss [ libass ]
822 ++ optionals withAvisynth [ avisynthplus ]
823 ++ optionals withBluray [ libbluray ]
824 ++ optionals withBs2b [ libbs2b ]
825 ++ optionals withBzlib [ bzip2 ]
826 ++ optionals withCaca [ libcaca ]
827 ++ optionals withCdio [
828 libcdio
829 libcdio-paranoia
830 ]
831 ++ optionals withCelt [ celt ]
832 ++ optionals withChromaprint [ chromaprint ]
833 ++ optionals withCodec2 [ codec2 ]
834 ++ optionals withCudaNVCC [
835 cuda_cudart
836 cuda_nvcc
837 ]
838 ++ optionals withDav1d [ dav1d ]
839 ++ optionals withDavs2 [ davs2 ]
840 ++ optionals withDc1394 ([ libdc1394 ] ++ (lib.optional stdenv.hostPlatform.isLinux libraw1394))
841 ++ optionals withDrm [ libdrm ]
842 ++ optionals withDvdnav [ libdvdnav ]
843 ++ optionals withDvdread [ libdvdread ]
844 ++ optionals withFdkAac [ fdk_aac ]
845 ++ optionals withNvcodec [
846 (if (lib.versionAtLeast version "6") then nv-codec-headers-12 else nv-codec-headers)
847 ]
848 ++ optionals withFlite [ flite ]
849 ++ optionals withFontconfig [ fontconfig ]
850 ++ optionals withFreetype [ freetype ]
851 ++ optionals withFrei0r [ frei0r ]
852 ++ optionals withFribidi [ fribidi ]
853 ++ optionals withGme [ game-music-emu ]
854 ++ optionals withGnutls [ gnutls ]
855 ++ optionals withGsm [ gsm ]
856 ++ optionals withHarfbuzz [ harfbuzz ]
857 ++ optionals withIconv [ libiconv ] # On Linux this should be in libc, do we really need it?
858 ++ optionals withIlbc [ libilbc ]
859 ++ optionals withJack [ libjack2 ]
860 ++ optionals withJxl [ libjxl ]
861 ++ optionals withKvazaar [ kvazaar ]
862 ++ optionals withLadspa [ ladspaH ]
863 ++ optionals withLc3 [ liblc3 ]
864 ++ optionals withLcevcdec [ lcevcdec ]
865 ++ optionals withLcms2 [ lcms2 ]
866 ++ optionals withLzma [ xz ]
867 ++ optionals withMfx [ intel-media-sdk ]
868 ++ optionals withModplug [ libmodplug ]
869 ++ optionals withMp3lame [ lame ]
870 ++ optionals withMysofa [ libmysofa ]
871 ++ optionals withNpp [
872 libnpp
873 cuda_cudart
874 cuda_nvcc
875 ]
876 ++ optionals withOpenal [ openal ]
877 ++ optionals withOpencl [
878 ocl-icd
879 opencl-headers
880 ]
881 ++ optionals (withOpencoreAmrnb || withOpencoreAmrwb) [ opencore-amr ]
882 ++ optionals withOpengl [
883 libGL
884 libGLU
885 ]
886 ++ optionals withOpenh264 [ openh264 ]
887 ++ optionals withOpenjpeg [ openjpeg ]
888 ++ optionals withOpenmpt [ libopenmpt ]
889 ++ optionals withOpus [ libopus ]
890 ++ optionals withPlacebo [
891 (if (lib.versionAtLeast version "6.1") then libplacebo else libplacebo_5)
892 vulkan-headers
893 ]
894 ++ optionals withPulse [ libpulseaudio ]
895 ++ optionals withQrencode [ qrencode ]
896 ++ optionals withQuirc [ quirc ]
897 ++ optionals withRav1e [ rav1e ]
898 ++ optionals withRist [ librist ]
899 ++ optionals withRtmp [ rtmpdump ]
900 ++ optionals withRubberband [ rubberband ]
901 ++ optionals withSamba [ samba ]
902 ++ optionals withSdl2 [ SDL2 ]
903 ++ optionals withShaderc [ shaderc ]
904 ++ optionals withShine [ shine ]
905 ++ optionals withSnappy [ snappy ]
906 ++ optionals withSoxr [ soxr ]
907 ++ optionals withSpeex [ speex ]
908 ++ optionals withSrt [ srt ]
909 ++ optionals withSsh [ libssh ]
910 ++ optionals withSvg [ librsvg ]
911 ++ optionals withSvtav1 [ svt-av1 ]
912 ++ optionals withTensorflow [ libtensorflow ]
913 ++ optionals withTheora [ libtheora ]
914 ++ optionals withTwolame [ twolame ]
915 ++ optionals withUavs3d [ uavs3d ]
916 ++ optionals withV4l2 [ libv4l ]
917 ++ optionals withVaapi [ (if withSmallDeps then libva else libva-minimal) ]
918 ++ optionals withVdpau [ libvdpau ]
919 ++ optionals withVidStab [ vid-stab ]
920 ++ optionals withVmaf [ libvmaf ]
921 ++ optionals withVoAmrwbenc [ vo-amrwbenc ]
922 ++ optionals withVorbis [ libvorbis ]
923 ++ optionals withVpl [ libvpl ]
924 ++ optionals withVpx [ libvpx ]
925 ++ optionals withVulkan [
926 vulkan-headers
927 vulkan-loader
928 ]
929 ++ optionals withVvenc [ vvenc ]
930 ++ optionals withWebp [ libwebp ]
931 ++ optionals withX264 [ x264 ]
932 ++ optionals withX265 [ x265 ]
933 ++ optionals withXavs [ xavs ]
934 ++ optionals withXavs2 [ xavs2 ]
935 ++ optionals withXcb [ libxcb ]
936 ++ optionals withXevd [ xevd ]
937 ++ optionals withXeve [ xeve ]
938 ++ optionals withXlib [
939 libX11
940 libXv
941 libXext
942 ]
943 ++ optionals withXml2 [ libxml2 ]
944 ++ optionals withXvid [ xvidcore ]
945 ++ optionals withZimg [ zimg ]
946 ++ optionals withZlib [ zlib ]
947 ++ optionals withZmq [ zeromq ]
948 ++ optionals withZvbi [ zvbi ];
949
950 buildFlags = [ "all" ] ++ optional buildQtFaststart "tools/qt-faststart"; # Build qt-faststart executable
951
952 env = lib.optionalAttrs stdenv.cc.isGNU {
953 NIX_CFLAGS_COMPILE = toString [
954 "-Wno-error=incompatible-pointer-types"
955 "-Wno-error=int-conversion"
956 ];
957 };
958
959 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
960
961 # Fails with SIGABRT otherwise FIXME: Why?
962 checkPhase =
963 let
964 ldLibraryPathEnv = if stdenv.hostPlatform.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
965 libsToLink =
966 [ ]
967 ++ optional buildAvcodec "libavcodec"
968 ++ optional buildAvdevice "libavdevice"
969 ++ optional buildAvfilter "libavfilter"
970 ++ optional buildAvformat "libavformat"
971 ++ optional buildAvresample "libavresample"
972 ++ optional buildAvutil "libavutil"
973 ++ optional buildPostproc "libpostproc"
974 ++ optional buildSwresample "libswresample"
975 ++ optional buildSwscale "libswscale";
976 in
977 ''
978 ${ldLibraryPathEnv}="${lib.concatStringsSep ":" libsToLink}" make check -j$NIX_BUILD_CORES
979 '';
980
981 outputs =
982 optionals withBin [ "bin" ] # The first output is the one that gets symlinked by default!
983 ++ optionals withLib [
984 "lib"
985 "dev"
986 ]
987 ++ optionals withDoc [ "doc" ]
988 ++ optionals withManPages [ "man" ]
989 ++ [
990 "data"
991 "out"
992 ] # We need an "out" output because we get an error otherwise. It's just an empty dir.
993 ;
994
995 postInstall = optionalString buildQtFaststart ''
996 install -D tools/qt-faststart -t $bin/bin
997 '';
998
999 # Set RUNPATH so that libnvcuvid and libcuda in /run/opengl-driver(-32)/lib can be found.
1000 # See the explanation in addDriverRunpath.
1001 postFixup =
1002 optionalString (stdenv.hostPlatform.isLinux && withLib) ''
1003 addDriverRunpath ${placeholder "lib"}/lib/libavcodec.so
1004 addDriverRunpath ${placeholder "lib"}/lib/libavutil.so
1005 ''
1006 # https://trac.ffmpeg.org/ticket/10809
1007 + optionalString (versionAtLeast version "5.0" && withVulkan && !stdenv.hostPlatform.isMinGW) ''
1008 patchelf $lib/lib/libavcodec.so --add-needed libvulkan.so --add-rpath ${
1009 lib.makeLibraryPath [ vulkan-loader ]
1010 }
1011 '';
1012
1013 enableParallelBuilding = true;
1014
1015 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
1016
1017 meta = with lib; {
1018 description = "Complete, cross-platform solution to record, convert and stream audio and video";
1019 homepage = "https://www.ffmpeg.org/";
1020 changelog = "https://github.com/FFmpeg/FFmpeg/blob/n${version}/Changelog";
1021 longDescription = ''
1022 FFmpeg is the leading multimedia framework, able to decode, encode, transcode,
1023 mux, demux, stream, filter and play pretty much anything that humans and machines
1024 have created. It supports the most obscure ancient formats up to the cutting edge.
1025 No matter if they were designed by some standards committee, the community or
1026 a corporation.
1027 '';
1028 license =
1029 with licenses;
1030 [ lgpl21Plus ]
1031 ++ optional withGPL gpl2Plus
1032 ++ optional withVersion3 lgpl3Plus
1033 ++ optional withGPLv3 gpl3Plus
1034 ++ optional withUnfree unfreeRedistributable
1035 ++ optional (withGPL && withUnfree) unfree;
1036 pkgConfigModules =
1037 [ ]
1038 ++ optional buildAvcodec "libavcodec"
1039 ++ optional buildAvdevice "libavdevice"
1040 ++ optional buildAvfilter "libavfilter"
1041 ++ optional buildAvformat "libavformat"
1042 ++ optional buildAvresample "libavresample"
1043 ++ optional buildAvutil "libavutil"
1044 ++ optional buildPostproc "libpostproc"
1045 ++ optional buildSwresample "libswresample"
1046 ++ optional buildSwscale "libswscale";
1047 platforms = platforms.all;
1048 # See https://github.com/NixOS/nixpkgs/pull/295344#issuecomment-1992263658
1049 broken = stdenv.hostPlatform.isMinGW && stdenv.hostPlatform.is64bit;
1050 maintainers = with maintainers; [
1051 atemu
1052 jopejoe1
1053 emily
1054 ];
1055 mainProgram = "ffmpeg";
1056 };
1057 }
1058 // lib.optionalAttrs withCudaLLVM {
1059 # remove once https://github.com/NixOS/nixpkgs/issues/318674 is addressed properly
1060 hardeningDisable = [
1061 "pacret"
1062 "shadowstack"
1063 "zerocallusedregs"
1064 ];
1065 }
1066)