fix(studio): resolve ffmpeg outside PATH so render doesn't 503#1536
Merged
Conversation
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.
8f8587a to
d8c0150
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Rendering in Studio fails with repeated
POST /api/projects/:id/render → 503 (Service Unavailable).The render pre-flight check (
studioServer.ts) shells out towhich ffmpegto confirm ffmpeg is installed before starting the capture pipeline.whichonly 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, sowhich ffmpegfails — even though ffmpeg is installed at/opt/homebrew/bin/ffmpeg.findFFmpeg()returnsundefinedand the endpoint returns 503.Reproduced by running the exact
which ffmpegthe 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, wherewhere+ 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
ffmpeg.test.tsregression test — verified it fails without the fallback, passes with it.useGsapTweenCachesuite (5 tests) still green.