tonhowtf/omniget · error · anyhow::Error

o arquivo não tem trilha de áudio

Error message

o arquivo não tem trilha de áudio

What it means

clean_one probes the input with crate::core::ffmpeg::probe and rejects files that contain no audio stream with "o arquivo não tem trilha de áudio". Loudness normalization/denoising is meaningless without audio, so this is an explicit precondition check.

Solutions

  1. Verify the input has an audio track: `ffprobe -v error -select_streams a -show_entries stream=index <file>`
  2. Skip audio-only cleaning for such files or route them to a video workflow
  3. Check the file is fully downloaded/not corrupt if you expected audio
  4. Use the probe result to give the user a clearer UI-level message

Example fix

// before
if !probe.streams.iter().any(|s| s.codec_type == "audio") {
    return Err(anyhow!("o arquivo não tem trilha de áudio"));
}
// after
if !probe.streams.iter().any(|s| s.codec_type == "audio") {
    return Err(anyhow!("{}: no audio stream found (codec types present: {:?}); provide a media file with audio", input,
        probe.streams.iter().map(|s| s.codec_type.as_str()).collect::<Vec<_>>()));
}
Defensive patterns

Strategy: validation

Validate before calling

let probe = crate::core::ffmpeg::probe(Path::new(input)).await?;
if !probe.streams.iter().any(|s| s.codec_type == "audio") {
    // skip or route to a non-audio workflow before calling clean_one
}

Try / catch

match run(&opts, &[input]).await {
    Err(e) if e.to_string().contains("trilha de áudio") => skip_with_warning(input),
    other => other?,
}

Prevention

When it happens

Trigger: run -> clean_one given a file whose ffprobe streams contain no codec_type == "audio": a video-only file, images (mjpeg/png), or a corrupted container.

Common situations: User points the cleaner at a video, subtitle, or image file by mistake; corrupt downloads with missing audio track; container with audio in an unsupported/undetectable format.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

        .arg(input)
        .args(["-af", filter, "-f", "null", "-"])
        .output()
        .await
        .map_err(|e| anyhow!("ffmpeg nao iniciou: {}", e))?;
    let stderr = String::from_utf8_lossy(&out.stderr).to_string();
    parse_measure(&stderr).ok_or_else(|| {
        anyhow!(
            "não consegui medir o loudness: {}",
            stderr.lines().last().unwrap_or("").trim()
        )
    })
}

async fn clean_one(ffmpeg: &Path, opts: &CleanOptions, input: &str) -> anyhow::Result<CleanItem> {
    let inp = Path::new(input);
    let probe = crate::core::ffmpeg::probe(inp).await?;
    if !probe.streams.iter().any(|s| s.codec_type == "audio") {
        return Err(anyhow!("o arquivo não tem trilha de áudio"));
    }
    let has_video = probe
        .streams
        .iter()
        .any(|s| s.codec_type == "video" && s.codec_name != "mjpeg" && s.codec_name != "png");
    let (target_i, target_tp) = target_for(&opts.target);

    let mut chain: Vec<String> = Vec::new();
    let mut measured = None;
    if opts.mode == "denoise" || opts.mode == "both" {
        chain.push(denoise_filter(
            &opts.denoise_mode,
            opts.strength,
            (!opts.rnnn_path.trim().is_empty()).then_some(opts.rnnn_path.trim()),
        ));
    }
    if opts.mode == "loudness" || opts.mode == "both" {
        let m = measure(ffmpeg, inp, &measure_filter(target_i, target_tp)).await?;

View on GitHub (pinned to 8600b91f42)