tonhowtf/omniget · error

concat falhou

Error message

concat falhou: {}

What it means

save_replay uses ffmpeg's concat demuxer with stream copy (-c copy) to join the chosen segments. If ffmpeg exits with a non-zero status, the trimmed stderr is surfaced as 'concat falhou: {}'. This typically means the concatenated inputs have incompatible codecs/parameters or the segment list is malformed.

Solutions

  1. Read the ffmpeg stderr in the error message to identify the failing stream/segment.
  2. Re-encode instead of stream-copying (drop -c copy and use libx264) when segments have differing parameters.
  3. Ensure all segments were produced with identical encoder settings (resolution, fps, codec).
  4. Verify each segment file is complete and playable before adding it to the concat list.

Example fix

// before
.args(["-c", "copy", "-movflags", "+faststart"])
// after
.args(["-c:v", "libx264", "-preset", "veryfast", "-c:a", "aac", "-movflags", "+faststart"])
Defensive patterns

Strategy: try-catch

Validate before calling

// Rust
fn segments_compatible(segs: &[PathBuf]) -> bool {
    segs.iter().all(|p| p.exists() && p.metadata().map(|m| m.len() > 0).unwrap_or(false))
}

Type guard

null

Try / catch

match save_replay().await {
    Err(e) if e.to_string().contains("concat falhou") => {
        eprintln!("detalhe ffmpeg: {e}");
        // tentar fallback com re-encode
    }
    r => r?,
}

Prevention

When it happens

Trigger: Running the ffmpeg concat command over ring segments whose codecs, resolutions, or timebases differ between segments, or when the concat list file references missing/corrupt segment files.

Common situations: Screen capture settings changed mid-recording; a segment file was truncated by a crash or still being flushed; ffmpeg build lacking a needed demuxer/codec; disk full causing a corrupt segment.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/screen_record.rs:512

    let o = crate::core::process::command(&ffmpeg)
        .args([
            "-y",
            "-hide_banner",
            "-loglevel",
            "error",
            "-f",
            "concat",
            "-safe",
            "0",
            "-i",
        ])
        .arg(&list)
        .args(["-c", "copy", "-movflags", "+faststart"])
        .arg(&out)
        .output()
        .await?;
    if !o.status.success() {
        return Err(anyhow!(
            "concat falhou: {}",
            String::from_utf8_lossy(&o.stderr).trim()
        ));
    }
    let s = out.to_string_lossy().to_string();
    *LAST_SAVED.lock().unwrap_or_else(|e| e.into_inner()) = Some(s.clone());
    Ok(s)
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn args_shape() {
        let o: RecordOptions =
            serde_json::from_str(r#"{"screen":"","fps":30,"replay_seconds":30}"#).unwrap();
        let a = build_args(&o, Path::new("/tmp/x"), true);

View on GitHub (pinned to 8600b91f42)