tonhowtf/omniget · error

ffmpeg nao iniciou

Error message

ffmpeg nao iniciou: {}

What it means

This error is thrown when the ffmpeg binary fails to spawn at all during the batch image-resize run, e.g. the process could not be started (missing binary, bad path) or the wait failed. It wraps the underlying std::process error with anyhow and aborts the whole run (unlike per-file failures, which are only recorded in `failed`).

Solutions

  1. Install ffmpeg and make sure it is on PATH (or point the tool's ffmpeg path config at the binary).
  2. Verify with `ffmpeg -version` in the same environment the app runs in (GUI apps may inherit a different PATH).
  3. If spawning a specific binary path, check it exists and is executable before running.
  4. Keep the anyhow context (`ffmpeg nao iniciou: {}`) when propagating so the OS error message is preserved.

Example fix

// before
Err(e) => return Err(anyhow!("ffmpeg nao iniciou: {}", e)),
// after
// ensure ffmpeg is locatable before the loop:
if which::which("ffmpeg").is_err() {
    return Err(anyhow!("ffmpeg nao iniciou: binário não encontrado no PATH"));
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Rust: check ffmpeg availability before running
fn ensure_ffmpeg() -> anyhow::Result<()> {
    let st = std::process::Command::new("ffmpeg").arg("-version").output()?;
    anyhow::ensure!(st.status.success(), "ffmpeg não está disponível");
    Ok(ensure_ffmpeg()?)
}

Type guard

fn ffmpeg_available() -> bool {
    std::process::Command::new("ffmpeg").arg("-version").output().map(|o| o.status.success()).unwrap_or(false)
}

Try / catch

match image_resize::run(&opts, &progress) {
    Ok(r) => handle(r),
    Err(e) if e.to_string().contains("ffmpeg nao iniciou") => eprintln!("Instale o ffmpeg: {e:#}"),
    Err(e) => eprintln!("falhou: {e:#}"),
}

Prevention

When it happens

Trigger: Calling run() on ImageResizeOptions when ffmpeg is not installed or not on PATH, the configured ffmpeg path is wrong, or std::process::Command::status()/output returns an Err (e.g. permission or OS spawn failure).

Common situations: Fresh CI containers or Docker images without ffmpeg; users who only installed ffmpeg client after app packaging; PATH differences between dev shell and GUI-launched Tauri app.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/image_resize.rs:112

            .arg(inp)
            .args(["-vf", &filter]);
        if ext == "jpg" || ext == "jpeg" {
            cmd.args(["-q:v", &qv.to_string()]);
        } else if ext == "webp" {
            cmd.args(["-quality", &opts.quality.to_string()]);
        }
        cmd.arg(&out);
        match cmd.output().await {
            Ok(o) if o.status.success() => outputs.push(out.to_string_lossy().to_string()),
            Ok(o) => {
                tracing::warn!(
                    "[resize] {}: {}",
                    input,
                    String::from_utf8_lossy(&o.stderr).trim()
                );
                failed.push(input.clone());
            }
            Err(e) => return Err(anyhow!("ffmpeg nao iniciou: {}", e)),
        }
    }
    super::report(&progress, "resize", "done", total, Some(total), None);
    Ok(ResizeResult { outputs, failed })
}

#[cfg(test)]
mod tests {
    use super::scale_filter;

    #[test]
    fn filters() {
        assert_eq!(scale_filter("width", 800, 0), "scale=800:-2");
        assert_eq!(scale_filter("percent", 50, 0), "scale=iw*50/100:ih*50/100");
        assert!(scale_filter("fit", 1920, 1080).contains("force_original_aspect_ratio"));
    }
}

View on GitHub (pinned to 8600b91f42)