tonhowtf/omniget · error · anyhow::Error

{}

Error message

{}

What it means

When the final ffmpeg pass spawns but exits with a non-zero status, clean_one surfaces ffmpeg's trimmed stderr verbatim via anyhow!("{}"). The message content is whatever ffmpeg printed — codec errors, bad filter graphs, unwritable output path, etc.

Solutions

  1. Read the embedded stderr in the error to see ffmpeg's actual complaint
  2. Confirm the ffmpeg build includes the required encoders (`ffmpeg -encoders | grep aac`)
  3. Check the output path is writable and the extension matches the chosen codec
  4. Test the filter chain manually: `ffmpeg -i in -af <filter> -c:a aac -b:a 192k out.m4a`

Example fix

// before
if !out.status.success() {
    return Err(anyhow!("{}", String::from_utf8_lossy(&out.stderr).trim()));
}
// after
if !out.status.success() {
    let stderr = String::from_utf8_lossy(&out.stderr).trim().to_string();
    anyhow::bail!("ffmpeg conversion failed for '{}' -> '{}' (exit {}): {}",
        input, output.display(), out.status, stderr);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check output writability and encoder availability
anyhow::ensure!(
    out_dir_writable(&output_dir)?,
    "output directory not writable: {}",
    output_dir.display()
);

Try / catch

if let Err(e) = clean_one(&ffmpeg, &opts, &input).await {
    let msg = e.to_string();
    if msg.contains("Unknown encoder") { /* install ffmpeg with aac */ }
    else if msg.contains("Permission denied") { /* fix output path perms */ }
    // always log the ffmpeg stderr embedded in msg
    return Err(e);
}

Prevention

When it happens

Trigger: run -> clean_one where the ffmpeg encode command exits non-zero: invalid filter combination, unsupported output codec/container, output file not writable, input decode errors, or disk full.

Common situations: aac encoder unavailable in the ffmpeg build; output directory without write permission; filename/container mismatch (e.g. .mp3 extension with aac codec); filter chain producing invalid audio parameters.

Related errors


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

Appendix: source

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

    if has_video {
        // O vídeo não é tocado: só a trilha de áudio é reescrita.
        cmd.args(["-c:v", "copy", "-map", "0"]);
    } else {
        cmd.args(["-vn"]);
    }
    match ext.as_str() {
        "wav" => cmd.args(["-c:a", "pcm_s16le"]),
        "flac" => cmd.args(["-c:a", "flac"]),
        "mp3" => cmd.args(["-c:a", "libmp3lame", "-b:a", "192k"]),
        _ => cmd.args(["-c:a", "aac", "-b:a", "192k"]),
    };
    let out = cmd
        .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()));
    }

    Ok(CleanItem {
        input: input.to_string(),
        output: Some(output.to_string_lossy().to_string()),
        gain_db: measured.map(|m| target_i - m.input_i).unwrap_or(0.0),
        measured,
        target_i,
        filter,
        ok: true,
        error: None,
    })
}

pub async fn run(opts: CleanOptions, progress: super::ProgressFn) -> anyhow::Result<CleanResult> {
    let ffmpeg = crate::core::dependencies::ensure_ffmpeg().await?;
    let total = opts.inputs.len() as u64;
    let mut items = Vec::new();

View on GitHub (pinned to 8600b91f42)