tonhowtf/omniget · error
não consegui medir a duração
Error message
não consegui medir a duração
What it means
cut_one probes the input with ffprobe and requires a positive duration before doing silence detection. When probe.duration_seconds is <= 0 (missing, unparseable, or zero), it throws 'não consegui medir a duração' (could not measure the duration). Without a reliable duration, keep-range math for silence cutting cannot work.
Solutions
- Verify the input file plays in a standard player and probe it manually with ffprobe to inspect duration.
- Remux/repair the file (e.g. ffmpeg -i in.mp4 -c copy fixed.mp4) to regenerate container metadata.
- Only pass complete, finalized media files to the silence-cut API.
- Check that the path/URL is correct and fully accessible.
Example fix
// before
run(&opts, "partial-download.mp4").await?;
// after
ffmpeg_repair("partial-download.mp4", "fixed.mp4").await?;
run(&opts, "fixed.mp4").await?; Defensive patterns
Strategy: validation
Validate before calling
// Rust let probe = ffmpeg_probe(path).await?; anyhow::ensure!(probe.duration_seconds > 0.0, "arquivo sem duracao valida");
Type guard
fn has_duration(p: &Probe) -> bool { p.duration_seconds > 0.0 } Try / catch
match cut_one(&ffmpeg, &opts, input).await {
Err(e) if e.to_string().contains("nao consegui medir") => {
// remuxar/reparar o arquivo e tentar de novo
}
r => r?,
} Prevention
- Only pass finalized, fully downloaded media files
- Pre-probe every input and fail fast on duration <= 0
- Avoid probing live/stream URLs without duration metadata
- Repair truncated MP4s (remux) before processing
When it happens
Trigger: Calling cut_one/run on a file whose probe reports no usable duration: corrupt/unfinalized files, raw streams without container headers, network URLs that ffprobe cannot fully read, or a container ffprobe cannot parse.
Common situations: Feeding a partially downloaded MP4 (moov atom missing); passing an image or unsupported format; interrupted recording; probing a live/stream URL without duration metadata.
Related errors
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/7511df1e2acb66bf.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/silence_cut.rs:224
threshold_db,
min_silence.max(0.05)
),
"-f",
"null",
"-",
])
.output()
.await
.map_err(|e| anyhow!("ffmpeg nao iniciou: {}", e))?;
Ok(String::from_utf8_lossy(&out.stderr).to_string())
}
async fn cut_one(ffmpeg: &Path, opts: &SilenceOptions, input: &str) -> anyhow::Result<SilenceItem> {
let inp = Path::new(input);
let probe = crate::core::ffmpeg::probe(inp).await?;
let total = probe.duration_seconds;
if total <= 0.0 {
return Err(anyhow!("não consegui medir a duração"));
}
let has_audio = probe.streams.iter().any(|s| s.codec_type == "audio");
if !has_audio {
return Err(anyhow!("o arquivo não tem trilha de áudio"));
}
let stderr = detect(ffmpeg, inp, opts.threshold_db, opts.min_silence).await?;
let spans = parse_spans(&stderr, total);
let (spans, skipped) = cap_spans(spans, MAX_SEGMENTS);
let keeps = keep_ranges(&spans, total, opts.padding.max(0.0));
let kept: f64 = keeps.iter().map(|k| k.duration()).sum();
let mut item = SilenceItem {
input: input.to_string(),
output: None,
duration_before: total,
duration_after: kept,
seconds_removed: (total - kept).max(0.0),View on GitHub (pinned to 8600b91f42)