{"record":{"id":"f5262d0c91f308b4","repo":"tonhowtf/omniget","slug":"ffmpeg-final-falhou","errorCode":null,"errorMessage":"ffmpeg (final) falhou: {}","messagePattern":"ffmpeg \\(final\\) falhou: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/dub.rs","lineNumber":208,"sourceCode":"        }\n        filter.push_str(&format!(\n            \"amix=inputs={}:dropout_transition=0:normalize=0[out]\",\n            group_files.len()\n        ));\n        cmd.args([\n            \"-filter_complex\",\n            &filter,\n            \"-map\",\n            \"[out]\",\n            \"-c:a\",\n            \"aac\",\n            \"-b:a\",\n            \"160k\",\n        ])\n        .arg(&dub_audio);\n        let output = cmd.output().await?;\n        if !output.status.success() {\n            return Err(anyhow!(\n                \"ffmpeg (final) falhou: {}\",\n                String::from_utf8_lossy(&output.stderr).trim()\n            ));\n        }\n    }\n\n    // 4) opcional: troca o áudio do vídeo\n    let mut video_out = None;\n    if !opts.video_path.trim().is_empty() {\n        super::report(&progress, id, \"mux\", 0, Some(1), None);\n        let video = Path::new(opts.video_path.trim());\n        let ext = video\n            .extension()\n            .map(|e| e.to_string_lossy().to_string())\n            .unwrap_or_else(|| \"mp4\".into());\n        let out = out_dir.join(format!(\"{}.dub.{}\", stem, ext));\n        let mut cmd = crate::core::process::command(&ffmpeg);\n        cmd.args([\"-y\", \"-hide_banner\", \"-loglevel\", \"error\", \"-i\"])","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/dub.rs#L190-L226","documentation":"The final dub step encodes the dubbed audio to the target codec/bitrate (args end with -b:a 160k) via ffmpeg. When that ffmpeg invocation exits non-zero, dub() raises 'ffmpeg (final) falhou: <stderr>' embedding the encoder's stderr. It indicates the mixed audio could not be encoded to the final dubbed audio file.","triggerScenarios":"Calling dub where the final ffmpeg encode exits non-zero: the intermediate mixed WAV is missing or corrupt, the output dub_audio path is not writable, the chosen encoder (e.g. libmp3lame/aac) is absent from the ffmpeg build, or the bitrate/codec flags are rejected by the installed ffmpeg version.","commonSituations":"Minimal/libavcodec-only ffmpeg builds without libmp3lame; output directory permissions or read-only filesystem; corrupted intermediate WAV from a partially failed mix; ffmpeg too old for the flag syntax used.","solutions":["Inspect the stderr embedded in the error — it states whether the problem is an unknown encoder, missing input, or permission on the output path.","Install an ffmpeg build with the required audio encoders (check with ffmpeg -encoders | grep -E 'aac|libmp3lame').","Ensure the output directory for dub_audio exists and is writable.","Re-run the pipeline; if the intermediate mix failed, fix error 372 conditions first so the final encode has valid input."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before dubbing, confirm the encoder used by the final step exists\nlet out = tokio::process::Command::new(\"ffmpeg\")\n    .args([\"-hide_banner\", \"-encoders\"])\n    .output().await?;\nlet encoders = String::from_utf8_lossy(&out.stdout);\nif !(encoders.contains(\" aac\") || encoders.contains(\"libmp3lame\")) {\n    anyhow::bail!(\"ffmpeg lacks the audio encoder required for the final dub step\");\n}","typeGuard":null,"tryCatchPattern":"match dub(opts).await {\n    Err(e) if e.to_string().starts_with(\"ffmpeg (final) falhou\") => {\n        log::error!(\"final encode failed: {e}\");\n        // verify intermediate mix file with ffprobe before retrying\n    }\n    other => other?,\n}","preventionTips":["Install a full-featured ffmpeg build with common audio encoders (aac, libmp3lame).","Ensure the output directory for the dubbed audio exists and is writable.","Only run the final step after the mix step produced a valid, non-empty intermediate file.","Pin/verify ffmpeg version in deployment; old builds may reject flag syntax or encoders."],"tags":["ffmpeg","external-process","audio-encoding","dub"],"backgroundTag":"command-not-found","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"}