{"record":{"id":"ffc9ae4cf5f4016e","repo":"tonhowtf/omniget","slug":"ffmpeg-nao-iniciou-video-compress","errorCode":null,"errorMessage":"ffmpeg nao iniciou: {}","messagePattern":"ffmpeg nao iniciou: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src-tauri/omniget-core/src/core/tools/video_compress.rs","lineNumber":181,"sourceCode":"    ffmpeg: &Path,\n    input: &Path,\n    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    }","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/video_compress.rs#L163-L199","documentation":"run_pass fails to spawn the ffmpeg binary for a compression pass; cmd.output() returned an Err (typically io::Error kind NotFound or PermissionDenied) and it is wrapped in the message 'ffmpeg nao iniciou: {}'. The library never found or could not execute the configured ffmpeg path.","triggerScenarios":"Calling video compression (compress_one -> run_pass) when the ffmpeg path does not exist, is not executable, is missing from PATH, or the -passlogfile path's parent directory is unwritable (before spawn the log dir may not exist on some platforms).","commonSituations":"ffmpeg not installed or not bundled with the Tauri app; PATH differs between dev shell and packaged app; user configured a wrong ffmpeg path in settings; ffmpeg binary lacks +x permission; antivirus quarantined the binary.","solutions":["Verify the ffmpeg binary exists and is executable at the configured path (run `<ffmpeg-path> -version`); install ffmpeg or bundle it with the app.","Check the resolved ffmpeg path/PATH used by crate::core::process::command; pass an absolute path instead of relying on PATH.","Ensure the passlogfile directory exists and is writable, and that no antivirus/permissions block spawning the process."],"exampleFix":"// before\nlet ffmpeg = Path::new(\"ffmpeg\");\n// after\nlet ffmpeg = which::which(\"ffmpeg\")\n    .or_else(|_| {\n        let p = PathBuf::from(env!(\"CARGO_MANIFEST_DIR\")).join(\"bin/ffmpeg\");\n        assert!(p.exists(), \"ffmpeg not found at {}\", p.display());\n        Ok(p)\n    })?;","handlingStrategy":"validation","validationCode":"fn ensure_ffmpeg(path: &Path) -> anyhow::Result<()> {\n    let st = std::fs::metadata(path).map_err(|_| anyhow!(\"ffmpeg nao encontrado: {}\", path.display()))?;\n    anyhow::ensure!(!st.is_dir(), \"caminho do ffmpeg é um diretório\");\n    #[cfg(unix)]\n    anyhow::ensure!(std::os::unix::fs::PermissionsExt::mode(&st.permissions()) & 0o111 != 0, \"ffmpeg sem permissão de execução\");\n    Ok(())\n}","typeGuard":"fn ffmpeg_ready(p: &Path) -> bool { p.exists() && p.is_file() }","tryCatchPattern":"match run_pass(...).await {\n    Err(e) if e.to_string().contains(\"nao iniciou\") => eprintln!(\"verifique instalação do ffmpeg: {e}\"),\n    Err(e) => return Err(e),\n    Ok(v) => Ok(v),\n}","preventionTips":["Bundle ffmpeg as a Tauri sidecar and resolve its absolute path at startup.","Run an `ffmpeg -version` health check during app initialization.","Never rely on PATH in packaged apps; ship an absolute path."],"tags":["ffmpeg","process-spawn","io","rust"],"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"}