bodhisativa's picture
Publish rAIdio.bot net-install tools: ComfyUI custom-node bundle + minimal FFmpeg build
2512c40 verified
|
Raw
History Blame Contribute Delete
3.63 kB

Minimal audio-only ffmpeg build (rAIdio.bot)

Why this exists

The binary we previously shipped was BtbN's kitchen-sink win64-gpl build: ~80 external libraries, including a dozen patent-encumbered video encoders (libx264/H.264, libx265+libkvazaar/HEVC, libvvenc/H.266, libxvid/MPEG-4, libxavs2/libdavs2/libuavs3d/AVS, libopencore-amr/AMR). rAIdio.bot is an audio app — our code only ever invokes audio operations:

  • probe duration: -i <file> -f null -
  • decode to PCM: -c:a pcm_s16le / raw f32le
  • encode: libmp3lame, native flac, native pcm, libvorbis/libopus
  • always with -vn (drop video)

Consumers of tools/ffmpeg.exe (both subprocess, both audio-only):

  1. the Rust app (src-tauri/src/backend/ffmpeg.rs, commands/*)
  2. pydub / whisper on the ComfyUI side — launcher.rs:552 prepends tools/ to the Python subprocess PATH "so pydub/ffmpeg is findable". (torchaudio.save is patched to soundfile, so it needs no ffmpeg.)

So we ship a video-codec kitchen sink — with commercial patent exposure — to run wav→mp3/flac audio conversion. This build replaces it with exactly what we use.

What this build keeps / drops

  • No --enable-gpl, no --enable-nonfree → the binary is LGPL-2.1-or-later (ffmpeg core) instead of GPL-3.0. No GPL source-offer obligation.
  • External libs: only libmp3lame (LGPL-2.1), libvorbis+libogg (BSD), libopus (BSD), zlib (Zlib). That is the entire third-party attribution surface — down from ~80.
  • Encoders/muxers limited to audio (pcm/flac/mp3/ogg/opus/wav). No video encoders of any kind are present in the artifact → removes the codec patent-pool distribution exposure.
  • Full native audio decode + container demux kept (so any user import still loads: m4a/AAC, opus, ogg, flac, wav, mp3, wma, and audio tracks out of mp4/mkv/mov/avi/asf). Patent-encumbered video decoders (h264/hevc/vvc/ vc1/mpeg2video/mpeg4/msmpeg4*) are explicitly disabled — we never decode video.

Build

Reproducible Docker cross-compile (Ubuntu + mingw-w64), mirroring the toolchain shape of the upstream BtbN build:

powershell tools/ffmpeg-minimal/build.ps1

Outputs tools/ffmpeg-minimal/out/ffmpeg.exe + ffprobe.exe + MANIFEST.txt (the exact configure line + component list + lib versions). Nothing is staged to the depot and the app is not launched — this is for smoke-testing first.

Smoke matrix (run before swapping the shipped binary)

Against out/ffmpeg.exe:

# What Command shape Expect
1 version/license ffmpeg -version configuration: shows no --enable-gpl; LGPL
2 probe duration ffmpeg -i in.mp3 -f null - exits 0, prints duration
3 decode→pcm (our path) ffmpeg -i in.mp3 -vn -c:a pcm_s16le -ar 44100 out.wav valid wav
4 mp3 export ffmpeg -i in.wav -codec:a libmp3lame out.mp3 valid mp3
5 flac export ffmpeg -i in.wav -c:a flac out.flac valid flac
6 ogg/opus export ffmpeg -i in.wav -c:a libvorbis out.ogg / libopus out.opus valid
7 BPM probe path ffmpeg -ss 0 -i in.mp3 -t 30 -vn -ac 1 -ar 22050 -f f32le pipe:1 raw stream
8 audio out of video ffmpeg -i in.mp4 -vn -c:a pcm_s16le out.wav audio extracted
9 pydub load (Py side) pydub.AudioSegment.from_file("in.m4a") with this exe on PATH loads
10 whisper decode run a transcribe on in.m4a succeeds

All green → safe to stage into the depot (replacing the BtbN binary) and update the SBOM ffmpeg entry to the new minimal component set.