tonhowtf/omniget · error

ffmpeg passagem

Error message

ffmpeg passagem {}: {}

What it means

run_pass spawned ffmpeg successfully but the process exited with a non-zero status during compression pass N; the error surfaces ffmpeg's trimmed stderr. This means the encode itself failed, not the spawn.

Solutions

  1. Read the stderr text embedded in the error message — it contains ffmpeg's actual failure reason (e.g. 'Unknown encoder', 'Invalid data').
  2. Verify the input file decodes: run `ffprobe <input>`; re-download or repair the source if corrupt.
  3. Confirm the ffmpeg build supports the required encoders: run `<ffmpeg> -encoders | grep -E 'libx264|libx265'` and install a full build.
  4. Check disk space and write permissions for the output directory and passlogfile location.

Example fix

// before
let out = cmd.output().await?;
if !out.status.success() { return Err(anyhow!("ffmpeg passagem {}: {}", pass, ...)); }
// after
let out = cmd.output().await?;
if !out.status.success() {
    let stderr = String::from_utf8_lossy(&out.stderr).trim().to_string();
    if stderr.contains("Unknown encoder") {
        return Err(anyhow!("ffmpeg build missing required encoder; reinstall ffmpeg with libx264"));
    }
    return Err(anyhow!("ffmpeg passagem {}: {}", pass, stderr));
}
Defensive patterns

Strategy: try-catch

Validate before calling

let meta = std::fs::metadata(input).map_err(|_| anyhow!("entrada inacessível"))?;
anyhow::ensure!(meta.len() > 0, "arquivo de entrada vazio");

Try / catch

match compress_one(...).await {
    Err(e) if e.to_string().contains("ffmpeg passagem") => {
        log::error!("encode falhou: {e}");
        // surface stderr detail to user / retry with safe preset
    }
    r => r,
}

Prevention

When it happens

Trigger: Any ffmpeg invocation inside run_pass returning non-zero: unsupported codec/pixel format for the chosen encoder, unreadable/corrupt input file, invalid encoder options, or a full/unwritable output location.

Common situations: Corrupt or zero-byte input video; ffmpeg build lacking the requested encoder (e.g. libx264/libx265 not compiled in); incompatible filter/argument combination; output path on a full disk; DRM-protected or truncated download.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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

Appendix: source

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

    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)