mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-15 13:58:20 +00:00
When HYPERFRAMES_FFMPEG_PATH is unset, findOnPath() auto-detects ffmpeg/ffprobe via `where` (Windows) / `which` and used the FIRST result. On Windows `where ffmpeg` frequently lists a .cmd/.bat wrapper (npm/scoop/winget shims) ahead of the real .exe, and Node's spawn without shell:true cannot execute a .cmd/.bat — it throws spawn EINVAL. So render capture/encode AND audio muxing failed with "spawn EINVAL" even though FFmpeg was installed; the reporter's own fix was to rename the .cmd wrappers so ffmpeg.exe resolved first. Two independent reports of this exact EINVAL (one explicitly tracing it to `where` returning ffmpeg.cmd before ffmpeg.exe). Fix: extract selectBinaryFromPathResults(output, platform) — on win32 it prefers the first directly-spawnable executable (.exe/.com) among the results, falling back to the first result only when none is listed (so a shell-runnable .cmd-only setup isn't dropped). Non-win32 is unchanged (first result). Scoped to selection: the .cmd-only case (would still EINVAL on spawn) is left for a separate shell-spawn change. Test: selectBinaryFromPathResults unit tests — win32 prefers .exe over a leading .cmd and over a .bat, falls back to the first when no exe is listed, returns the first on non-win32, and undefined for empty output. Existing env-resolution tests unchanged. Engine build green.