Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

ComfyUI install: non-commercial packs opt-in, isolated worker in its own venv

Claude702749b19be3
diff --git a/scripts/comfy/README.md b/scripts/comfy/README.md
index fa884371..36b2044d 100644
--- a/scripts/comfy/README.md
+++ b/scripts/comfy/README.md
@@ -12,7 +12,8 @@ Full write-up (what is in the library, validation results, models, quirks for ap
| file | purpose |
|---|---|
-| `install-comfyui.sh` | reproducible CPU install of ComfyUI + the 15 custom node packs (pinned commits; Chatterbox, IndexTTS2 and Video-Depth-Anything added for the comfyui-oss-2 workflows — IndexTTS2's runtime deps only with `INDEXTTS_RUNTIME=1`; MelBandRoFormer, QwenASR, HunyuanVideo-Foley and Whisper for comfyui-oss-3) |
+| `install-comfyui.sh` | reproducible CPU install of ComfyUI + the 14 custom node packs (pinned commits; Chatterbox, IndexTTS2 and Video-Depth-Anything added for the comfyui-oss-2 workflows — IndexTTS2's runtime deps only with `INDEXTTS_RUNTIME=1`; MelBandRoFormer, QwenASR and HunyuanVideo-Foley for comfyui-oss-3). Non-commercial node code is opt-in: `NC_PACKS=1` adds ComfyUI-Whisper (CC-BY-NC-SA-4.0, only for `captions-whisper-burnin`) |
+| `install-isolated-worker.sh` | a second ComfyUI with its own code copy, base directory, `HOME` and virtualenv for LatentSync 1.6 and ThinkSound (below) |
| `start-comfyui.sh` / `stop-comfyui.sh` | run ComfyUI in the background on 127.0.0.1:8188 (log: `$COMFYUI_DIR/logs/comfyui.log`) |
| `export-templates.mjs` | Playwright: opens the ComfyUI frontend, `app.loadGraphData(ui)` → `app.graphToPrompt().output`, writes `build/raw/<key>.api.json` + `.meta.json` (embedded model URLs, missing node types) |
| `library.spec.mjs` | the curated list: id, title, capability, source, transforms, bindings, outputs, limits, VRAM, notes |
@@ -77,9 +78,23 @@ node validate-workflows.mjs <ids>
video. Binding names follow Fuobe's canonical inputs (`startTime`, `numLayers`, `sourceLanguage`, `paletteImage`…,
documented in the header of `library.spec.mjs`). The TRELLIS.2 graph's pass-through `PreviewImage` nodes are linked
around by the build (they would otherwise write 4096² textures to `temp/` on every run).
-- **`captions-burnin`** is Fuobe's own caption burn-in, core nodes only (`Trim Video` per cue, `Draw Text Overlay`,
- `Batch Images`, `Create Video`). The library file holds a two-cue example; the provider rewrites it per request
- (`expand: "captions"`, see `expandCaptionWorkflow()` in `src/lib/comfy.ts`).
+- **`captions-burnin`** is Fuobe's own caption burn-in, core nodes only, built so memory does not grow with the
+ clip: gaps between captions go to `Concatenate Video` as `Trim Video` windows (never decoded); captioned stretches
+ are cut into chunks of at most ~384 MB of frames, and each chunk is decoded, gets a `Draw Text Overlay` and is
+ encoded at once (`Create Video`, codec h264), so ComfyUI can drop its raw frames. `Concatenate Video` joins
+ everything with the clip's own soundtrack (`LoadAudio`, dropped for silent clips). The library file holds a
+ one-chunk + one-gap example; the provider rewrites it per request (`expand: "captions"`, `expandCaptionWorkflow()`
+ in `src/lib/comfy.ts`) from what the upload's MP4 header says (duration, fps, size, audio). Every window holds at
+ least 3 frames (`Concatenate Video` rejects a 2-frame clip followed by another one). Under RAM pressure
+ (`--cache-ram 11` on the CPU box) a 20 s 640x360 30 fps clip with 18 s of captions peaks at +0.50 GB RSS and a 40 s
+ one at +0.45 GB — the earlier one-batch graph needed +5.16 GB for the 20 s clip and grew with the length. Without
+ pressure ComfyUI's RAM cache simply keeps the finished chunks (+2.64 GB for 20 s) until memory runs low.
+- **`video-mux-audio` / `-replace`** put the new soundtrack on with `Concatenate Video` (`complete_audio`): the video
+ stream is copied packet by packet (bit-identical, no decode), only the AAC soundtrack is encoded. The two-track
+ graph mixes voice and background over `EmptyAudio` of the video's length (`AudioMerge` cuts its second track to
+ the first one's length). A 900-frame clip muxes in ~5 s at +0.02 GB RSS.
+- **`captions-whisper-burnin`** decodes the whole clip (VHS) and needs ComfyUI-Whisper (`NC_PACKS=1`); the provider
+ refuses clips that would need more than half the server's RAM and points to the chunked route.
- **New entry fields**: `worker: "isolated"` (below), `expand`, and on outputs `stem` (`voice` | `background`) and
`role` (`cues`, `transcript`, `language`, `sheet`, `tiles`, `layers`, `first-frame`, `turntable`).
@@ -87,26 +102,28 @@ node validate-workflows.mjs <ids>
`lipsync-latentsync16` and `sfx-thinksound` are optional and never defaults. Their packs change process-wide state
(LatentSync overrides `TMPDIR` and `folder_paths` temp handling at import, `rmtree()`s a `temp` folder next to the
-ComfyUI directory and pip-installs packages when its node is created) or pin old packages (ThinkSound's
-`requirements.txt` downgrades einops, PyWavelets, k-diffusion). Run them on a second ComfyUI with its own base
-directory and `HOME`, same commit and venv:
+ComfyUI directory and pip-installs packages into whatever interpreter runs it when its node is created) or pin old
+packages (ThinkSound's `requirements.txt` downgrades einops, PyWavelets, k-diffusion; LatentSync's runtime needs
+mediapipe, which pins `protobuf<5`). So the worker gets **its own code copy, base directory, `HOME` and
+virtualenv** — nothing is installed into the main ComfyUI's venv:
```bash
-cp -r /home/user/ComfyUI /srv/comfyui-isolated # code only; or a fresh clone at the same commit
-cd /srv/comfyui-isolated/custom_nodes
-git clone https://github.com/ShmuelRonen/ComfyUI-LatentSyncWrapper && git -C ComfyUI-LatentSyncWrapper checkout 360d5283d7276aee68b4237b1387e594e4ce640e
-git clone https://github.com/ShmuelRonen/ComfyUI-ThinkSound_Wrapper && git -C ComfyUI-ThinkSound_Wrapper checkout 9a2fb40ae30cabbdb55fb6f6fe02b01c23ab1a3b
-# plus ComfyUI-VideoHelperSuite + ComfyUI-KJNodes (same commits as install-comfyui.sh)
-uv pip install --python /home/user/ComfyUI/.venv/bin/python "mediapipe>=0.10.8" face-alignment DeepCache ffmpeg-python pytorch_lightning # LatentSync runtime
-cd /srv/comfyui-isolated && HOME=/srv/comfyui-isolated/home /home/user/ComfyUI/.venv/bin/python main.py --listen 127.0.0.1 --port 8189
+ISO_DIR=/srv/comfyui-isolated scripts/comfy/install-isolated-worker.sh
+# - copies ComfyUI's *code* only (tar with models/, input/, output/, user/, custom_nodes/ and .venv excluded —
+# never `cp -r` the whole install, models/ can be hundreds of GB)
+# - creates $ISO_DIR/.venv (Python 3.11: ThinkSound pins PyWavelets 1.4.1, which has no newer wheels), installs torch
+# (TORCH_INDEX=https://download.pytorch.org/whl/cu128 on a GPU server), ComfyUI's requirements, the two packs and
+# VHS + KJNodes at the pinned commits, ThinkSound's requirements and LatentSync's runtime deps — into that venv
+# - writes extra_model_paths.yaml so the worker reads the main install's model folders (shared, not copied)
+cd /srv/comfyui-isolated/ComfyUI && HOME=/srv/comfyui-isolated/home /srv/comfyui-isolated/.venv/bin/python main.py --listen 127.0.0.1 --port 8189
```
Point a second Fuobe install (or Settings → ComfyUI URL while you use those models) at port 8189. Build and
-validate them against that server (`COMFYUI_DIR` = its directory, for the placeholder models):
+validate them against that server (placeholder models go into the shared main `models/` folder the worker reads):
```bash
COMFYUI_URL=http://127.0.0.1:8189 npm run build -- lipsync-latentsync16 sfx-thinksound
-COMFYUI_URL=http://127.0.0.1:8189 COMFYUI_DIR=/srv/comfyui-isolated node validate-workflows.mjs lipsync-latentsync16 sfx-thinksound
+COMFYUI_URL=http://127.0.0.1:8189 COMFYUI_MODELS_DIR=/home/user/ComfyUI/models node validate-workflows.mjs lipsync-latentsync16 sfx-thinksound --shared
node validate-workflows.mjs video-trim # then once on the main server, so object_info.subset.json comes from it
```
diff --git a/scripts/comfy/install-comfyui.sh b/scripts/comfy/install-comfyui.sh
index 276d479d..282baa79 100755
--- a/scripts/comfy/install-comfyui.sh
+++ b/scripts/comfy/install-comfyui.sh
@@ -25,12 +25,16 @@ declare -A NODES=(
[ComfyUI_Fill-ChatterBox]="https://github.com/filliptm/ComfyUI_Fill-ChatterBox f7d7a16187430abcaf91a3039b9c83aa9960816a"
[ComfyUI-IndexTTS2]="https://github.com/snicolast/ComfyUI-IndexTTS2 5b33e02bc0112b8aaf1fc823d5e5a609ca07fc27"
[ComfyUI-Video-Depth-Anything]="https://github.com/yuvraj108c/ComfyUI-Video-Depth-Anything a0db08e63d1ea571601c45cde4aaee0acdd0544d"
- # round-3 packs (2026-10-17, docs/research/comfyui-oss-3.md): voice separation, ASR/subtitles, foley, whisper captions
+ # round-3 packs (2026-10-17, docs/research/comfyui-oss-3.md): voice separation, ASR/subtitles, foley
[ComfyUI-MelBandRoFormer]="https://github.com/kijai/ComfyUI-MelBandRoFormer 92c86854e6654f4aacc97484471af95c98ea16d4"
[ComfyUI-QwenASR]="https://github.com/1038lab/ComfyUI-QwenASR 3f9a652a617e578e4e3bd090e3dbc75274bf4775"
[ComfyUI-HunyuanVideo-Foley]="https://github.com/phazei/ComfyUI-HunyuanVideo-Foley afd2960b8ad9036a9f55a15daf514112ff68e010"
- [ComfyUI-Whisper]="https://github.com/yuvraj108c/ComfyUI-Whisper 006a709848259ed3d69e2f9fcfd7a75f6c860ddd"
)
+# Non-commercial node code is opt-in: NC_PACKS=1 also installs ComfyUI-Whisper (CC-BY-NC-SA-4.0), used only by the
+# optional captions-whisper-burnin workflow. The default caption route (Qwen3-ASR + core burn-in) does not need it.
+if [ "${NC_PACKS:-0}" = "1" ]; then
+ NODES[ComfyUI-Whisper]="https://github.com/yuvraj108c/ComfyUI-Whisper 006a709848259ed3d69e2f9fcfd7a75f6c860ddd"
+fi
if [ ! -d "$COMFYUI_DIR/.git" ]; then
git clone https://github.com/comfyanonymous/ComfyUI "$COMFYUI_DIR"
@@ -75,19 +79,17 @@ fi
# Chatterbox's Perth watermarker (recommended in production for cloned voices; optional for validation):
# uv pip install --python "$PY" resemble-perth
-# ComfyUI-HunyuanVideo-Foley needs loguru; ComfyUI-Whisper needs openai-whisper (built from sdist).
+# ComfyUI-HunyuanVideo-Foley needs loguru; ComfyUI-Whisper (NC_PACKS=1) needs openai-whisper (built from sdist).
# ComfyUI-MelBandRoFormer needs rotary_embedding_torch + einops (installed above).
# ComfyUI-QwenASR: do NOT install its requirements.txt (nagisa/DyNet38 have no cp313 wheels and are unused on the
# Hugging Face path); transformers>=5.13 from ComfyUI's requirements is all it needs.
-uv pip install --python "$PY" loguru "openai-whisper==20250625"
+uv pip install --python "$PY" loguru
+if [ "${NC_PACKS:-0}" = "1" ]; then uv pip install --python "$PY" "openai-whisper==20250625"; fi
-# Optional isolated worker (do not add to the shared install): LatentSync 1.6 lipsync and ThinkSound SFX change
-# process-wide state or pin old packages, so they run on a second ComfyUI with its own base directory and HOME.
+# Optional isolated worker (never in this install or its venv): LatentSync 1.6 lipsync and ThinkSound SFX change
+# process-wide state or pin old packages, so they run on a second ComfyUI with its own code copy, base directory,
+# HOME and virtualenv: scripts/comfy/install-isolated-worker.sh (see README.md, "Isolated worker").
# The workflows lipsync-latentsync16 and sfx-thinksound carry "worker": "isolated" in manifest.json.
-# See scripts/comfy/README.md ("Isolated worker"). Packs, at the commits the library was validated with:
-# git clone https://github.com/ShmuelRonen/ComfyUI-LatentSyncWrapper && git -C ComfyUI-LatentSyncWrapper checkout 360d5283d7276aee68b4237b1387e594e4ce640e
-# git clone https://github.com/ShmuelRonen/ComfyUI-ThinkSound_Wrapper && git -C ComfyUI-ThinkSound_Wrapper checkout 9a2fb40ae30cabbdb55fb6f6fe02b01c23ab1a3b
-# uv pip install --python "$PY" "mediapipe>=0.10.8" face-alignment DeepCache ffmpeg-python pytorch_lightning # LatentSync runtime only
# ComfyUI-ReActor downloads ~1 GB of face-restore models into models/facerestore_models whenever that
# folder is empty -- even on a plain GET /object_info. On this validation-only (no weights) install keep a
diff --git a/scripts/comfy/install-isolated-worker.sh b/scripts/comfy/install-isolated-worker.sh
new file mode 100755
index 00000000..915e6473
--- /dev/null
+++ b/scripts/comfy/install-isolated-worker.sh
@@ -0,0 +1,81 @@
+#!/usr/bin/env bash
+# A second, isolated ComfyUI for the packs that must not share a process or a Python environment with the main
+# server: LatentSync 1.6 (lipsync-latentsync16) and ThinkSound (sfx-thinksound). See README.md ("Isolated worker").
+#
+# It gets its OWN code copy, base directory, HOME and virtualenv, so nothing these packs do can reach the main
+# install: LatentSync overrides TMPDIR / temp handling at import, rmtree()s a temp folder next to ComfyUI and
+# pip-installs into whatever interpreter runs it; its runtime deps (mediapipe pins protobuf<5) and ThinkSound's
+# requirements (old einops, PyWavelets, k-diffusion) would downgrade the main venv. Model files are shared
+# read-only through extra_model_paths.yaml instead of being copied.
+#
+# Usage: scripts/comfy/install-isolated-worker.sh
+# ISO_DIR=/srv/comfyui-isolated where the worker lives (default)
+# COMFYUI_DIR=/home/user/ComfyUI the main install: its code is copied (models/, input/, output/, venv excluded)
+# TORCH_INDEX=https://download.pytorch.org/whl/cu128 torch build (default: CPU wheels)
+# PYTHON_VERSION=3.11 ThinkSound pins PyWavelets 1.4.1 (wheels up to 3.11; it no longer builds on 3.12+)
+# Then start it (its own HOME; add --cpu without a GPU):
+# cd "$ISO_DIR/ComfyUI" && HOME="$ISO_DIR/home" "$ISO_DIR/.venv/bin/python" main.py --listen 127.0.0.1 --port 8189
+set -euo pipefail
+SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
+COMFYUI_DIR="${COMFYUI_DIR:-/home/user/ComfyUI}"
+ISO_DIR="${ISO_DIR:-/srv/comfyui-isolated}"
+PYTHON_VERSION="${PYTHON_VERSION:-3.11}"
+TORCH_INDEX="${TORCH_INDEX:-https://download.pytorch.org/whl/cpu}"
+
+# Packs, at the commits the library was validated with (the same VHS / KJNodes commits as install-comfyui.sh).
+declare -A NODES=(
+ [ComfyUI-LatentSyncWrapper]="https://github.com/ShmuelRonen/ComfyUI-LatentSyncWrapper 360d5283d7276aee68b4237b1387e594e4ce640e"
+ [ComfyUI-ThinkSound_Wrapper]="https://github.com/ShmuelRonen/ComfyUI-ThinkSound_Wrapper 9a2fb40ae30cabbdb55fb6f6fe02b01c23ab1a3b"
+ [ComfyUI-VideoHelperSuite]="https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite 4d907bee61e92c2e65af3bd6383a4e4d356126d1"
+ [ComfyUI-KJNodes]="https://github.com/kijai/ComfyUI-KJNodes 17195fcfa8a05f601b766a0f09c9733284f47416"
+)
+
+[ -f "$COMFYUI_DIR/main.py" ] || { echo "No ComfyUI at $COMFYUI_DIR (run install-comfyui.sh first)" >&2; exit 1; }
+mkdir -p "$ISO_DIR/home" "$ISO_DIR/ComfyUI"
+
+# 1. Code only: the main install's models, inputs, outputs, users, node packs and venv stay where they are
+# (never `cp -r` the whole ComfyUI: models/ can be hundreds of GB).
+tar -C "$COMFYUI_DIR" -cf - \
+ --exclude ./models --exclude ./input --exclude ./output --exclude ./temp --exclude ./user \
+ --exclude ./custom_nodes --exclude ./.venv --exclude ./logs --exclude '__pycache__' . | tar -C "$ISO_DIR/ComfyUI" -xf -
+mkdir -p "$ISO_DIR/ComfyUI/custom_nodes" "$ISO_DIR/ComfyUI/models" "$ISO_DIR/ComfyUI/input" "$ISO_DIR/ComfyUI/output"
+
+# 2. Its own virtualenv.
+[ -x "$ISO_DIR/.venv/bin/python" ] || uv venv --python "$PYTHON_VERSION" "$ISO_DIR/.venv"
+PY="$ISO_DIR/.venv/bin/python"
+uv pip install --python "$PY" torch torchvision torchaudio --index-url "$TORCH_INDEX"
+uv pip install --python "$PY" -r "$ISO_DIR/ComfyUI/requirements.txt"
+
+# 3. The packs, pinned, with their requirements in THIS venv only.
+for name in "${!NODES[@]}"; do
+ read -r url ref <<<"${NODES[$name]}"
+ dest="$ISO_DIR/ComfyUI/custom_nodes/$name"
+ [ -d "$dest/.git" ] || git clone -q "$url" "$dest"
+ git -C "$dest" fetch -q --depth 1 origin "$ref" 2>/dev/null || true
+ git -C "$dest" checkout -q "$ref" 2>/dev/null || echo "warn: could not pin $name to $ref"
+done
+uv pip install --python "$PY" -r "$ISO_DIR/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite/requirements.txt"
+uv pip install --python "$PY" -r "$ISO_DIR/ComfyUI/custom_nodes/ComfyUI-KJNodes/requirements.txt"
+uv pip install --python "$PY" -r "$ISO_DIR/ComfyUI/custom_nodes/ComfyUI-ThinkSound_Wrapper/requirements.txt"
+# LatentSync's requirements and runtime (mediapipe pins protobuf<5: fine here, it never touches the main venv).
+uv pip install --python "$PY" -r "$ISO_DIR/ComfyUI/custom_nodes/ComfyUI-LatentSyncWrapper/requirements.txt"
+uv pip install --python "$PY" "mediapipe>=0.10.8" face-alignment DeepCache ffmpeg-python pytorch_lightning
+
+# 4. Share the main install's model folders read-only instead of copying them.
+cat > "$ISO_DIR/ComfyUI/extra_model_paths.yaml" <<YAML
+# Written by scripts/comfy/install-isolated-worker.sh: the main ComfyUI's models, shared (nothing is copied).
+main_comfyui:
+ base_path: $COMFYUI_DIR/models
+ checkpoints: checkpoints
+ diffusion_models: diffusion_models
+ text_encoders: text_encoders
+ vae: vae
+ loras: loras
+ clip_vision: clip_vision
+ audio_encoders: audio_encoders
+ thinksound: thinksound
+YAML
+
+echo "Isolated worker ready in $ISO_DIR. Start it with:"
+echo " cd $ISO_DIR/ComfyUI && HOME=$ISO_DIR/home $PY main.py --listen 127.0.0.1 --port 8189 # add --cpu without a GPU"
+echo "Validate its workflows: COMFYUI_URL=http://127.0.0.1:8189 COMFYUI_MODELS_DIR=$COMFYUI_DIR/models node $SCRIPT_DIR/validate-workflows.mjs lipsync-latentsync16 sfx-thinksound --shared"