Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: install ffmpeg in setup.sh and update.sh

Ilya Eivy3ad42874dced
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 7b6b72d34f..86b18e0c93 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -96,6 +96,7 @@
## Fixed
+- **`./setup.sh` and `./update.sh` now install ffmpeg, so camera devices, video generation, and thumbnails work out of the box.** PortOS's media/video features (`GET /api/media/devices` camera enumeration, video generation, thumbnailing, audio mux) shell out to the `ffmpeg` binary via `server/lib/ffmpeg.js` — but ffmpeg isn't an npm dependency, so a fresh install or update never provisioned it and those paths failed at runtime with `spawn ffmpeg ENOENT`. Both scripts now ensure ffmpeg is present: when it's missing they install it via the platform package manager (macOS Homebrew; Linux apt-get/dnf/pacman), fail-soft with a manual-install hint if no package manager is found. On Linux the install is prefixed with `sudo` only when not already root, so a root container (e.g. the Docker image, which has no `sudo` binary) still provisions ffmpeg. `update.sh` runs unattended (no TTY), so its Linux branch is gated on passwordless sudo (`sudo -n`) to avoid blocking on a password prompt, and surfaces an "ffmpeg" step in the Update tab's progress. (`setup.sh`, `update.sh`, `client/src/components/apps/tabs/UpdateTab.jsx`)
- **Per-issue text generation no longer lists every character twice.** Each prose/comic-script/teleplay prompt rendered the series-canon characters as full bible records in `### Characters`, and then re-listed the very same characters in the terse `### Universe at a glance` roster — so every character appeared twice in the prompt (wasted tokens, and the source of a "why is this character in here twice" report). The roster now excludes characters already in the full bible (as its own code comment always intended — it's meant to add *places/objects + other* canon not in the series bible), keeping its places/objects and any non-series-canon characters. (`server/lib/universePromptRenderers.js`, `server/services/pipeline/textStages.js`)
- **A usage-limited provider is no longer benched for up to a day.** When a CLI provider (e.g. Codex) hit its usage limit, PortOS parsed the provider's self-reported reset ("resets in 21h 52m") and benched it for that entire span — sidelining the primary for nearly a day even though usage limits reset on a rolling window (≈5h max) and capacity usually frees much sooner. The usage-limit bench is now a tight retry interval (default 10 minutes), hard-capped at the 5h reset window, and it still respects a genuinely *shorter* stated reset. The provider's stated reset is kept for display. (`server/lib/aiToolkit/providerStatus.js`)
- **Autopilot editorial auto-fix now honors the run's chosen provider/model.** The editorial loop passed the run's provider override to the manuscript *review* but not to fix *generation*, so auto-fixes silently ran on the active/default provider (and its runtime fallback) instead of the model selected for the run — which, when the default was rate-limited, degraded fixes onto a weak fallback. Fix generation now threads the same override as the review. (`server/services/pipeline/seriesAutopilot.js`)
diff --git a/client/src/components/apps/tabs/UpdateTab.jsx b/client/src/components/apps/tabs/UpdateTab.jsx
index 8031f59150..c0ad15daba 100644
--- a/client/src/components/apps/tabs/UpdateTab.jsx
+++ b/client/src/components/apps/tabs/UpdateTab.jsx
@@ -14,6 +14,7 @@ const STEP_LABELS = {
'pm2-stop': 'Stopping apps',
'npm-install': 'Installing dependencies',
setup: 'Running setup',
+ ffmpeg: 'Checking ffmpeg',
migrations: 'Running migrations',
build: 'Building client',
restart: 'Restarting PortOS',
diff --git a/setup.sh b/setup.sh
index 615e1ef93c..6ab198342a 100755
--- a/setup.sh
+++ b/setup.sh
@@ -74,6 +74,55 @@ if node --input-type=module -e "import('./server/lib/tailscale.js').then(m => pr
echo ""
fi
+# ffmpeg is a runtime dependency for the media/video features (camera-device
+# enumeration at GET /api/media/devices, video generation, thumbnailing, audio
+# mux) — server/lib/ffmpeg.js shells out to the `ffmpeg` binary. It's not an npm
+# package, so without this the features fail at runtime with `spawn ffmpeg
+# ENOENT`. Install it via the platform package manager when it's missing.
+# Fail-soft: PortOS still boots without it; only the media/video paths degrade.
+ensure_ffmpeg() {
+ if command -v ffmpeg &> /dev/null; then
+ return 0
+ fi
+ echo "ffmpeg not found — required for camera devices, video generation, and thumbnails."
+ case "$(uname -s)" in
+ Darwin)
+ if command -v brew &> /dev/null; then
+ echo "Installing ffmpeg via Homebrew..."
+ brew install ffmpeg || echo "⚠️ brew install ffmpeg failed — install manually: brew install ffmpeg"
+ else
+ echo "⚠️ Homebrew not found. Install brew (https://brew.sh) then run: brew install ffmpeg"
+ fi
+ ;;
+ Linux)
+ # Prefix installs with sudo only when not already root — a root
+ # container (e.g. the Docker image) has no sudo binary, so prefixing
+ # unconditionally would fail to install despite apt-get being present.
+ maybe_sudo=""
+ [ "$(id -u)" -ne 0 ] && maybe_sudo="sudo"
+ if [ -n "$maybe_sudo" ] && ! command -v sudo &> /dev/null; then
+ echo "⚠️ Not root and sudo unavailable — install ffmpeg manually (e.g. apt-get install ffmpeg)."
+ elif command -v apt-get &> /dev/null; then
+ echo "Installing ffmpeg via apt-get${maybe_sudo:+ (may prompt for sudo)}..."
+ $maybe_sudo apt-get update && $maybe_sudo apt-get install -y ffmpeg || echo "⚠️ apt-get install ffmpeg failed — install manually: ${maybe_sudo:+sudo }apt-get install ffmpeg"
+ elif command -v dnf &> /dev/null; then
+ echo "Installing ffmpeg via dnf${maybe_sudo:+ (may prompt for sudo)}..."
+ $maybe_sudo dnf install -y ffmpeg || echo "⚠️ dnf install ffmpeg failed — install manually: ${maybe_sudo:+sudo }dnf install ffmpeg"
+ elif command -v pacman &> /dev/null; then
+ echo "Installing ffmpeg via pacman${maybe_sudo:+ (may prompt for sudo)}..."
+ $maybe_sudo pacman -S --noconfirm ffmpeg || echo "⚠️ pacman -S ffmpeg failed — install manually: ${maybe_sudo:+sudo }pacman -S ffmpeg"
+ else
+ echo "⚠️ No known package manager (apt-get/dnf/pacman). Install ffmpeg manually so media/video features work."
+ fi
+ ;;
+ *)
+ echo "⚠️ Unrecognized platform — install ffmpeg manually so media/video features work."
+ ;;
+ esac
+ echo ""
+}
+ensure_ffmpeg
+
# Install/update slash-do (project-level slash commands for Claude Code et al.)
# via npx. Auto-detects the installed AI environments and lays down the latest
# command set under ~/.claude/commands (or per-environment equivalent). The
diff --git a/update.sh b/update.sh
index e304584367..877160cc91 100755
--- a/update.sh
+++ b/update.sh
@@ -210,6 +210,68 @@ run node scripts/setup-ghostty.js || true
step "setup" "done" "Setup complete"
log ""
+# Ensure ffmpeg is present — it's a runtime dependency for the media/video
+# features (camera-device enumeration, video generation, thumbnailing, audio
+# mux) that server/lib/ffmpeg.js shells out to, not an npm package. Without it
+# those paths fail at runtime with `spawn ffmpeg ENOENT`. update.sh has no TTY,
+# so the Linux package-manager branches are gated on passwordless sudo
+# (`sudo -n`) — never block the unattended update waiting on a password prompt.
+# All branches are fail-soft: the update completes regardless.
+step "ffmpeg" "running" "Checking ffmpeg..."
+if command -v ffmpeg &> /dev/null; then
+ step "ffmpeg" "done" "ffmpeg present"
+else
+ log "🎞️ ffmpeg not found — required for camera devices, video generation, and thumbnails."
+ case "$(uname -s)" in
+ Darwin)
+ if command -v brew &> /dev/null; then
+ log "📦 Installing ffmpeg via Homebrew..."
+ run brew install ffmpeg || log "⚠️ brew install ffmpeg failed — install manually: brew install ffmpeg"
+ else
+ log "⚠️ Homebrew not found. Install brew (https://brew.sh) then run: brew install ffmpeg"
+ fi
+ ;;
+ Linux)
+ # Prefix with sudo only when not root; update.sh has no TTY so sudo must
+ # be passwordless (sudo -n). A root container needs no sudo at all (and
+ # the Docker image has no sudo binary). If we're non-root and can't get
+ # passwordless sudo, we can't escalate — print the manual hint.
+ SUDO=""
+ can_install=1
+ if [ "$(id -u)" -ne 0 ]; then
+ if sudo -n true 2>/dev/null; then
+ SUDO="sudo -n"
+ else
+ can_install=0
+ fi
+ fi
+ if [ "$can_install" -eq 0 ]; then
+ log "⚠️ ffmpeg missing and passwordless sudo unavailable — install manually: sudo apt-get install ffmpeg (or your distro's equivalent)."
+ elif command -v apt-get &> /dev/null; then
+ log "📦 Installing ffmpeg via apt-get..."
+ (run $SUDO apt-get update && run $SUDO apt-get install -y ffmpeg) || log "⚠️ apt-get install ffmpeg failed — install manually: sudo apt-get install ffmpeg"
+ elif command -v dnf &> /dev/null; then
+ log "📦 Installing ffmpeg via dnf..."
+ run $SUDO dnf install -y ffmpeg || log "⚠️ dnf install ffmpeg failed — install manually: sudo dnf install ffmpeg"
+ elif command -v pacman &> /dev/null; then
+ log "📦 Installing ffmpeg via pacman..."
+ run $SUDO pacman -S --noconfirm ffmpeg || log "⚠️ pacman -S ffmpeg failed — install manually: sudo pacman -S ffmpeg"
+ else
+ log "⚠️ No known package manager (apt-get/dnf/pacman). Install ffmpeg manually so media/video features work."
+ fi
+ ;;
+ *)
+ log "⚠️ Unrecognized platform — install ffmpeg manually so media/video features work."
+ ;;
+ esac
+ if command -v ffmpeg &> /dev/null; then
+ step "ffmpeg" "done" "ffmpeg installed"
+ else
+ step "ffmpeg" "done" "ffmpeg unavailable (media/video features degraded)"
+ fi
+fi
+log ""
+
# Run data migrations
step "migrations" "running" "Running data migrations..."
if [ -f "$ROOT_DIR/scripts/run-migrations.js" ]; then