{"record":{"id":"4c91dc791650dd47","repo":"tonhowtf/omniget","slug":"alvo-pequeno-demais-para-0-s-de-v-deo-aumente-o-tamanho-ou","errorCode":null,"errorMessage":"alvo pequeno demais para {:.0}s de vídeo — aumente o tamanho ou corte o clipe","messagePattern":"alvo pequeno demais para (.+?)s de vídeo — aumente o tamanho ou corte o clipe","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/video_compress.rs","lineNumber":234,"sourceCode":"        .find(|s| s.codec_type == \"audio\")\n        .and_then(|s| s.channels)\n        .unwrap_or(2);\n    let wanted_audio = if opts.audio_kbps > 0 {\n        opts.audio_kbps\n    } else if channels <= 1 {\n        96\n    } else {\n        128\n    };\n    let (video_kbps, audio_kbps) = plan_bitrates(\n        probe.duration_seconds,\n        target_bytes,\n        wanted_audio,\n        has_audio,\n        0.97,\n    )\n    .ok_or_else(|| {\n        anyhow!(\n            \"alvo pequeno demais para {:.0}s de vídeo — aumente o tamanho ou corte o clipe\",\n            probe.duration_seconds\n        )\n    })?;\n\n    let out_dir = if opts.output_dir.trim().is_empty() {\n        inp.parent().map(|p| p.to_path_buf()).unwrap_or_default()\n    } else {\n        PathBuf::from(opts.output_dir.trim())\n    };\n    std::fs::create_dir_all(&out_dir)?;\n    let stem = inp\n        .file_stem()\n        .map(|s| s.to_string_lossy().to_string())\n        .unwrap_or_else(|| \"video\".into());\n    let suffix = if opts.suffix.is_empty() {\n        \"-small\"\n    } else {","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/video_compress.rs#L216-L252","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nCompressOptions { target_mb: 1.0, ..Default::default() } // 300s clip -> fails\n// after\nlet min_mb = (probe.duration_seconds / 60.0).ceil().max(1.0);\nCompressOptions { target_mb: min_mb.max(user_target_mb), ..Default::default() }","handlingStrategy":"validation","validationCode":"// planner floor check before calling compress\nlet target_bytes = (opts.target_mb.max(0.1) * 1024.0 * 1024.0) as u64;\nlet min_mb = (probe.duration_seconds / 60.0).ceil().max(1.0);\nif (target_bytes as f64 / (1024.0 * 1024.0)) < min_mb {\n    return Err(anyhow!(\"alvo {:.1} MB pequeno demais para {:.0}s; use >= {:.0} MB\", opts.target_mb, probe.duration_seconds, min_mb));\n}","typeGuard":"fn target_feasible(target_mb: f64, duration_secs: f64) -> bool {\n    target_mb.max(0.1) * 1024.0 * 1024.0 * 8.0 / duration_secs >= 50_000.0 // >=50 kbps total\n}","tryCatchPattern":"match compress_one(...).await {\n    Err(e) if e.to_string().contains(\"alvo pequeno demais\") => {\n        eprintln!(\"aumente o tamanho alvo ou corte o clipe: {e}\");\n    }\n    r => r,\n}","preventionTips":["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."],"tags":["validation","bitrate-planning","ffmpeg","rust"],"backgroundTag":"invalid-argument-value","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}