{"record":{"id":"5d0c46902e1c137b","repo":"tonhowtf/omniget","slug":"concat-falhou","errorCode":null,"errorMessage":"concat falhou: {}","messagePattern":"concat falhou: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/screen_record.rs","lineNumber":512,"sourceCode":"    let o = crate::core::process::command(&ffmpeg)\n        .args([\n            \"-y\",\n            \"-hide_banner\",\n            \"-loglevel\",\n            \"error\",\n            \"-f\",\n            \"concat\",\n            \"-safe\",\n            \"0\",\n            \"-i\",\n        ])\n        .arg(&list)\n        .args([\"-c\", \"copy\", \"-movflags\", \"+faststart\"])\n        .arg(&out)\n        .output()\n        .await?;\n    if !o.status.success() {\n        return Err(anyhow!(\n            \"concat falhou: {}\",\n            String::from_utf8_lossy(&o.stderr).trim()\n        ));\n    }\n    let s = out.to_string_lossy().to_string();\n    *LAST_SAVED.lock().unwrap_or_else(|e| e.into_inner()) = Some(s.clone());\n    Ok(s)\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn args_shape() {\n        let o: RecordOptions =\n            serde_json::from_str(r#\"{\"screen\":\"\",\"fps\":30,\"replay_seconds\":30}\"#).unwrap();\n        let a = build_args(&o, Path::new(\"/tmp/x\"), true);","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/screen_record.rs#L494-L530","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the ffmpeg stderr in the error message to identify the failing stream/segment.","Re-encode instead of stream-copying (drop -c copy and use libx264) when segments have differing parameters.","Ensure all segments were produced with identical encoder settings (resolution, fps, codec).","Verify each segment file is complete and playable before adding it to the concat list."],"exampleFix":"// before\n.args([\"-c\", \"copy\", \"-movflags\", \"+faststart\"])\n// after\n.args([\"-c:v\", \"libx264\", \"-preset\", \"veryfast\", \"-c:a\", \"aac\", \"-movflags\", \"+faststart\"])","handlingStrategy":"try-catch","validationCode":"// Rust\nfn segments_compatible(segs: &[PathBuf]) -> bool {\n    segs.iter().all(|p| p.exists() && p.metadata().map(|m| m.len() > 0).unwrap_or(false))\n}","typeGuard":"null","tryCatchPattern":"match save_replay().await {\n    Err(e) if e.to_string().contains(\"concat falhou\") => {\n        eprintln!(\"detalhe ffmpeg: {e}\");\n        // tentar fallback com re-encode\n    }\n    r => r?,\n}","preventionTips":["Keep encoder settings fixed for the whole recording session","Never mutate capture parameters mid-recording","Check disk space before and during recording","Log ffmpeg stderr for every concat attempt"],"tags":["ffmpeg","concat","video-processing","rust"],"backgroundTag":"command-failed-with-stderr","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}