37
37
source_url = "https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.13.tar.xz" ,
38
38
build_arguments = ["--without-python" ],
39
39
community = True ,
40
- )
40
+ ),
41
41
]
42
42
43
43
gnutls_group = [
187
187
build_arguments = (
188
188
[r"-DOPENSSL_ROOT_DIR=C:\Program Files\OpenSSL" ]
189
189
if plat == "Windows"
190
- else ["-DENABLE_ENCRYPTION=OFF" ] if plat == "Darwin" else ["" ]
190
+ else ["-DENABLE_ENCRYPTION=OFF" ]
191
+ if plat == "Darwin"
192
+ else ["" ]
191
193
),
192
194
community = True ,
193
195
),
201
203
build_system = "meson" ,
202
204
)
203
205
206
+ nvheaders = Package (
207
+ name = "nv-codec-headers" ,
208
+ source_url = "https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n13.0.19.0.tar.gz" ,
209
+ build_system = "make" ,
210
+ )
211
+
204
212
ffmpeg_package = Package (
205
213
name = "ffmpeg" ,
206
214
source_url = "https://ffmpeg.org/releases/ffmpeg-7.1.tar.xz" ,
207
215
build_arguments = [],
208
- build_parallel = plat != "Windows" ,
216
+ build_parallel = plat != "Windows" ,
209
217
)
210
218
211
219
212
- def download_tars (use_gnutls ) :
220
+ def download_tars (use_gnutls : bool , community : bool ) -> None :
213
221
# Try to download all tars at the start.
214
222
# If there is an curl error, do nothing, then try again in `main()`
215
223
@@ -218,6 +226,8 @@ def download_tars(use_gnutls):
218
226
local_libs += gnutls_group
219
227
220
228
for package in local_libs + codec_group :
229
+ if not community and package .community :
230
+ continue
221
231
tarball = os .path .join (
222
232
os .path .abspath ("source" ),
223
233
package .source_filename or package .source_url .split ("/" )[- 1 ],
@@ -236,6 +246,9 @@ def main():
236
246
parser .add_argument ("destination" )
237
247
parser .add_argument ("--community" , action = "store_true" )
238
248
parser .add_argument ("--commercial" , action = "store_true" )
249
+ parser .add_argument (
250
+ "--enable-cuda" , action = "store_true" , help = "Enable NVIDIA CUDA support"
251
+ )
239
252
240
253
args = parser .parse_args ()
241
254
@@ -244,6 +257,7 @@ def main():
244
257
245
258
dest_dir = args .destination
246
259
community = args .community
260
+ enable_cuda = args .enable_cuda and plat == "Linux"
247
261
del args
248
262
249
263
output_dir = os .path .abspath ("output" )
@@ -261,7 +275,7 @@ def main():
261
275
builder = Builder (dest_dir = dest_dir )
262
276
builder .create_directories ()
263
277
264
- download_tars (use_gnutls )
278
+ download_tars (use_gnutls , community )
265
279
266
280
# install packages
267
281
available_tools = set ()
@@ -329,6 +343,12 @@ def main():
329
343
"--enable-zlib" ,
330
344
"--enable-version3" ,
331
345
]
346
+
347
+ if enable_cuda :
348
+ ffmpeg_package .build_arguments .extend (["--enable-nvenc" , "--enable-nvdec" ])
349
+ # NVIDIA codecs require nonfree
350
+ ffmpeg_package .build_arguments .append ("--enable-nonfree" )
351
+
332
352
if not community :
333
353
ffmpeg_package .build_arguments .extend (
334
354
["--enable-libopenh264" , "--disable-libx264" ]
@@ -349,6 +369,8 @@ def main():
349
369
350
370
if use_gnutls :
351
371
library_group += gnutls_group
372
+ if enable_cuda :
373
+ library_group += [nvheaders ]
352
374
353
375
package_groups = [library_group + codec_group , [ffmpeg_package ]]
354
376
packages = [p for p_list in package_groups for p in p_list ]
0 commit comments