tonhowtf/omniget · error · anyhow::Error

ffmpeg nao iniciou

Error message

ffmpeg nao iniciou: {}

What it means

measure runs ffmpeg (loudnorm/ebur128 analysis) via crate::core::process::command; if the process cannot be spawned at all, the io::Error is wrapped as "ffmpeg nao iniciou: {e}". This is a spawn/startup failure, not an ffmpeg processing failure.

Solutions

  1. Verify ffmpeg is installed and resolvable: `which ffmpeg` / `where ffmpeg`
  2. Check the configured ffmpeg path passed to clean_one/measure points to an executable file
  3. Add execute permission (chmod +x) if the bundled binary lacks it
  4. Match the io::ErrorKind to give clearer guidance (NotFound -> install ffmpeg; PermissionDenied -> chmod)

Example fix

// before
.output()
.await
.map_err(|e| anyhow!("ffmpeg nao iniciou: {}", e))?;
// after
.output()
.await
.map_err(|e| match e.kind() {
    std::io::ErrorKind::NotFound => anyhow!("ffmpeg binary not found at '{}'; install ffmpeg or set the correct path", ffmpeg.display()),
    std::io::ErrorKind::PermissionDenied => anyhow!("ffmpeg at '{}' is not executable (chmod +x)", ffmpeg.display()),
    _ => anyhow!("ffmpeg nao iniciou: {}", e),
})?;
Defensive patterns

Strategy: validation

Validate before calling

// Verify ffmpeg is runnable before the pipeline
let ffmpeg = Path::new("ffmpeg");
anyhow::ensure!(
    which::which(ffmpeg).is_ok(),
    "ffmpeg not found on PATH; install it or configure the path"
);

Try / catch

match measure(&ffmpeg, &input, &filter).await {
    Ok(m) => m,
    Err(e) if e.to_string().contains("ffmpeg nao iniciou") => {
        return Err(anyhow!("ffmpeg is not installed or not executable: {e}"));
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: clean_one or live_audio_normalizes_and_denoises -> measure when the ffmpeg binary path is wrong/missing, the file lacks execute permission, or the OS fails to fork/exec the process.

Common situations: ffmpeg not installed or not on PATH; misconfigured ffmpeg path in options; Windows vs Unix binary name mismatch; permission bits stripped after packaging.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/audio_clean.rs:163

    pub gain_db: f64,
    pub filter: String,
    pub ok: bool,
    pub error: Option<String>,
}

#[derive(Debug, Clone, Serialize)]
pub struct CleanResult {
    pub items: Vec<CleanItem>,
}

async fn measure(ffmpeg: &Path, input: &Path, filter: &str) -> anyhow::Result<Loudness> {
    let out = crate::core::process::command(ffmpeg)
        .args(["-hide_banner", "-nostats", "-i"])
        .arg(input)
        .args(["-af", filter, "-f", "null", "-"])
        .output()
        .await
        .map_err(|e| anyhow!("ffmpeg nao iniciou: {}", e))?;
    let stderr = String::from_utf8_lossy(&out.stderr).to_string();
    parse_measure(&stderr).ok_or_else(|| {
        anyhow!(
            "não consegui medir o loudness: {}",
            stderr.lines().last().unwrap_or("").trim()
        )
    })
}

async fn clean_one(ffmpeg: &Path, opts: &CleanOptions, input: &str) -> anyhow::Result<CleanItem> {
    let inp = Path::new(input);
    let probe = crate::core::ffmpeg::probe(inp).await?;
    if !probe.streams.iter().any(|s| s.codec_type == "audio") {
        return Err(anyhow!("o arquivo não tem trilha de áudio"));
    }
    let has_video = probe
        .streams
        .iter()

View on GitHub (pinned to 8600b91f42)