{"record":{"id":"1bafc48cfa6d647f","repo":"tonhowtf/omniget","slug":"ffmpeg-nao-iniciou-video-restore","errorCode":null,"errorMessage":"ffmpeg nao iniciou: {}","messagePattern":"ffmpeg nao iniciou: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/video_restore.rs","lineNumber":174,"sourceCode":"    let output = out_dir.join(format!(\"{}{}.mp4\", stem, suffix));\n\n    let mut trf: Option<PathBuf> = None;\n    if opts.stabilize {\n        let dir = std::env::temp_dir().join(format!(\"omniget-vidstab-{}\", uuid::Uuid::new_v4()));\n        std::fs::create_dir_all(&dir)?;\n        let file = dir.join(\"transforms.trf\");\n        let detect = format!(\n            \"{}:result='{}'\",\n            detect_filter(opts.shakiness),\n            file.to_string_lossy().replace('\\\\', \"/\")\n        );\n        let out = crate::core::process::command(ffmpeg)\n            .args([\"-y\", \"-hide_banner\", \"-loglevel\", \"error\", \"-i\"])\n            .arg(inp)\n            .args([\"-vf\", &detect, \"-an\", \"-f\", \"null\", \"-\"])\n            .output()\n            .await\n            .map_err(|e| anyhow!(\"ffmpeg nao iniciou: {}\", e))?;\n        if !out.status.success() {\n            let _ = std::fs::remove_dir_all(&dir);\n            return Err(anyhow!(\n                \"detecção de tremor: {}\",\n                String::from_utf8_lossy(&out.stderr).trim()\n            ));\n        }\n        trf = Some(file);\n    }\n\n    let mut chain_parts: Vec<String> = Vec::new();\n    if let Some(file) = trf.as_ref() {\n        chain_parts.push(format!(\n            \"vidstabtransform=input='{}':{}\",\n            file.to_string_lossy().replace('\\\\', \"/\"),\n            transform_filter(opts.smoothing).trim_start_matches(\"vidstabtransform=\")\n        ));\n    }","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/video_restore.rs#L156-L192","documentation":"Wraps the io::Error from spawning the ffmpeg process in restore_one's shake-detection pass (video_restore.rs:174). The library throws it when tokio's Command::output() cannot even launch ffmpeg — before any decode work happens. It is a process-spawn failure, not an ffmpeg decoding failure (that path produces the separate 'detecção de tremor' error).","triggerScenarios":"Calling restore_one/run on a video whose first pass runs `ffmpeg -vf <detect> -an -f null -` and the ffmpeg binary cannot be spawned: binary absent from PATH, path misconfigured, or the OS fails exec (permissions, missing interpreter).","commonSituations":"ffmpeg not installed in the deployment container or CI image; PATH stripped in the Tauri GUI environment so a terminal-visible ffmpeg is not found; a broken ffmpeg shim on PATH with a bad shebang; no exec permission after a partial install.","solutions":["Install ffmpeg or ensure the binary is on PATH (verify with `ffmpeg -version` in the same environment the app runs in).","If ffmpeg lives outside PATH, configure the explicit binary path used to build the `ffmpeg` command variable.","Check exec permissions (`chmod +x $(which ffmpeg)`) and reinstall if the binary is corrupted.","Log the wrapped io::Error (`{e}`) — its kind (NotFound/PermissionDenied) tells which of the above applies."],"exampleFix":"// before: relies on PATH\nlet out = crate::core::process::command(ffmpeg).args([\"-y\", ...]).output().await;\n// after: resolve explicitly and fail fast with a clear message\nlet ffmpeg = which::which(\"ffmpeg\").context(\"ffmpeg não encontrado no PATH; instale ffmpeg\")?;\nlet out = crate::core::process::command(ffmpeg).args([\"-y\", ...]).output().await?;","handlingStrategy":"fallback","validationCode":"if which::which(\"ffmpeg\").is_err() {\n    return Err(anyhow!(\"ffmpeg não está no PATH; instale ffmpeg antes de restaurar vídeos\"));\n}","typeGuard":null,"tryCatchPattern":"match restore_one(input).await {\n    Err(e) if e.to_string().contains(\"ffmpeg nao iniciou\") => eprintln!(\"instale/verifique o ffmpeg: {e}\"),\n    Err(e) => return Err(e),\n    Ok(item) => item,\n}","preventionTips":["Bake ffmpeg into deployment images and verify it at app startup, not at first use","Resolve an absolute ffmpeg path once per job instead of trusting PATH per invocation","Run `ffmpeg -version` as a startup health check in GUI/container environments where PATH differs"],"tags":["ffmpeg","process-spawn","external-binary","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"}