{"record":{"id":"b23528010db6b4fa","repo":"tonhowtf/omniget","slug":"0-mb-n-o-cabem-0-s-de-v-deo-aumente-o-alvo-ou-encurte-o","errorCode":null,"errorMessage":"{:.0} MB não cabem {:.0}s de vídeo — aumente o alvo ou encurte o clipe","messagePattern":"(.+?) MB não cabem (.+?)s de vídeo — aumente o alvo ou encurte o clipe","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/src/platforms/bilibili/danmaku/burn.rs","lineNumber":152,"sourceCode":"        .map(|s| s.to_string_lossy().to_string())\n        .unwrap_or_else(|| \"clipe\".into());\n    let suffix = if opts.suffix.trim().is_empty() {\n        \"-danmaku\"\n    } else {\n        opts.suffix.trim()\n    };\n    let output = out_dir.join(format!(\"{}{}.mp4\", stem, suffix));\n\n    let filters = filter_chain(&work, opts.fonts_dir.trim(), opts.max_height);\n    let cut = cut_args(start, window);\n    let audio = audio_args(has_audio, 0);\n\n    let result = if opts.target_mb > 0.0 {\n        let target_bytes = (opts.target_mb * 1024.0 * 1024.0) as u64;\n        let (video_kbps, audio_kbps) =\n            video_compress::plan_bitrates(window, target_bytes, 128, has_audio, 0.97).ok_or_else(\n                || {\n                    anyhow!(\n                        \"{:.0} MB não cabem {:.0}s de vídeo — aumente o alvo ou encurte o clipe\",\n                        opts.target_mb,\n                        window\n                    )\n                },\n            )?;\n        let log_dir = work_dir.join(format!(\"danmaku-2pass-{}\", uuid::Uuid::new_v4()));\n        std::fs::create_dir_all(&log_dir)?;\n        let log = log_dir.join(\"pass\");\n        let common = bitrate_args(video_kbps, &opts.preset);\n\n        report(\n            progress,\n            ID,\n            \"progress\",\n            1,\n            Some(3),\n            Some(\"passagem 1 de 2\".into()),","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/platforms/bilibili/danmaku/burn.rs#L134-L170","documentation":"When opts.target_mb > 0, run() asks video_compress::plan_bitrates to fit the window into the target size (audio floor 128 kbps, 0.97 overhead factor). If no bitrate plan is mathematically possible, it throws '<X> MB não cabem <Y>s de vídeo — aumente o alvo ou encurte o clipe'.","triggerScenarios":"target_mb * 8 Mbit is smaller than window * 128 kbps of mandatory audio (plus overhead), i.e. target size too small for the clip length — e.g. 1 MB for a 60s clip needs at least ~0.96 MB of audio alone.","commonSituations":"User sets an aggressive size target (WhatsApp/Discord limits) for a long clip; forgetting the 128 kbps audio floor makes the plan infeasible regardless of video bitrate.","solutions":["Increase opts.target_mb so it exceeds window * 128_000 / 8 / 1_048_576 MB (audio floor) plus margin","Reduce the clip duration (window) for the same target","Lower the audio bitrate floor if the caller can accept less audio quality (requires changing the plan_bitrates call)"],"exampleFix":"// before\nlet opts = BurnOptions { target_mb: 2.0, duration: 120.0, ..base }; // infeasible\n// after\nlet window = 120.0;\nlet min_mb = (window * 128_000.0 / 8.0 / (1024.0 * 1024.0)) * 1.15; // audio floor + margin\nlet opts = BurnOptions { target_mb: opts.target_mb.max(min_mb), duration: window, ..base };","handlingStrategy":"validation","validationCode":"fn target_feasible(target_mb: f64, window_secs: f64) -> bool {\n    let audio_floor_mb = window_secs * 128_000.0 / 8.0 / (1024.0 * 1024.0);\n    target_mb <= 0.0 || target_mb > audio_floor_mb * 1.1\n}","typeGuard":null,"tryCatchPattern":"match burn::run(&opts, &progress).await {\n    Err(e) if e.to_string().contains(\"não cabem\") => raise_target_or_shorten_clip(&opts),\n    Err(e) => propagate(e)?,\n    Ok(res) => use_result(res),\n}","preventionTips":["Compute the minimum feasible size (audio floor + margin) before setting target_mb","Limit clip duration when users set small size targets","Surface the feasibility math in the UI so users pick realistic targets"],"tags":["bitrate","validation","ffmpeg","size-limit"],"backgroundTag":"value-out-of-range","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"}