tonhowtf/omniget · error · anyhow::Error

ffmpeg nao iniciou

Error message

ffmpeg nao iniciou: {}

What it means

subtitle::burn spawns ffmpeg to hard-burn subtitles into the video; if the spawn itself fails (the process never started — io error from .output()), it maps the io::Error into "ffmpeg nao iniciou: {}" (ffmpeg didn't start). This is distinct from a non-zero exit: ffmpeg never ran at all.

Solutions

  1. Verify ffmpeg is installed and executable (ffmpeg -version) and on PATH
  2. Check the video/subtitle/output paths for invalid characters or excessive length
  3. Confirm ensure_ffmpeg resolved the same binary that gets spawned
  4. Check OS error appended in the message (e.g. No such file, Permission denied) for the exact cause

Example fix

// before
let out = Command::new("ffmpeg").args(...).output().await;
// after
match which::which("ffmpeg") { Ok(p) => ..., Err(_) => anyhow::bail!("ffmpeg not found on PATH"), }
let out = Command::new(p).args(...).output().await;
Defensive patterns

Strategy: try-catch

Validate before calling

let ffmpeg_ok = tokio::process::Command::new("ffmpeg").arg("-version").output().await.map(|o| o.status.success()).unwrap_or(false);
if !ffmpeg_ok { return Err("ffmpeg not installed or not executable"); }

Try / catch

match burn(opts, progress).await {
    Err(e) if e.to_string().starts_with("ffmpeg nao iniciou") => {
        // spawn failed: check PATH / permissions; do not retry blindly
        tracing::error!("ffmpeg spawn failed: {e}");
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling burn when ffmpeg binary cannot be spawned: binary not found on PATH, no execute permission, invalid UTF-8 in args (on Windows), or OS-level resource limits (E2BIG from a huge subtitles filter path/escaping).

Common situations: ffmpeg missing from PATH in production/container while present locally; ensure_ffmpeg passed but binary removed since; extremely long Windows paths or special characters in the subtitle path breaking argument passing.

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/703bb69225dfe26a. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/subtitle.rs:525

        .args(["-y", "-hide_banner", "-loglevel", "error", "-i"])
        .arg(video)
        .args(["-vf", &filter])
        .args([
            "-c:v",
            "libx264",
            "-preset",
            "veryfast",
            "-crf",
            "20",
            "-c:a",
            "copy",
            "-movflags",
            "+faststart",
        ])
        .arg(&output)
        .output()
        .await
        .map_err(|e| anyhow!("ffmpeg nao iniciou: {}", e))?;
    if !out.status.success() {
        return Err(anyhow!("{}", String::from_utf8_lossy(&out.stderr).trim()));
    }
    super::report(&progress, "subtitle", "done", 1, Some(1), None);
    Ok(output.to_string_lossy().to_string())
}

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

    const SRT: &str = "1\n00:00:01,000 --> 00:00:03,500\nPrimeira fala\n\n2\n00:00:05,000 --> 00:00:06,000\nSegunda\nem duas linhas\n\n";

    #[test]
    fn reads_srt_with_multiline_text() {
        let cues = parse(SRT).unwrap();
        assert_eq!(cues.len(), 2);
        assert_eq!(cues[0].start_ms, 1000);

View on GitHub (pinned to 8600b91f42)