tonhowtf/omniget · error

ffmpeg nao iniciou

Error message

ffmpeg nao iniciou: {}

What it means

detect() spawns ffmpeg with silencedetect filters and captures stderr; if the ffmpeg process cannot be spawned at all, the io::Error is wrapped as 'ffmpeg nao iniciou: {}' (ffmpeg did not start). This is a process-spawn failure, not an ffmpeg runtime failure.

Solutions

  1. Run ensure_ffmpeg()/dependency bootstrap and confirm ffmpeg is on PATH before calling cut_one.
  2. Verify the resolved ffmpeg path with `ffmpeg -version` manually.
  3. Check file permissions (execute bit) on the ffmpeg binary.
  4. In containers/CI, install ffmpeg in the image.

Example fix

// before
let item = cut_one(&ffmpeg_path, &opts, input).await?;
// after
let ffmpeg_path = ensure_ffmpeg().await?;
let item = cut_one(&ffmpeg_path, &opts, input).await?;
Defensive patterns

Strategy: validation

Validate before calling

// Rust
async fn ffmpeg_ready() -> anyhow::Result<()> {
    let p = ensure_ffmpeg().await?;
    let ok = Command::new(&p).arg("-version").output().await?.status.success();
    anyhow::ensure!(ok, "ffmpeg inoperante em {:?}", p);
    Ok(())
}

Type guard

null

Try / catch

match run_silence_cut(&opts, input).await {
    Err(e) if e.to_string().contains("ffmpeg nao iniciou") => {
        eprintln!("instale/verifique o ffmpeg antes de cortar silencios");
    }
    r => r?,
}

Prevention

When it happens

Trigger: Calling detect (via cut_one) when the ffmpeg binary path is wrong, the binary is not executable, or the OS fails to fork/exec (e.g. missing dependency, PATH not set).

Common situations: ffmpeg not installed in the environment; ensure_ffmpeg resolved a stale path; sandboxed/containerized environment lacking the binary; broken download of a bundled ffmpeg.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/24ecbb89ae3728ab. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/silence_cut.rs:215

    min_silence: f64,
) -> anyhow::Result<String> {
    let out = crate::core::process::command(ffmpeg)
        .args(["-hide_banner", "-nostats", "-i"])
        .arg(input)
        .args([
            "-af",
            &format!(
                "silencedetect=noise={}dB:d={}",
                threshold_db,
                min_silence.max(0.05)
            ),
            "-f",
            "null",
            "-",
        ])
        .output()
        .await
        .map_err(|e| anyhow!("ffmpeg nao iniciou: {}", e))?;
    Ok(String::from_utf8_lossy(&out.stderr).to_string())
}

async fn cut_one(ffmpeg: &Path, opts: &SilenceOptions, input: &str) -> anyhow::Result<SilenceItem> {
    let inp = Path::new(input);
    let probe = crate::core::ffmpeg::probe(inp).await?;
    let total = probe.duration_seconds;
    if total <= 0.0 {
        return Err(anyhow!("não consegui medir a duração"));
    }
    let has_audio = probe.streams.iter().any(|s| s.codec_type == "audio");
    if !has_audio {
        return Err(anyhow!("o arquivo não tem trilha de áudio"));
    }

    let stderr = detect(ffmpeg, inp, opts.threshold_db, opts.min_silence).await?;
    let spans = parse_spans(&stderr, total);
    let (spans, skipped) = cap_spans(spans, MAX_SEGMENTS);

View on GitHub (pinned to 8600b91f42)