{"record":{"id":"99d8ce658e5b27d9","repo":"tonhowtf/omniget","slug":"ffmpeg-passagem","errorCode":null,"errorMessage":"ffmpeg passagem {}: {}","messagePattern":"ffmpeg passagem (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/video_compress.rs","lineNumber":183,"sourceCode":"    args: &[String],\n    pass: u8,\n    log: &Path,\n    tail: &[String],\n) -> anyhow::Result<()> {\n    let mut cmd = crate::core::process::command(ffmpeg);\n    cmd.args([\"-y\", \"-hide_banner\", \"-loglevel\", \"error\", \"-i\"])\n        .arg(input)\n        .args(args)\n        .args([\"-pass\", &pass.to_string()])\n        .arg(\"-passlogfile\")\n        .arg(log)\n        .args(tail);\n    let out = cmd\n        .output()\n        .await\n        .map_err(|e| anyhow!(\"ffmpeg nao iniciou: {}\", e))?;\n    if !out.status.success() {\n        return Err(anyhow!(\n            \"ffmpeg passagem {}: {}\",\n            pass,\n            String::from_utf8_lossy(&out.stderr).trim()\n        ));\n    }\n    Ok(())\n}\n\nfn clean_logs(log: &Path) {\n    for suffix in [\"-0.log\", \"-0.log.mbtree\", \".log\", \".log.mbtree\"] {\n        let p = PathBuf::from(format!(\"{}{}\", log.display(), suffix));\n        let _ = std::fs::remove_file(p);\n    }\n    if let Some(dir) = log.parent() {\n        let _ = std::fs::remove_dir(dir);\n    }\n}\n","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/video_compress.rs#L165-L201","documentation":"run_pass spawned ffmpeg successfully but the process exited with a non-zero status during compression pass N; the error surfaces ffmpeg's trimmed stderr. This means the encode itself failed, not the spawn.","triggerScenarios":"Any ffmpeg invocation inside run_pass returning non-zero: unsupported codec/pixel format for the chosen encoder, unreadable/corrupt input file, invalid encoder options, or a full/unwritable output location.","commonSituations":"Corrupt or zero-byte input video; ffmpeg build lacking the requested encoder (e.g. libx264/libx265 not compiled in); incompatible filter/argument combination; output path on a full disk; DRM-protected or truncated download.","solutions":["Read the stderr text embedded in the error message — it contains ffmpeg's actual failure reason (e.g. 'Unknown encoder', 'Invalid data').","Verify the input file decodes: run `ffprobe <input>`; re-download or repair the source if corrupt.","Confirm the ffmpeg build supports the required encoders: run `<ffmpeg> -encoders | grep -E 'libx264|libx265'` and install a full build.","Check disk space and write permissions for the output directory and passlogfile location."],"exampleFix":"// before\nlet out = cmd.output().await?;\nif !out.status.success() { return Err(anyhow!(\"ffmpeg passagem {}: {}\", pass, ...)); }\n// after\nlet out = cmd.output().await?;\nif !out.status.success() {\n    let stderr = String::from_utf8_lossy(&out.stderr).trim().to_string();\n    if stderr.contains(\"Unknown encoder\") {\n        return Err(anyhow!(\"ffmpeg build missing required encoder; reinstall ffmpeg with libx264\"));\n    }\n    return Err(anyhow!(\"ffmpeg passagem {}: {}\", pass, stderr));\n}","handlingStrategy":"try-catch","validationCode":"let meta = std::fs::metadata(input).map_err(|_| anyhow!(\"entrada inacessível\"))?;\nanyhow::ensure!(meta.len() > 0, \"arquivo de entrada vazio\");","typeGuard":null,"tryCatchPattern":"match compress_one(...).await {\n    Err(e) if e.to_string().contains(\"ffmpeg passagem\") => {\n        log::error!(\"encode falhou: {e}\");\n        // surface stderr detail to user / retry with safe preset\n    }\n    r => r,\n}","preventionTips":["Validate input files with ffprobe before encoding.","Pin a full-featured ffmpeg build and check for required encoders at startup.","Check free disk space before long encodes."],"tags":["ffmpeg","nonzero-exit","video-encoding","rust"],"backgroundTag":"http-error-response","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"}