tonhowtf/omniget · error · anyhow::Error
não consegui medir o loudness
Error message
não consegui medir o loudness: {} What it means
After ffmpeg runs the loudness analysis, measure parses the loudness values from stderr with parse_measure; if parsing yields nothing, it errors with "não consegui medir o loudness: {last stderr line}". This means ffmpeg ran but did not produce the expected loudness report output.
Solutions
- Inspect the stderr tail included in the message to see why ffmpeg produced no measurement
- Ensure the input has a decodable audio stream before measuring (ffprobe check)
- Update parse_measure to match the loudness summary format of the installed ffmpeg version
- Run ffmpeg manually with the same -af filter to reproduce and compare output
Example fix
// before
parse_measure(&stderr).ok_or_else(|| {
anyhow!("não consegui medir o loudness: {}", stderr.lines().last().unwrap_or("").trim())
})
// after
match parse_measure(&stderr) {
Some(m) => Ok(m),
None => {
if stderr.contains("does not contain any stream") || stderr.contains("Stream specifier ':a'") {
anyhow::bail!("input has no audio stream; skipping loudness measurement");
}
anyhow::bail!("não consegui medir o loudness: {}", stderr.lines().last().unwrap_or("").trim())
}
} Defensive patterns
Strategy: validation
Validate before calling
// Ensure the input has a decodable audio stream before measuring
let probe = crate::core::ffmpeg::probe(&input).await?;
anyhow::ensure!(
probe.streams.iter().any(|s| s.codec_type == "audio"),
"no audio stream: loudness measurement impossible"
); Try / catch
let m = measure(&ffmpeg, &input, &filter).await
.map_err(|e| anyhow::anyhow!("loudness measurement failed for {}: {e}", input.display()))?; Prevention
- Pre-probe inputs with ffprobe before running filters
- Test parse_measure against your target ffmpeg version's output
- Always log the stderr tail included in the error
- Handle corrupt/truncated media explicitly before analysis
When it happens
Trigger: measure called with an input ffmpeg cannot decode or that has no audio stream: the ebur128/loudnorm filter prints no measured values, unsupported codec, or ffmpeg aborted before printing the summary line.
Common situations: Input file with no audio track (should be caught earlier but can slip through odd streams); corrupt/truncated media; ffmpeg version whose stderr format differs from what parse_measure expects; locale/encoding issues in stderr.
Related errors
- ffmpeg nao iniciou
- o arquivo não tem trilha de áudio
- {}
- o arquivo não tem trilha de áudio
- não achei appid para
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/e8e75158f862f244.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/audio_clean.rs:166
pub error: Option<String>,
}
#[derive(Debug, Clone, Serialize)]
pub struct CleanResult {
pub items: Vec<CleanItem>,
}
async fn measure(ffmpeg: &Path, input: &Path, filter: &str) -> anyhow::Result<Loudness> {
let out = crate::core::process::command(ffmpeg)
.args(["-hide_banner", "-nostats", "-i"])
.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);
View on GitHub (pinned to 8600b91f42)