Skip to content

Conversation

@GhostTypes
Copy link
Member

Summary

  • Add ffmpeg directory to PATH so node-rtsp-stream can spawn it
  • Enhance ffmpeg detection to support macOS and cross-platform installations
  • Improve RTSP streaming reliability across different operating systems

Changes

  • Updated RtspStreamService.ts with improved ffmpeg path detection
  • Added platform-specific ffmpeg binary resolution (macOS Homebrew support)
  • Enhanced PATH configuration for ffmpeg subprocess spawning

…tallations

Fixes #13 - RTSP camera streaming failing on macOS due to ffmpeg not being detected.

Problem:
- Electron apps launched from Finder on macOS don't inherit user shell PATH
- Homebrew installs ffmpeg to /opt/homebrew/bin (Apple Silicon) or /usr/local/bin (Intel Mac)
- Current implementation only checks PATH, causing ffmpeg to not be found

Solution:
- Enhanced checkFfmpegAvailability() to check common installation paths across all platforms
- Tries PATH first (backward compatible), then checks platform-specific locations:
  * macOS: Homebrew (Apple Silicon & Intel), MacPorts
  * Linux: apt/yum/pacman, Snap, Flatpak, manual installs
  * Windows: common Program Files locations
- Provides helpful error messages with platform-specific installation instructions

Impact:
- macOS users with Homebrew-installed ffmpeg can now use RTSP cameras
- Linux users with Snap/Flatpak installations are now supported
- Better diagnostics when ffmpeg is not found
- No breaking changes - fully backward compatible
Fixes the "spawn ffmpeg ENOENT" error when launching from Finder on macOS.

Problem:
- Detection code finds ffmpeg at full path (e.g., /opt/homebrew/bin/ffmpeg)
- But node-rtsp-stream doesn't support custom ffmpeg path option
- When node-rtsp-stream spawns ffmpeg, it uses 'ffmpeg' which requires PATH
- macOS GUI launches have minimal PATH without Homebrew directories

Solution:
- After finding ffmpeg, extract its directory and add to process.env.PATH
- This makes ffmpeg available when node-rtsp-stream spawns it later
- Works for both forward slashes (macOS/Linux) and backslashes (Windows)
- Only modifies PATH when using explicit paths (not when ffmpeg already in PATH)

Testing:
- Launch from Finder: ffmpeg should now be found and spawn successfully
- Launch from Terminal: continues to work as before
- Cross-platform compatible with proper path separator handling
@GhostTypes GhostTypes self-assigned this Nov 4, 2025
@GhostTypes GhostTypes merged commit 07eedd5 into main Nov 4, 2025
4 checks passed
@GhostTypes GhostTypes deleted the claude/fix-ffmpeg-detection-macos-011CUm8npn4fdAGQ1kdSN1s5 branch November 4, 2025 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants