tonhowtf/omniget · error
alvo pequeno demais para
Error message
alvo pequeno demais para {:.0}s de vídeo — aumente o tamanho ou corte o clipe What it means
compress_one computes a bitrate plan with plan_bitrates and throws when it returns None: the requested target size in MB is too small to fit the video at a sane minimum bitrate for its duration. The library refuses to produce a uselessly low-bitrate encode.
Solutions
- Increase the target size (opts.target_mb) to roughly duration_seconds / 60 MB or more (≈ video_kbps ≈ target_bits / duration).
- Shorten the clip (trim) so the target size fits the duration.
- Set opts.audio_kbps to a small value (or 0 to fall back to 96) to free bits for video, if appropriate.
Example fix
// before
CompressOptions { target_mb: 1.0, ..Default::default() } // 300s clip -> fails
// after
let min_mb = (probe.duration_seconds / 60.0).ceil().max(1.0);
CompressOptions { target_mb: min_mb.max(user_target_mb), ..Default::default() } Defensive patterns
Strategy: validation
Validate before calling
// planner floor check before calling compress
let target_bytes = (opts.target_mb.max(0.1) * 1024.0 * 1024.0) as u64;
let min_mb = (probe.duration_seconds / 60.0).ceil().max(1.0);
if (target_bytes as f64 / (1024.0 * 1024.0)) < min_mb {
return Err(anyhow!("alvo {:.1} MB pequeno demais para {:.0}s; use >= {:.0} MB", opts.target_mb, probe.duration_seconds, min_mb));
} Type guard
fn target_feasible(target_mb: f64, duration_secs: f64) -> bool {
target_mb.max(0.1) * 1024.0 * 1024.0 * 8.0 / duration_secs >= 50_000.0 // >=50 kbps total
} Try / catch
match compress_one(...).await {
Err(e) if e.to_string().contains("alvo pequeno demais") => {
eprintln!("aumente o tamanho alvo ou corte o clipe: {e}");
}
r => r,
} Prevention
- Clamp target_mb against probed duration in the UI before submitting.
- Show a minimum-size hint computed from clip length.
- Test presets with the shortest clip you plan to support.
When it happens
Trigger: Calling compression with a target_mb so low that (target_bytes * 0.97 minus audio bitrate budget) / duration falls below the planner's floor — e.g. a 5-minute video targeting 1 MB, or a 2-hour video targeting a few MB.
Common situations: User picks an aggressive size in the UI (e.g. 'compress to 1 MB'); very long recordings with tiny size targets; misconfigured presets where target_mb was left at a minimum value; audio overhead leaving no budget for video.
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
- o arquivo não tem trilha de áudio
- o arquivo nao tem faixa de video
- o arquivo não tem trilha de áudio
- escolha a pasta de destino para organizar
- informe um appid, um link da loja ou marque a biblioteca…
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/4c91dc791650dd47.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/video_compress.rs:234
.find(|s| s.codec_type == "audio")
.and_then(|s| s.channels)
.unwrap_or(2);
let wanted_audio = if opts.audio_kbps > 0 {
opts.audio_kbps
} else if channels <= 1 {
96
} else {
128
};
let (video_kbps, audio_kbps) = plan_bitrates(
probe.duration_seconds,
target_bytes,
wanted_audio,
has_audio,
0.97,
)
.ok_or_else(|| {
anyhow!(
"alvo pequeno demais para {:.0}s de vídeo — aumente o tamanho ou corte o clipe",
probe.duration_seconds
)
})?;
let out_dir = if opts.output_dir.trim().is_empty() {
inp.parent().map(|p| p.to_path_buf()).unwrap_or_default()
} else {
PathBuf::from(opts.output_dir.trim())
};
std::fs::create_dir_all(&out_dir)?;
let stem = inp
.file_stem()
.map(|s| s.to_string_lossy().to_string())
.unwrap_or_else(|| "video".into());
let suffix = if opts.suffix.is_empty() {
"-small"
} else {View on GitHub (pinned to 8600b91f42)