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