@@ -97,13 +97,13 @@ def calculate_sha256(filename: str) -> str:
9797 requires = ["nasm" ],
9898 build_system = "meson" ,
9999 ),
100- Package (
101- name = "libsvtav1" ,
102- source_url = "https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v3.1.2/SVT-AV1-v3.1.2.tar.bz2" ,
103- sha256 = "802e9bb2b14f66e8c638f54857ccb84d3536144b0ae18b9f568bbf2314d2de88" ,
104- build_system = "cmake" ,
105- build_arguments = ["-DBUILD_APPS=OFF" , "-DENABLE_NASM=ON" ],
106- ),
100+ # Package(
101+ # name="libsvtav1",
102+ # source_url="https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v3.1.2/SVT-AV1-v3.1.2.tar.bz2",
103+ # sha256="802e9bb2b14f66e8c638f54857ccb84d3536144b0ae18b9f568bbf2314d2de88",
104+ # build_system="cmake",
105+ # build_arguments=["-DBUILD_APPS=OFF", "-DENABLE_NASM=ON"],
106+ # ),
107107 Package (
108108 name = "vpx" ,
109109 source_url = "https://github.com/webmproject/libvpx/archive/refs/tags/v1.15.2.tar.gz" ,
@@ -148,12 +148,12 @@ def calculate_sha256(filename: str) -> str:
148148 source_filename = "openh264-2.6.0.tar.gz" ,
149149 build_system = "meson" ,
150150 ),
151- Package (
152- name = "opencore-amr" ,
153- source_url = "https://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.6.tar.gz" ,
154- sha256 = "483eb4061088e2b34b358e47540b5d495a96cd468e361050fae615b1809dc4a1" ,
155- build_arguments = ["--disable-dependency-tracking" ],
156- ),
151+ # Package(
152+ # name="opencore-amr",
153+ # source_url="https://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.6.tar.gz",
154+ # sha256="483eb4061088e2b34b358e47540b5d495a96cd468e361050fae615b1809dc4a1",
155+ # build_arguments=["--disable-dependency-tracking"],
156+ # ),
157157 Package (
158158 name = "x264" ,
159159 source_url = "https://code.videolan.org/videolan/x264/-/archive/b35605ace3ddf7c1a5d67a2eb553f034aef41d55/x264-b35605ace3ddf7c1a5d67a2eb553f034aef41d55.tar.bz2" ,
@@ -278,13 +278,17 @@ def main():
278278 args = parser .parse_args ()
279279 dest_dir = os .path .abspath (args .destination )
280280
281+ machine = platform .machine ().lower ()
282+ is_arm = machine in {"arm64" , "aarch64" }
283+
281284 use_alsa = plat == "Linux"
282- use_cuda = plat in {"Linux" , "Windows" }
283- use_amf = plat in {"Linux" , "Windows" }
285+ # CUDA, AMF, and Intel VPL are not available on ARM64 Windows
286+ use_cuda = plat in {"Linux" , "Windows" } and not is_arm
287+ use_amf = plat in {"Linux" , "Windows" } and not is_arm
284288
285289 # Use Intel VPL (Video Processing Library) if supported to enable Intel QSV (Quick Sync Video)
286290 # hardware encoders/decoders on modern integrated and discrete Intel GPUs.
287- use_libvpl = plat in {"Linux" , "Windows" }
291+ use_libvpl = plat in {"Linux" , "Windows" } and not is_arm
288292
289293 # Use GnuTLS only on Linux, FFmpeg has native TLS backends for macOS and Windows.
290294 use_gnutls = plat == "Linux"
@@ -303,19 +307,25 @@ def main():
303307 # install packages
304308 available_tools = set ()
305309 if plat == "Windows" :
306- available_tools .update (["nasm" ])
310+ if not is_arm :
311+ available_tools .update (["nasm" ])
307312
308313 # print tool locations
309314 print ("PATH" , os .environ ["PATH" ])
310- for tool in ["gcc" , "g++" , "curl" , "ld" , "nasm" , "pkg-config" ]:
315+ if is_arm :
316+ # CLANGARM64 uses clang instead of gcc
317+ tools = ["clang" , "clang++" , "curl" , "ld" , "pkg-config" ]
318+ else :
319+ tools = ["gcc" , "g++" , "curl" , "ld" , "nasm" , "pkg-config" ]
320+ for tool in tools :
311321 run (["where" , tool ])
312322
313323 with log_group ("install python packages" ):
314324 run (["pip" , "install" , "cmake==3.31.10" , "meson" , "ninja" ])
315325
316326 # build tools
317327 build_tools = []
318- if "nasm" not in available_tools and platform .machine () not in {"arm64" , "aarch64" }:
328+ if "nasm" not in available_tools and platform .machine (). lower () not in {"arm64" , "aarch64" }:
319329 build_tools .append (
320330 Package (
321331 name = "nasm" ,
@@ -344,11 +354,11 @@ def main():
344354 "--enable-gnutls" if use_gnutls else "--disable-gnutls" ,
345355 "--enable-libdav1d" ,
346356 "--enable-libmp3lame" ,
347- "--enable-libopencore-amrnb" ,
348- "--enable-libopencore-amrwb" ,
357+ # "--enable-libopencore-amrnb",
358+ # "--enable-libopencore-amrwb",
349359 "--enable-libopus" ,
350360 "--enable-libspeex" ,
351- "--enable-libsvtav1" ,
361+ # "--enable-libsvtav1",
352362 "--enable-libvorbis" ,
353363 "--enable-libvpx" ,
354364 "--enable-libwebp" ,
@@ -388,6 +398,15 @@ def main():
388398 ]
389399 )
390400
401+ if plat == "Windows" and is_arm :
402+ ffmpeg_package .build_arguments .extend (
403+ [
404+ "--cc=clang" ,
405+ "--cxx=clang++" ,
406+ "--arch=aarch64" ,
407+ ]
408+ )
409+
391410 ffmpeg_package .build_arguments .extend (
392411 [
393412 "--disable-encoder=avui,dca,mlp,opus,s302m,sonic,sonic_ls,truehd,vorbis" ,
@@ -412,6 +431,14 @@ def main():
412431 packages += codec_group
413432 packages += [ffmpeg_package ]
414433
434+ # Disable runtime CPU detection for opus on Windows ARM64
435+ # (no CPU detection method available for this platform)
436+ if plat == "Windows" and is_arm :
437+ for pkg in packages :
438+ if pkg .name == "opus" :
439+ pkg .build_arguments .append ("--disable-rtcd" )
440+ break
441+
415442 download_tars (build_tools + packages )
416443 for tool in build_tools :
417444 builder .build (tool , for_builder = True )
@@ -437,19 +464,33 @@ def main():
437464 )
438465
439466 # copy some libraries provided by mingw
467+ machine = platform .machine ().lower ()
468+ is_arm64 = machine in {"arm64" , "aarch64" }
469+ compiler = "clang" if is_arm64 else "gcc"
440470 mingw_bindir = os .path .dirname (
441- subprocess .run (["where" , "gcc" ], check = True , stdout = subprocess .PIPE )
471+ subprocess .run (["where" , compiler ], check = True , stdout = subprocess .PIPE )
442472 .stdout .decode ()
443473 .splitlines ()[0 ]
444474 .strip ()
445475 )
446- for name in (
447- "libgcc_s_seh-1.dll" ,
448- "libiconv-2.dll" ,
449- "libstdc++-6.dll" ,
450- "libwinpthread-1.dll" ,
451- "zlib1.dll" ,
452- ):
476+ if is_arm64 :
477+ # CLANGARM64 uses clang/libc++ instead of gcc/libstdc++
478+ dll_names = (
479+ "libc++.dll" ,
480+ "libiconv-2.dll" ,
481+ "libunwind.dll" ,
482+ "libwinpthread-1.dll" ,
483+ "zlib1.dll" ,
484+ )
485+ else :
486+ dll_names = (
487+ "libgcc_s_seh-1.dll" ,
488+ "libiconv-2.dll" ,
489+ "libstdc++-6.dll" ,
490+ "libwinpthread-1.dll" ,
491+ "zlib1.dll" ,
492+ )
493+ for name in dll_names :
453494 shutil .copy (os .path .join (mingw_bindir , name ), os .path .join (dest_dir , "bin" ))
454495
455496 # find libraries
0 commit comments