tonhowtf/omniget · error

ffmpeg (final) falhou

Error message

ffmpeg (final) falhou: {}

What it means

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.

Solutions

  1. Inspect the stderr embedded in the error — it states whether the problem is an unknown encoder, missing input, or permission on the output path.
  2. Install an ffmpeg build with the required audio encoders (check with ffmpeg -encoders | grep -E 'aac|libmp3lame').
  3. Ensure the output directory for dub_audio exists and is writable.
  4. Re-run the pipeline; if the intermediate mix failed, fix error 372 conditions first so the final encode has valid input.
Defensive patterns

Strategy: try-catch

Validate before calling

// before dubbing, confirm the encoder used by the final step exists
let out = tokio::process::Command::new("ffmpeg")
    .args(["-hide_banner", "-encoders"])
    .output().await?;
let encoders = String::from_utf8_lossy(&out.stdout);
if !(encoders.contains(" aac") || encoders.contains("libmp3lame")) {
    anyhow::bail!("ffmpeg lacks the audio encoder required for the final dub step");
}

Try / catch

match dub(opts).await {
    Err(e) if e.to_string().starts_with("ffmpeg (final) falhou") => {
        log::error!("final encode failed: {e}");
        // verify intermediate mix file with ffprobe before retrying
    }
    other => other?,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/f5262d0c91f308b4. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/dub.rs:208

        }
        filter.push_str(&format!(
            "amix=inputs={}:dropout_transition=0:normalize=0[out]",
            group_files.len()
        ));
        cmd.args([
            "-filter_complex",
            &filter,
            "-map",
            "[out]",
            "-c:a",
            "aac",
            "-b:a",
            "160k",
        ])
        .arg(&dub_audio);
        let output = cmd.output().await?;
        if !output.status.success() {
            return Err(anyhow!(
                "ffmpeg (final) falhou: {}",
                String::from_utf8_lossy(&output.stderr).trim()
            ));
        }
    }

    // 4) opcional: troca o áudio do vídeo
    let mut video_out = None;
    if !opts.video_path.trim().is_empty() {
        super::report(&progress, id, "mux", 0, Some(1), None);
        let video = Path::new(opts.video_path.trim());
        let ext = video
            .extension()
            .map(|e| e.to_string_lossy().to_string())
            .unwrap_or_else(|| "mp4".into());
        let out = out_dir.join(format!("{}.dub.{}", stem, ext));
        let mut cmd = crate::core::process::command(&ffmpeg);
        cmd.args(["-y", "-hide_banner", "-loglevel", "error", "-i"])

View on GitHub (pinned to 8600b91f42)