tonhowtf/omniget · critical

ffmpeg nao iniciou

Error message

ffmpeg nao iniciou: {}

What it means

run_pass fails to spawn the ffmpeg binary for a compression pass; cmd.output() returned an Err (typically io::Error kind NotFound or PermissionDenied) and it is wrapped in the message 'ffmpeg nao iniciou: {}'. The library never found or could not execute the configured ffmpeg path.

Solutions

  1. Verify the ffmpeg binary exists and is executable at the configured path (run `<ffmpeg-path> -version`); install ffmpeg or bundle it with the app.
  2. Check the resolved ffmpeg path/PATH used by crate::core::process::command; pass an absolute path instead of relying on PATH.
  3. Ensure the passlogfile directory exists and is writable, and that no antivirus/permissions block spawning the process.

Example fix

// before
let ffmpeg = Path::new("ffmpeg");
// after
let ffmpeg = which::which("ffmpeg")
    .or_else(|_| {
        let p = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("bin/ffmpeg");
        assert!(p.exists(), "ffmpeg not found at {}", p.display());
        Ok(p)
    })?;
Defensive patterns

Strategy: validation

Validate before calling

fn ensure_ffmpeg(path: &Path) -> anyhow::Result<()> {
    let st = std::fs::metadata(path).map_err(|_| anyhow!("ffmpeg nao encontrado: {}", path.display()))?;
    anyhow::ensure!(!st.is_dir(), "caminho do ffmpeg é um diretório");
    #[cfg(unix)]
    anyhow::ensure!(std::os::unix::fs::PermissionsExt::mode(&st.permissions()) & 0o111 != 0, "ffmpeg sem permissão de execução");
    Ok(())
}

Type guard

fn ffmpeg_ready(p: &Path) -> bool { p.exists() && p.is_file() }

Try / catch

match run_pass(...).await {
    Err(e) if e.to_string().contains("nao iniciou") => eprintln!("verifique instalação do ffmpeg: {e}"),
    Err(e) => return Err(e),
    Ok(v) => Ok(v),
}

Prevention

When it happens

Trigger: Calling video compression (compress_one -> run_pass) when the ffmpeg path does not exist, is not executable, is missing from PATH, or the -passlogfile path's parent directory is unwritable (before spawn the log dir may not exist on some platforms).

Common situations: ffmpeg not installed or not bundled with the Tauri app; PATH differs between dev shell and packaged app; user configured a wrong ffmpeg path in settings; ffmpeg binary lacks +x permission; antivirus quarantined the binary.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/video_compress.rs:181

    ffmpeg: &Path,
    input: &Path,
    args: &[String],
    pass: u8,
    log: &Path,
    tail: &[String],
) -> anyhow::Result<()> {
    let mut cmd = crate::core::process::command(ffmpeg);
    cmd.args(["-y", "-hide_banner", "-loglevel", "error", "-i"])
        .arg(input)
        .args(args)
        .args(["-pass", &pass.to_string()])
        .arg("-passlogfile")
        .arg(log)
        .args(tail);
    let out = cmd
        .output()
        .await
        .map_err(|e| anyhow!("ffmpeg nao iniciou: {}", e))?;
    if !out.status.success() {
        return Err(anyhow!(
            "ffmpeg passagem {}: {}",
            pass,
            String::from_utf8_lossy(&out.stderr).trim()
        ));
    }
    Ok(())
}

fn clean_logs(log: &Path) {
    for suffix in ["-0.log", "-0.log.mbtree", ".log", ".log.mbtree"] {
        let p = PathBuf::from(format!("{}{}", log.display(), suffix));
        let _ = std::fs::remove_file(p);
    }
    if let Some(dir) = log.parent() {
        let _ = std::fs::remove_dir(dir);
    }

View on GitHub (pinned to 8600b91f42)