<# .SYNOPSIS Builds the small FFmpeg the DAV to MP4 and DSS to MP3 pages use (FFmpeg 5.1.6 and LAME 3.100, LGPL, compiled to WebAssembly in Docker) and copies it, with the worker that runs it, to frontend/vendor/local/ffmpeg@1/, where the site serves it from /vendor/. The exact sources built (the two release tarballs in source/) are published at /source/ffmpeg/ with these files. Nothing is installed on this machine; Docker Desktop must be running. #> $ErrorActionPreference = 'Continue' Set-Location $PSScriptRoot $sources = @{ 'ffmpeg-5.1.6.tar.xz' = @('https://ffmpeg.org/releases/ffmpeg-5.1.6.tar.xz', 'f4fa066278f7a47feab316fef905f4db0d5e9b589451949740f83972b30901bd'); 'lame-3.100.tar.gz' = @('https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz', 'ddfe36cab873794038ae2c1210557ad34857a4b6bdc515785d1da9e175b1da1e'); } $src = Join-Path $PSScriptRoot 'source' New-Item -ItemType Directory -Force $src | Out-Null foreach ($name in $sources.Keys) { $path = Join-Path $src $name if (-not (Test-Path $path)) { Invoke-WebRequest -Uri $sources[$name][0] -OutFile $path -UseBasicParsing } $sha = (Get-FileHash -Algorithm SHA256 $path).Hash.ToLower() if ($sha -ne $sources[$name][1]) { throw "$name hash $sha, expected $($sources[$name][1])" } } $dist = Join-Path $PSScriptRoot 'dist' if (Test-Path $dist) { Remove-Item -Recurse -Force $dist } & docker build --target export --output "type=local,dest=$dist" . if ($LASTEXITCODE -ne 0) { throw 'docker build failed' } $dest = Join-Path $PSScriptRoot '..\..\vendor\local\ffmpeg@1' New-Item -ItemType Directory -Force $dest | Out-Null foreach ($f in 'ffmpeg.mjs', 'ffmpeg.wasm', 'COPYING.LGPLv2.1') { Copy-Item (Join-Path $dist $f) $dest -Force } foreach ($f in 'worker.mjs', 'run.mjs') { Copy-Item (Join-Path $PSScriptRoot "src\$f") $dest -Force } Get-ChildItem $dest | Format-Table Name, Length