chenhg5/cc-connect · error
ffmpeg not found: %w
Error message
ffmpeg not found: %w
What it means
This error means the ffmpeg binary could not be located on PATH (exec.LookPath failed), so WAV→MP3 compression cannot run. The DingTalk voice pipeline depends on an external ffmpeg installation; the library does not bundle it.
Source
Thrown at platform/dingtalk/dingtalk.go:1312
}
// compressAudio compresses audio if it exceeds size limits.
// Uses ffmpeg to convert WAV to MP3 format (DingTalk supported, ~10:1 compression ratio).
func (p *Platform) compressAudio(ctx context.Context, audio []byte, format string) ([]byte, string, error) {
// Only WAV format can be compressed to MP3
if strings.ToLower(format) != "wav" {
return nil, "", fmt.Errorf("only WAV format can be compressed, got: %s", format)
}
return p.compressAudioWithFFmpeg(ctx, audio, format)
}
// compressAudioWithFFmpeg compresses audio using ffmpeg with stdin/stdout pipes.
// Converts WAV to MP3 format (64 kbps for voice).
func (p *Platform) compressAudioWithFFmpeg(ctx context.Context, audio []byte, format string) ([]byte, string, error) {
ffmpegPath, err := exec.LookPath("ffmpeg")
if err != nil {
return nil, "", fmt.Errorf("ffmpeg not found: %w", err)
}
args := []string{
"-i", "pipe:0",
"-ar", "16000", // 16kHz sample rate for voice
"-ac", "1", // mono
"-b:a", "64k", // 64 kbps bitrate (voice quality)
"-f", "mp3",
"-y",
"pipe:1",
}
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
cmd.Stdin = bytes.NewReader(audio)
var stdout, stderr bytes.Buffer
cmd.Stdout = &stdout
cmd.Stderr = &stderr
if err := cmd.Run(); err != nil {View on GitHub (pinned to 4000b2338a)
Solutions
- Install ffmpeg (apt-get install ffmpeg / brew install ffmpeg / apk add ffmpeg).
- Ensure the directory containing ffmpeg is in PATH for the daemon user; for systemd add Environment=PATH=... to the unit.
- Symlink or copy the binary into a standard PATH location such as /usr/local/bin.
- Verify with `which ffmpeg` as the same user the daemon runs as.
Example fix
// systemd unit before [Service] ExecStart=/usr/local/bin/cc-connect // after [Service] Environment=PATH=/usr/local/bin:/usr/bin:/bin ExecStart=/usr/local/bin/cc-connect
Defensive patterns
Strategy: fallback
Validate before calling
// Pre-flight at startup
if _, err := exec.LookPath("ffmpeg"); err != nil {
slog.Warn("ffmpeg missing; voice compression disabled", "err", err)
} Prevention
- Add ffmpeg to the deployment image/Dockerfile and to systemd PATH.
- Run a doctor/startup check that warns when ffmpeg is absent.
- Document ffmpeg as an optional dependency for the DingTalk voice feature.
When it happens
Trigger: compressAudio → compressAudioWithFFmpeg runs exec.LookPath("ffmpeg") and ffmpeg is not installed, not in PATH, or lacks the execute bit.
Common situations: Deploying the cc-connect binary in a minimal Docker image or systemd service with a stripped PATH; ffmpeg installed under a non-PATH directory; running the daemon as a user whose PATH differs from the shell user's.
Understand the failure class
Background: "X is not installed. Please install it with pip install Y": missing optional dependency errors — ImportError/ValueError raised when a library's optional extra was never installed — this error's family across 22 libraries.
Related errors
- ffmpeg not found in PATH: install ffmpeg to enable voice mes
- ffmpeg not found in PATH: install ffmpeg to enable audio con
- ffmpeg not found in PATH: %w
- dingtalk: convert MP3 to AMR failed: %w
- ffmpeg compression failed: %w (stderr: %s)
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/9ed8f5e818576b2e.
Report an issue: GitHub.