Skip to content

fix(studio): resolve ffmpeg outside PATH so render doesn't 503#1536

Merged
miguel-heygen merged 1 commit into
mainfrom
fix/studio-render-503
Jun 17, 2026
Merged

fix(studio): resolve ffmpeg outside PATH so render doesn't 503#1536
miguel-heygen merged 1 commit into
mainfrom
fix/studio-render-503

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

Problem

Rendering in Studio fails with repeated POST /api/projects/:id/render → 503 (Service Unavailable).

The render pre-flight check (studioServer.ts) shells out to which ffmpeg to confirm ffmpeg is installed before starting the capture pipeline. which only searches the server process's $PATH. When Studio is launched from a GUI/Dock/launchd context (the common macOS case), that PATH doesn't include /opt/homebrew/bin, so which ffmpeg fails — even though ffmpeg is installed at /opt/homebrew/bin/ffmpeg. findFFmpeg() returns undefined and the endpoint returns 503.

Reproduced by running the exact which ffmpeg the server runs under a PATH stripped of Homebrew — it fails, while the binary is present on disk.

Fix

When the PATH lookup fails, fall back to probing well-known install dirs (/opt/homebrew/bin, /usr/local/bin, /usr/bin, /bin, /snap/bin). Covers Homebrew on Apple Silicon and Intel, plus system/Linux installs. No-op on Windows, where where + installer PATH entries already cover it. Applies to both ffmpeg and ffprobe via the shared resolver.

Also drops the [kf:static]/[kf:runtime] keyframe diagnostics that were spamming the Studio console.

Testing

  • New ffmpeg.test.ts regression test — verified it fails without the fallback, passes with it.
  • Existing useGsapTweenCache suite (5 tests) still green.

The render pre-flight check shells out to `which ffmpeg`, which only
searches the server process's PATH. When Studio is launched from a
GUI/Dock/launchd context that PATH lacks /opt/homebrew/bin, so `which`
fails even when ffmpeg is installed — and POST /render returns 503
"FFmpeg not found".

Fall back to probing well-known install dirs (Homebrew on Apple Silicon
and Intel, plus system/Linux locations) when the PATH lookup fails.

Also drop the [kf:static]/[kf:runtime] keyframe diagnostics that were
spamming the Studio console in prod, and fix two unrelated CI breakages
the branch inherited: a Windows-sensitive ffmpeg test (pin platform) and
a stale player test mock missing onRuntimeReady.
@miguel-heygen miguel-heygen force-pushed the fix/studio-render-503 branch from 8f8587a to d8c0150 Compare June 17, 2026 14:12
@miguel-heygen miguel-heygen merged commit ff25058 into main Jun 17, 2026
40 checks passed
@miguel-heygen miguel-heygen deleted the fix/studio-render-503 branch June 17, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant