babysor/MockingBird · critical · RuntimeError

ffmpeg not found in PATH.

Error message

ffmpeg not found in PATH.

What it means

RuntimeError raised by ensure_ffmpeg when shutil.which('ffmpeg') returns None, i.e. the ffmpeg binary is not on PATH. render_timeline requires ffmpeg for all normalization and mixing, so this is a hard startup check.

Source

Thrown at skills/speak/scripts/render_timeline.py:123

    for key, seg_cfg in config.get("segments", {}).items():
        lo, hi = parse_segment_key(key)
        if lo <= index <= hi:
            merged.update(seg_cfg)
    return merged


# ── ffmpeg helpers ────────────────────────────────────────────────────


def _run_ff(cmd: List[str]) -> None:
    proc = subprocess.run(cmd, capture_output=True, text=True)
    if proc.returncode != 0:
        raise RuntimeError(f"ffmpeg failed: {' '.join(cmd)}\n{proc.stderr}")


def ensure_ffmpeg() -> None:
    if not shutil.which("ffmpeg"):
        raise RuntimeError("ffmpeg not found in PATH.")


def probe_duration_ms(path: Path) -> float:
    proc = subprocess.run(
        [
            "ffprobe", "-v", "error", "-show_entries", "format=duration",
            "-of", "default=noprint_wrappers=1:nokey=1", str(path),
        ],
        capture_output=True, text=True,
    )
    if proc.returncode != 0:
        raise RuntimeError(f"ffprobe failed on {path}: {proc.stderr}")
    return float(proc.stdout.strip()) * 1000


def normalize_duration_pad_trim(inp: Path, outp: Path, target_ms: int) -> None:
    """Pad short audio then trim to exact target duration (Noiz backend)."""
    sec = target_ms / 1000.0

View on GitHub (pinned to 28dc5e14f1)

Solutions

  1. Install ffmpeg: brew install ffmpeg / apt-get install ffmpeg / use a static build
  2. Verify with: ffmpeg -version
  3. If installed but not found, add its directory to PATH or invoke the script from a shell with the correct profile loaded

Example fix

# before (missing)
# after
apt-get update && apt-get install -y ffmpeg  # Debian/Ubuntu
brew install ffmpeg                        # macOS
Defensive patterns

Strategy: validation

Validate before calling

import shutil
if not shutil.which('ffmpeg'):
    sys.exit('Install ffmpeg first: apt-get install ffmpeg')

Prevention

When it happens

Trigger: Running the script on a machine/container without ffmpeg installed, in a venv whose PATH shadows the binary, or in a minimal Docker image.

Common situations: Fresh macOS/Linux without brew/apt install, slim Docker images, CI runners, or SSH sessions with a minimal PATH.

Related errors


AI-assisted analysis of babysor/MockingBird@28dc5e14f1 (2026-08-27). Data as JSON: /api/errors/82b8fbe5c6640469. Report an issue: GitHub.