Skip to content

Split any YouTube song into stems

TypeScript

fix: bundle Windows ffmpeg with libsoxr

Nullhaunt77843219ba79
diff --git a/scripts/fetch-ffmpeg.ps1 b/scripts/fetch-ffmpeg.ps1
index 543e250..7572937 100644
--- a/scripts/fetch-ffmpeg.ps1
+++ b/scripts/fetch-ffmpeg.ps1
@@ -6,16 +6,22 @@ New-Item -ItemType Directory -Force -Path $out | Out-Null
$existing = Join-Path $out "ffmpeg.exe"
if (Test-Path $existing) {
- Write-Host "ffmpeg already present: $existing"
- & $existing -version | Select-Object -First 1
- exit 0
+ $buildconf = (& $existing -hide_banner -buildconf 2>&1 | Out-String)
+ if ($LASTEXITCODE -eq 0 -and $buildconf -match '--enable-libsoxr') {
+ Write-Host "ffmpeg with libsoxr already present: $existing"
+ & $existing -version | Select-Object -First 1
+ exit 0
+ }
+
+ Write-Host "existing ffmpeg lacks libsoxr support; replacing it..."
+ Remove-Item -Force $existing
}
-$zip = Join-Path $env:TEMP "ffmpeg-essentials.zip"
+$zip = Join-Path $env:TEMP "ffmpeg-btbn.zip"
$tmpExtract = Join-Path $env:TEMP "ffmpeg-extract"
-Write-Host "downloading static ffmpeg for Windows x64..."
-Invoke-WebRequest -Uri "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip" -OutFile $zip
+Write-Host "downloading static ffmpeg with libsoxr for Windows x64..."
+Invoke-WebRequest -Uri "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n9.0-latest-win64-gpl-9.0.zip" -OutFile $zip
if (Test-Path $tmpExtract) { Remove-Item -Recurse -Force $tmpExtract }
Expand-Archive -Path $zip -DestinationPath $tmpExtract -Force
@@ -27,5 +33,11 @@ Copy-Item $exe.FullName $existing -Force
Remove-Item -Recurse -Force $tmpExtract
Remove-Item -Force $zip
+$buildconf = (& $existing -hide_banner -buildconf 2>&1 | Out-String)
+if ($LASTEXITCODE -ne 0 -or $buildconf -notmatch '--enable-libsoxr') {
+ Remove-Item -Force $existing
+ throw "downloaded ffmpeg does not include libsoxr support"
+}
+
& $existing -version | Select-Object -First 1
Write-Host "saved to $existing"