tonhowtf/omniget · error
não consegui medir a duração do vídeo
Error message
não consegui medir a duração do vídeo
What it means
ffmpeg's probe of the input succeeded (or at least ran) but reported a duration of zero or negative, so the tool cannot compute chapter timestamps. This guards against dividing/mapping chapter marks onto an unknown timeline.
Solutions
- Verify the file plays in a media player and reports a duration
- Re-download or re-mux the file (e.g. `ffmpeg -i in -c copy out`) to restore duration metadata
- Update ffmpeg/ffprobe to a version that parses the container
- Check that ffprobe (not only ffmpeg) is available, since probe depends on it
Example fix
// before
run(opts, progress).await?;
// after
let probe = crate::core::ffmpeg::probe(Path::new(&opts.input)).await?;
if probe.duration_seconds <= 0.0 {
anyhow::bail!("input has no measurable duration; re-encode or re-download");
}
run(opts, progress).await?; Defensive patterns
Strategy: validation
Validate before calling
let probe = crate::core::ffmpeg::probe(&input).await?;
if probe.duration_seconds <= 0.0 { anyhow::bail!("vídeo sem duração utilizável"); } Try / catch
match run(opts, progress).await {
Err(e) if e.to_string().contains("não consegui medir a duração") => {
eprintln!("reencode/rebaixe o arquivo; ffprobe não lê a duração");
}
other => other?,
} Prevention
- Verify files play and report duration before processing
- Keep ffprobe installed alongside ffmpeg
- Re-mux truncated downloads
When it happens
Trigger: `crate::core::ffmpeg::probe(&input)` returns a probe whose `duration_seconds <= 0.0` — corrupt file, unsupported container, or a probe output missing the duration field.
Common situations: Truncated or zero-byte video file; exotic container ffmpeg can't parse; stream without duration metadata (live recording, raw stream); broken ffmpeg/ffprobe install.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- a janela de corte ficou vazia — o vídeo tem
- alvo pequeno demais para
- {}
- concat falhou
- Failed to run ffmpeg
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/d3b58ada676f95fb.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/yt_chapters.rs:444
"-",
])
.output()
.await
.map_err(|e| anyhow!("o ffmpeg não iniciou: {}", e))?;
Ok(parse_scene_times(&String::from_utf8_lossy(&out.stderr)))
}
pub async fn run(opts: Options, progress: super::ProgressFn) -> anyhow::Result<ChaptersResult> {
let input = PathBuf::from(opts.input.trim());
if !input.exists() {
return Err(anyhow!("arquivo não encontrado: {}", opts.input));
}
let ffmpeg = crate::core::dependencies::ensure_ffmpeg().await?;
super::report(&progress, ID, "progress", 0, Some(3), None);
let probe = crate::core::ffmpeg::probe(&input).await?;
let total = probe.duration_seconds;
if total <= 0.0 {
return Err(anyhow!("não consegui medir a duração do vídeo"));
}
let mut cues: Vec<Cue> = Vec::new();
if !opts.subtitle_path.trim().is_empty() {
if let Ok(text) = std::fs::read_to_string(opts.subtitle_path.trim()) {
cues = super::subtitle::parse(&text).unwrap_or_default();
cues = super::yt_notes::dedup_cues(&cues);
}
}
let titled = !cues.is_empty();
let silences = if opts.use_silence {
super::report(&progress, ID, "progress", 1, Some(3), None);
detect_silence(&ffmpeg, &input, opts.silence_db, opts.min_silence, total).await?
} else {
Vec::new()
};
let scenes = if opts.use_scene && probe.streams.iter().any(|s| s.codec_type == "video") {View on GitHub (pinned to 8600b91f42)