mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
fix(studio): add FFmpeg pre-flight check before render (#1100)
* fix(studio): add FFmpeg pre-flight check before starting render Studio renders now fail fast with a 422 and an actionable FFmpeg install hint instead of burning through the entire capture pipeline before hitting "spawn ffmpeg ENOENT" at encode. * fix(studio): address review — use 503, memoize FFmpeg lookup
This commit is contained in:
@@ -508,6 +508,22 @@ export function createStudioServer(options: StudioServerOptions): StudioServer {
|
||||
});
|
||||
});
|
||||
|
||||
// ── Pre-flight checks for render ────────────────────────────────────────
|
||||
// Intercept render requests before they reach the shared API so we can
|
||||
// fail fast with an actionable hint instead of burning through the entire
|
||||
// capture pipeline before hitting "spawn ffmpeg ENOENT" at encode.
|
||||
let cachedFFmpegPath: string | undefined;
|
||||
app.post("/api/projects/:id/render", async (c, next) => {
|
||||
const { findFFmpeg, getFFmpegInstallHint } = await import("../browser/ffmpeg.js");
|
||||
if (!cachedFFmpegPath) {
|
||||
cachedFFmpegPath = findFFmpeg();
|
||||
}
|
||||
if (!cachedFFmpegPath) {
|
||||
return c.json({ error: "FFmpeg not found", hint: getFFmpegInstallHint() }, 503);
|
||||
}
|
||||
return next();
|
||||
});
|
||||
|
||||
// Mount the shared studio API at /api.
|
||||
// Use fetch() forwarding (not .route()) so the sub-app sees paths without
|
||||
// the /api prefix — the shared module's path extraction uses c.req.path.
|
||||
|
||||
Reference in New Issue
Block a user