chenhg5/cc-connect · error

ffmpeg not found in PATH: install ffmpeg to enable voice mes

Error message

ffmpeg not found in PATH: install ffmpeg to enable voice message support

What it means

ConvertAudioToMP3 converts raw audio bytes (wav, amr, silk, etc.) to MP3 by shelling out to ffmpeg. Before spawning the subprocess it runs exec.LookPath("ffmpeg"); if ffmpeg is not installed or not on the PATH, it returns this error instead of attempting the conversion. The library intentionally refuses to guess an ffmpeg location, so voice transcription cannot proceed without the binary present.

Source

Thrown at core/speech.go:306

	}
	if err := json.Unmarshal(body, &result); err != nil {
		return "", fmt.Errorf("gemini stt: parse response: %w", err)
	}
	if len(result.Candidates) == 0 || len(result.Candidates[0].Content.Parts) == 0 {
		return "", fmt.Errorf("gemini stt: empty response")
	}

	return strings.TrimSpace(result.Candidates[0].Content.Parts[0].Text), nil
}

// ConvertAudioToMP3 uses ffmpeg to convert audio from unsupported formats to mp3.
// Returns the mp3 bytes. If ffmpeg is not installed, returns an error.
// The ctx is honored: cancellation kills the ffmpeg subprocess, matching the
// behavior of the other Convert* helpers in this file.
func ConvertAudioToMP3(ctx context.Context, audio []byte, srcFormat string) ([]byte, error) {
	ffmpegPath, err := exec.LookPath("ffmpeg")
	if err != nil {
		return nil, fmt.Errorf("ffmpeg not found in PATH: install ffmpeg to enable voice message support")
	}

	var cmd *exec.Cmd
	if srcFormat == "amr" || srcFormat == "silk" {
		cmd = exec.CommandContext(ctx, ffmpegPath,
			"-f", srcFormat,
			"-i", "pipe:0",
			"-f", "mp3",
			"-ac", "1",
			"-ar", "16000",
			"-y",
			"pipe:1",
		)
	} else {
		cmd = exec.CommandContext(ctx, ffmpegPath,
			"-i", "pipe:0",
			"-f", "mp3",
			"-ac", "1",

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Install ffmpeg: `apt-get install -y ffmpeg` (Debian/Ubuntu), `brew install ffmpeg` (macOS), or the equivalent for your distro.
  2. If ffmpeg is already installed, ensure its directory is in the PATH of the cc-connect process (set PATH in the systemd unit, Dockerfile ENV, or launchd plist).
  3. Verify from the same environment the daemon runs in: `which ffmpeg` or `sudo -u <daemonuser> which ffmpeg`.
  4. If voice transcription is not needed, disable the voice/audio feature in config so TranscribeAudio is never invoked.

Example fix

// Dockerfile before
FROM golang:1.22-alpine
// after
FROM golang:1.22-alpine
RUN apk add --no-cache ffmpeg
Defensive patterns

Strategy: fallback

Validate before calling

if _, err := exec.LookPath("ffmpeg"); err != nil {
    // ffmpeg unavailable — skip voice transcription or warn the user
}

Type guard

func ffmpegAvailable() bool { _, err := exec.LookPath("ffmpeg"); return err == nil }

Try / catch

mp3, err := core.ConvertAudioToMP3(ctx, audio, format)
if err != nil {
    if strings.Contains(err.Error(), "ffmpeg not found") {
        log.Warn("voice transcription unavailable: ffmpeg not installed")
        return nil // degrade gracefully
    }
    return fmt.Errorf("transcribe: %w", err)
}

Prevention

When it happens

Trigger: Calling ConvertAudioToMP3 (directly or via TranscribeAudio) on a machine where `exec.LookPath("ffmpeg")` fails: ffmpeg not installed, installed but not in the PATH of the process (e.g. systemd service with a minimal PATH, Docker scratch/slim image, GUI-launched app with a stripped environment).

Common situations: Deploying cc-connect in a minimal Docker image without ffmpeg; running the daemon under systemd where PATH is /usr/bin:/bin and ffmpeg was installed via a user-local tool (homebrew, ~/.local/bin); fresh macOS/Linux box where voice messages were never tested; switching from dev machine (ffmpeg present) to production (ffmpeg absent).

Related errors


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/24307843b3165788. Report an issue: GitHub.