{"record":{"id":"3a4621e6c873d79e","repo":"tonhowtf/omniget","slug":"ffmpeg-mux-falhou","errorCode":null,"errorMessage":"ffmpeg (mux) falhou: {}","messagePattern":"ffmpeg \\(mux\\) falhou: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/dub.rs","lineNumber":243,"sourceCode":"        let mut cmd = crate::core::process::command(&ffmpeg);\n        cmd.args([\"-y\", \"-hide_banner\", \"-loglevel\", \"error\", \"-i\"])\n            .arg(video)\n            .arg(\"-i\")\n            .arg(&dub_audio);\n        if opts.keep_original_volume > 0.0 {\n            let f = format!(\n                \"[0:a]volume={:.2}[o];[1:a]volume=1.0[d];[o][d]amix=inputs=2:dropout_transition=0:normalize=0[a]\",\n                opts.keep_original_volume.min(1.0)\n            );\n            cmd.args([\"-filter_complex\", &f, \"-map\", \"0:v\", \"-map\", \"[a]\"]);\n        } else {\n            cmd.args([\"-map\", \"0:v\", \"-map\", \"1:a\"]);\n        }\n        cmd.args([\"-c:v\", \"copy\", \"-c:a\", \"aac\", \"-shortest\"])\n            .arg(&out);\n        let output = cmd.output().await?;\n        if !output.status.success() {\n            return Err(anyhow!(\n                \"ffmpeg (mux) falhou: {}\",\n                String::from_utf8_lossy(&output.stderr).trim()\n            ));\n        }\n        video_out = Some(out.to_string_lossy().to_string());\n    }\n    let _ = std::fs::remove_dir_all(&work);\n    super::report(&progress, id, \"done\", 1, Some(1), None);\n    Ok(DubResult {\n        audio_path: dub_audio.to_string_lossy().to_string(),\n        video_path: video_out,\n        cues: cues.len(),\n        sped_up,\n    })\n}\n\n#[cfg(test)]\nmod tests {","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/dub.rs#L225-L261","documentation":"The last dub step muxes the original video stream (stream-copied) with the dubbed audio (re-encoded to aac) using ffmpeg with -map 0:v -map 1:a -shortest. If ffmpeg exits non-zero, dub() raises 'ffmpeg (mux) falhou: <stderr>'. It is thrown when video+audio cannot be combined into the final output file.","triggerScenarios":"Calling dub where the mux invocation exits non-zero: the video input and dubbed audio are missing/unreadable, stream durations/parameters are irreconcilable, the output container (e.g. mp4) rejects the audio codec, or the output path is unwritable.","commonSituations":"Dubbed audio produced by a failed/aborted earlier step; output filename with an extension not matching the container; disk full during the final write; ffmpeg build lacking the native AAC encoder; source video with codecs -c:v copy cannot place into the chosen container.","solutions":["Read the stderr embedded in the error message — it identifies the exact mux failure (input missing, codec/container mismatch, permission).","Verify both inputs exist and are valid: the source video and the dubbed audio from the previous (final) step.","Make sure the output file extension matches an ffmpeg-supported container and the directory is writable, and check free disk space.","Confirm the installed ffmpeg has the AAC encoder (ffmpeg -encoders | grep aac); upgrade ffmpeg if it is missing or the video codec cannot be copied into the target container (e.g. use mkv for unusual video codecs)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// guard before muxing: both inputs must exist\nif !video_path.as_ref().exists() {\n    anyhow::bail!(\"source video missing: {}\", video_path.as_ref().display());\n}\nif !dub_audio.exists() {\n    anyhow::bail!(\"dubbed audio missing: {}\", dub_audio.display());\n}","typeGuard":null,"tryCatchPattern":"match dub(opts).await {\n    Err(e) if e.to_string().starts_with(\"ffmpeg (mux) falhou\") => {\n        log::error!(\"mux failed: {e}\");\n        // suggest an .mkv output when -c:v copy fails for the container\n    }\n    other => other?,\n}","preventionTips":["Confirm the previous (final encode) step succeeded and dub_audio is a valid media file (ffprobe) before muxing.","Match the output extension to the container and the video codec being stream-copied; prefer .mkv for exotic codecs.","Check free disk space for the final output before starting the pipeline.","Keep a recent full ffmpeg build with the native AAC encoder available."],"tags":["ffmpeg","external-process","muxing","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"}