From 4dfa0fc99326c365f83b942f67319895334f9972 Mon Sep 17 00:00:00 2001 From: luciano Date: Tue, 8 Sep 2026 17:34:51 +0200 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01XVMQ2JhsJ77pGKqcvvFHqc --- main.js | 10 ++++++---- package.json | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/main.js b/main.js index c7c3566..fa65519 100644 --- a/main.js +++ b/main.js @@ -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) { diff --git a/package.json b/package.json index 024fcd9..c2535c1 100644 --- a/package.json +++ b/package.json @@ -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": {