Fix recording ENOENT: try absolute ffmpeg paths before bare 'ffmpeg'

ffmpegPath() short-circuited on the bare 'ffmpeg' candidate, so the absolute
Homebrew/system paths were never checked. From a terminal PATH covers it, but
the packaged app launched from Finder has a minimal PATH: stopping a
recording failed with 'spawn ffmpeg ENOENT'. Absolute candidates now win;
bare 'ffmpeg' is the last resort.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XVMQ2JhsJ77pGKqcvvFHqc
This commit is contained in:
lucianoandClaude Fable 5 committed 2026-09-08 17:34:51 +02:00
1 parent 777f7ff09d
commit 4dfa0fc993
2 files changed
+7 -5

No files matched your search

+6 -4
View File
@@ -292,14 +292,16 @@ let recStream = null, recTempPath = null;
function ffmpegPath() {
const cands = [];
try { cands.push(require('ffmpeg-static')); } catch (e) { /* optional */ }
cands.push(process.env.FFMPEG, 'ffmpeg',
// Absolute candidates FIRST: the packaged app launched from Finder has a
// minimal PATH (no /opt/homebrew/bin), so a bare 'ffmpeg' spawns ENOENT
// there even though the same call works when started from a terminal.
cands.push(process.env.FFMPEG,
'/opt/homebrew/bin/ffmpeg', '/usr/local/bin/ffmpeg', '/usr/bin/ffmpeg',
'C:\\ffmpeg\\bin\\ffmpeg.exe', 'C:\\Program Files\\ffmpeg\\bin\\ffmpeg.exe');
for (const c of cands) {
if (!c) continue;
if (c === 'ffmpeg' || fs.existsSync(c)) return c;
if (c && fs.existsSync(c)) return c;
}
return 'ffmpeg';
return 'ffmpeg'; // last resort: hope PATH has it
}
function transcodeToMp4(input, output, opts) {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "dj-visualizer",
"version": "1.8.0",
"version": "1.8.1",
"description": "Audio-reactive fractal & abstract visualizer for external display (Mac)",
"main": "main.js",
"author": {