(name: "ffmpeg" | "ffprobe")
| 8 | export const FFPROBE_PATH_ENV = "HYPERFRAMES_FFPROBE_PATH"; |
| 9 | |
| 10 | function findOnPath(name: "ffmpeg" | "ffprobe"): string | undefined { |
| 11 | try { |
| 12 | const cmd = process.platform === "win32" ? `where ${name}` : `which ${name}`; |
| 13 | const output = execSync(cmd, { |
| 14 | encoding: "utf-8", |
| 15 | stdio: ["pipe", "pipe", "pipe"], |
| 16 | timeout: 5000, |
| 17 | }); |
| 18 | const first = output |
| 19 | .split(/\r?\n/) |
| 20 | .map((s) => s.trim()) |
| 21 | .find(Boolean); |
| 22 | return first ? resolve(first) : undefined; |
| 23 | } catch { |
| 24 | return undefined; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | // GUI/Dock/launchd-spawned processes on macOS don't inherit the shell PATH, so |
| 29 | // `which ffmpeg` fails even when ffmpeg is installed via Homebrew. Probe the |
no test coverage detected