bodhisativa commited on
Commit
2512c40
·
verified ·
1 Parent(s): add74c7

Publish rAIdio.bot net-install tools: ComfyUI custom-node bundle + minimal FFmpeg build

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ ffmpeg-minimal/ffmpeg.exe filter=lfs diff=lfs merge=lfs -text
37
+ ffmpeg-minimal/ffprobe.exe filter=lfs diff=lfs merge=lfs -text
ffmpeg-minimal/Dockerfile ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # syntax=docker/dockerfile:1
2
+ # Minimal audio-only ffmpeg for rAIdio.bot — win64 static, LGPL-2.1 (no GPL).
3
+ # Cross-compiled with mingw-w64. See README.md for rationale + smoke matrix.
4
+
5
+ FROM ubuntu:24.04 AS build
6
+ ARG DEBIAN_FRONTEND=noninteractive
7
+ RUN apt-get update && apt-get install -y --no-install-recommends \
8
+ build-essential gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64 \
9
+ yasm nasm make pkg-config git curl xz-utils ca-certificates \
10
+ autoconf automake libtool \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ ENV HOST=x86_64-w64-mingw32
14
+ ENV PREFIX=/opt/win64
15
+ ENV PKG_CONFIG_LIBDIR=/opt/win64/lib/pkgconfig
16
+ WORKDIR /build
17
+
18
+ # ---- libogg (BSD) ----
19
+ ARG OGG_VER=1.3.5
20
+ RUN curl -fL https://downloads.xiph.org/releases/ogg/libogg-${OGG_VER}.tar.gz | tar xz \
21
+ && cd libogg-${OGG_VER} \
22
+ && ./configure --host=$HOST --prefix=$PREFIX --disable-shared --enable-static \
23
+ && make -j"$(nproc)" && make install
24
+
25
+ # ---- libvorbis (BSD) ----
26
+ ARG VORBIS_VER=1.3.7
27
+ RUN curl -fL https://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VER}.tar.gz | tar xz \
28
+ && cd libvorbis-${VORBIS_VER} \
29
+ && ./configure --host=$HOST --prefix=$PREFIX --disable-shared --enable-static --with-ogg=$PREFIX \
30
+ && make -j"$(nproc)" && make install
31
+
32
+ # ---- opus (BSD) ----
33
+ ARG OPUS_VER=1.5.2
34
+ RUN curl -fL https://downloads.xiph.org/releases/opus/opus-${OPUS_VER}.tar.gz | tar xz \
35
+ && cd opus-${OPUS_VER} \
36
+ && ./configure --host=$HOST --prefix=$PREFIX --disable-shared --enable-static --disable-doc --disable-extra-programs \
37
+ && make -j"$(nproc)" && make install
38
+
39
+ # ---- LAME (LGPL-2.1) ----
40
+ ARG LAME_VER=3.100
41
+ RUN curl -fL https://downloads.sourceforge.net/project/lame/lame/${LAME_VER}/lame-${LAME_VER}.tar.gz | tar xz \
42
+ && cd lame-${LAME_VER} \
43
+ && ./configure --host=$HOST --prefix=$PREFIX --disable-shared --enable-static --disable-frontend \
44
+ && make -j"$(nproc)" && make install
45
+
46
+ # ---- zlib (Zlib) — mingw cross via its win32 makefile ----
47
+ ARG ZLIB_VER=1.3.1
48
+ RUN curl -fL https://zlib.net/fossils/zlib-${ZLIB_VER}.tar.gz | tar xz \
49
+ && cd zlib-${ZLIB_VER} \
50
+ && make -f win32/Makefile.gcc PREFIX=$HOST- \
51
+ BINARY_PATH=$PREFIX/bin INCLUDE_PATH=$PREFIX/include LIBRARY_PATH=$PREFIX/lib \
52
+ SHARED_MODE=0 install
53
+
54
+ # ---- ffmpeg (LGPL-2.1-or-later; no --enable-gpl) ----
55
+ ARG FFMPEG_VER=7.1.1
56
+ RUN curl -fL https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VER}.tar.xz | tar xJ \
57
+ && cd ffmpeg-${FFMPEG_VER} \
58
+ && PKG_CONFIG_LIBDIR=$PREFIX/lib/pkgconfig ./configure \
59
+ --prefix=/out \
60
+ --arch=x86_64 --target-os=mingw32 --cross-prefix=$HOST- \
61
+ --pkg-config=pkg-config --pkg-config-flags=--static \
62
+ --enable-static --disable-shared \
63
+ --extra-cflags="-I$PREFIX/include" \
64
+ --extra-ldflags="-L$PREFIX/lib -static -static-libgcc" \
65
+ --disable-debug --disable-doc --disable-network --disable-devices --disable-autodetect \
66
+ --disable-programs --enable-ffmpeg --enable-ffprobe \
67
+ --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-zlib \
68
+ --enable-protocol=file,pipe \
69
+ --disable-encoders \
70
+ --enable-encoder=pcm_s16le,pcm_s16be,pcm_s24le,pcm_s32le,pcm_f32le,pcm_u8,pcm_s8,flac,libmp3lame,libvorbis,libopus,wavpack,alac \
71
+ --disable-muxers \
72
+ --enable-muxer=wav,w64,flac,mp3,ogg,opus,null,pcm_s16le,pcm_s24le,pcm_f32le,pcm_s16be,data,ipod,mp4 \
73
+ --disable-decoder=h264,hevc,vvc,vc1,vc1image,mpeg1video,mpeg2video,mpeg4,msmpeg4v1,msmpeg4v2,msmpeg4v3,wmv1,wmv2,wmv3,vp6,vp6a,vp6f \
74
+ --enable-filter=aresample,aformat,anull,atrim,asetnsamples,asetpts,aselect,volume,channelmap,channelsplit,join,amerge,amix,pan,silenceremove,silencedetect,loudnorm,dynaudnorm,highpass,lowpass,equalizer,atempo,aecho,acompressor,anlmdn,afftdn,abuffer,abuffersink,anullsrc \
75
+ && make -j"$(nproc)" && make install \
76
+ && $HOST-strip /out/bin/ffmpeg.exe /out/bin/ffprobe.exe || true
77
+
78
+ # Capture the exact configure + component manifest for the SBOM / audit trail.
79
+ RUN cd ffmpeg-${FFMPEG_VER} 2>/dev/null || cd $(ls -d ffmpeg-*) ; \
80
+ { echo "=== build host ==="; $HOST-gcc --version | head -1; \
81
+ echo; echo "=== ffmpeg -buildconf (from config.h) ==="; \
82
+ sed -n 's/.*FFMPEG_CONFIGURATION "\(.*\)"/\1/p' config.h; \
83
+ echo; echo "=== lib versions ==="; \
84
+ echo "ffmpeg ${FFMPEG_VER}; lame ${LAME_VER}; libvorbis ${VORBIS_VER}; libogg ${OGG_VER}; opus ${OPUS_VER}; zlib ${ZLIB_VER}"; \
85
+ } > /out/MANIFEST.txt && cat /out/MANIFEST.txt
86
+
87
+ # ---- export stage: only the artifacts ----
88
+ FROM scratch AS export
89
+ COPY --from=build /out/bin/ffmpeg.exe /ffmpeg.exe
90
+ COPY --from=build /out/bin/ffprobe.exe /ffprobe.exe
91
+ COPY --from=build /out/MANIFEST.txt /MANIFEST.txt
ffmpeg-minimal/README.md ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Minimal audio-only ffmpeg build (rAIdio.bot)
2
+
3
+ ## Why this exists
4
+
5
+ The binary we previously shipped was BtbN's kitchen-sink `win64-gpl` build:
6
+ ~80 external libraries, including a dozen **patent-encumbered video encoders**
7
+ (libx264/H.264, libx265+libkvazaar/HEVC, libvvenc/H.266, libxvid/MPEG-4,
8
+ libxavs2/libdavs2/libuavs3d/AVS, libopencore-amr/AMR). rAIdio.bot is an audio
9
+ app — our code only ever invokes audio operations:
10
+
11
+ - probe duration: `-i <file> -f null -`
12
+ - decode to PCM: `-c:a pcm_s16le` / raw `f32le`
13
+ - encode: `libmp3lame`, native `flac`, native `pcm`, `libvorbis`/`libopus`
14
+ - always with `-vn` (drop video)
15
+
16
+ Consumers of `tools/ffmpeg.exe` (both subprocess, both audio-only):
17
+ 1. the Rust app (`src-tauri/src/backend/ffmpeg.rs`, `commands/*`)
18
+ 2. pydub / whisper on the ComfyUI side — `launcher.rs:552` prepends `tools/`
19
+ to the Python subprocess PATH "so pydub/ffmpeg is findable".
20
+ (`torchaudio.save` is patched to soundfile, so it needs no ffmpeg.)
21
+
22
+ So we ship a video-codec kitchen sink — with commercial patent exposure — to run
23
+ `wav→mp3/flac` audio conversion. This build replaces it with exactly what we use.
24
+
25
+ ## What this build keeps / drops
26
+
27
+ - **No `--enable-gpl`, no `--enable-nonfree`** → the binary is **LGPL-2.1-or-later**
28
+ (ffmpeg core) instead of GPL-3.0. No GPL source-offer obligation.
29
+ - **External libs: only** `libmp3lame` (LGPL-2.1), `libvorbis`+`libogg` (BSD),
30
+ `libopus` (BSD), `zlib` (Zlib). That is the entire third-party attribution
31
+ surface — down from ~80.
32
+ - **Encoders/muxers limited to audio** (pcm/flac/mp3/ogg/opus/wav). No video
33
+ encoders of any kind are present in the artifact → removes the codec
34
+ patent-pool distribution exposure.
35
+ - **Full native audio decode + container demux kept** (so any user import still
36
+ loads: m4a/AAC, opus, ogg, flac, wav, mp3, wma, and audio tracks out of
37
+ mp4/mkv/mov/avi/asf). Patent-encumbered **video decoders** (h264/hevc/vvc/
38
+ vc1/mpeg2video/mpeg4/msmpeg4*) are explicitly disabled — we never decode video.
39
+
40
+ ## Build
41
+
42
+ Reproducible Docker cross-compile (Ubuntu + mingw-w64), mirroring the toolchain
43
+ shape of the upstream BtbN build:
44
+
45
+ ```
46
+ powershell tools/ffmpeg-minimal/build.ps1
47
+ ```
48
+
49
+ Outputs `tools/ffmpeg-minimal/out/ffmpeg.exe` + `ffprobe.exe` + `MANIFEST.txt`
50
+ (the exact configure line + component list + lib versions). Nothing is staged to
51
+ the depot and the app is not launched — this is for smoke-testing first.
52
+
53
+ ## Smoke matrix (run before swapping the shipped binary)
54
+
55
+ Against `out/ffmpeg.exe`:
56
+
57
+ | # | What | Command shape | Expect |
58
+ |---|------|---------------|--------|
59
+ | 1 | version/license | `ffmpeg -version` | `configuration:` shows **no** `--enable-gpl`; LGPL |
60
+ | 2 | probe duration | `ffmpeg -i in.mp3 -f null -` | exits 0, prints duration |
61
+ | 3 | decode→pcm (our path) | `ffmpeg -i in.mp3 -vn -c:a pcm_s16le -ar 44100 out.wav` | valid wav |
62
+ | 4 | mp3 export | `ffmpeg -i in.wav -codec:a libmp3lame out.mp3` | valid mp3 |
63
+ | 5 | flac export | `ffmpeg -i in.wav -c:a flac out.flac` | valid flac |
64
+ | 6 | ogg/opus export | `ffmpeg -i in.wav -c:a libvorbis out.ogg` / `libopus out.opus` | valid |
65
+ | 7 | BPM probe path | `ffmpeg -ss 0 -i in.mp3 -t 30 -vn -ac 1 -ar 22050 -f f32le pipe:1` | raw stream |
66
+ | 8 | audio out of video | `ffmpeg -i in.mp4 -vn -c:a pcm_s16le out.wav` | audio extracted |
67
+ | 9 | pydub load (Py side) | `pydub.AudioSegment.from_file("in.m4a")` with this exe on PATH | loads |
68
+ | 10 | whisper decode | run a transcribe on `in.m4a` | succeeds |
69
+
70
+ All green → safe to stage into the depot (replacing the BtbN binary) and update
71
+ the SBOM ffmpeg entry to the new minimal component set.
ffmpeg-minimal/build.ps1 ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Build the minimal audio-only ffmpeg (win64, LGPL) via Docker cross-compile.
2
+ # Outputs out\ffmpeg.exe, out\ffprobe.exe, out\MANIFEST.txt.
3
+ # Does NOT stage to the depot and does NOT launch the app.
4
+ $ErrorActionPreference = "Stop"
5
+ $here = Split-Path -Parent $MyInvocation.MyCommand.Path
6
+ $out = Join-Path $here "out"
7
+ if (Test-Path $out) { Remove-Item $out -Recurse -Force }
8
+ New-Item -ItemType Directory -Force $out | Out-Null
9
+
10
+ Write-Host "=== Building minimal ffmpeg (Docker cross-compile) ===" -ForegroundColor Cyan
11
+ docker build --target export --output "type=local,dest=$out" $here
12
+ if ($LASTEXITCODE -ne 0) { Write-Error "docker build failed (exit $LASTEXITCODE)"; exit 1 }
13
+
14
+ Write-Host "`n=== Artifacts ===" -ForegroundColor Green
15
+ Get-ChildItem $out | Format-Table Name, Length, LastWriteTime
16
+ $ff = Join-Path $out "ffmpeg.exe"
17
+ if (Test-Path $ff) {
18
+ Write-Host "ffmpeg.exe size: $([math]::Round((Get-Item $ff).Length/1MB,1)) MB"
19
+ Write-Host "`n=== MANIFEST.txt ===" -ForegroundColor Cyan
20
+ Get-Content (Join-Path $out "MANIFEST.txt")
21
+ } else {
22
+ Write-Error "ffmpeg.exe not produced"; exit 1
23
+ }
24
+ Write-Host "`nDONE. Smoke-test out\ffmpeg.exe per README.md before staging." -ForegroundColor Green
ffmpeg-minimal/ffmpeg.exe ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ebe854b4149d1b26392e1701607b5428aada5cac83f5dcf362c4c3cfc2af211d
3
+ size 19692032
ffmpeg-minimal/ffprobe.exe ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:adea98e2fa4e7d0b506556b6651e8d8a1641f9a0f74d4ef9672c17b996e2c598
3
+ size 19588608
latest/raidio-custom-nodes.7z ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:28ac7d261f2094ce1d1ec8447527852e708dabe299762039e5d2fb4faadfe0f9
3
+ size 2291753947