{"record":{"id":"feb88b2d5de65d32","repo":"tonhowtf/omniget","slug":"ffmpeg-nao-iniciou","errorCode":null,"errorMessage":"ffmpeg nao iniciou: {}","messagePattern":"ffmpeg nao iniciou: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/audio_clean.rs","lineNumber":163,"sourceCode":"    pub gain_db: f64,\n    pub filter: String,\n    pub ok: bool,\n    pub error: Option<String>,\n}\n\n#[derive(Debug, Clone, Serialize)]\npub struct CleanResult {\n    pub items: Vec<CleanItem>,\n}\n\nasync fn measure(ffmpeg: &Path, input: &Path, filter: &str) -> anyhow::Result<Loudness> {\n    let out = crate::core::process::command(ffmpeg)\n        .args([\"-hide_banner\", \"-nostats\", \"-i\"])\n        .arg(input)\n        .args([\"-af\", filter, \"-f\", \"null\", \"-\"])\n        .output()\n        .await\n        .map_err(|e| anyhow!(\"ffmpeg nao iniciou: {}\", e))?;\n    let stderr = String::from_utf8_lossy(&out.stderr).to_string();\n    parse_measure(&stderr).ok_or_else(|| {\n        anyhow!(\n            \"não consegui medir o loudness: {}\",\n            stderr.lines().last().unwrap_or(\"\").trim()\n        )\n    })\n}\n\nasync fn clean_one(ffmpeg: &Path, opts: &CleanOptions, input: &str) -> anyhow::Result<CleanItem> {\n    let inp = Path::new(input);\n    let probe = crate::core::ffmpeg::probe(inp).await?;\n    if !probe.streams.iter().any(|s| s.codec_type == \"audio\") {\n        return Err(anyhow!(\"o arquivo não tem trilha de áudio\"));\n    }\n    let has_video = probe\n        .streams\n        .iter()","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/audio_clean.rs#L145-L181","documentation":"measure runs ffmpeg (loudnorm/ebur128 analysis) via crate::core::process::command; if the process cannot be spawned at all, the io::Error is wrapped as \"ffmpeg nao iniciou: {e}\". This is a spawn/startup failure, not an ffmpeg processing failure.","triggerScenarios":"clean_one or live_audio_normalizes_and_denoises -> measure when the ffmpeg binary path is wrong/missing, the file lacks execute permission, or the OS fails to fork/exec the process.","commonSituations":"ffmpeg not installed or not on PATH; misconfigured ffmpeg path in options; Windows vs Unix binary name mismatch; permission bits stripped after packaging.","solutions":["Verify ffmpeg is installed and resolvable: `which ffmpeg` / `where ffmpeg`","Check the configured ffmpeg path passed to clean_one/measure points to an executable file","Add execute permission (chmod +x) if the bundled binary lacks it","Match the io::ErrorKind to give clearer guidance (NotFound -> install ffmpeg; PermissionDenied -> chmod)"],"exampleFix":"// before\n.output()\n.await\n.map_err(|e| anyhow!(\"ffmpeg nao iniciou: {}\", e))?;\n// after\n.output()\n.await\n.map_err(|e| match e.kind() {\n    std::io::ErrorKind::NotFound => anyhow!(\"ffmpeg binary not found at '{}'; install ffmpeg or set the correct path\", ffmpeg.display()),\n    std::io::ErrorKind::PermissionDenied => anyhow!(\"ffmpeg at '{}' is not executable (chmod +x)\", ffmpeg.display()),\n    _ => anyhow!(\"ffmpeg nao iniciou: {}\", e),\n})?;","handlingStrategy":"validation","validationCode":"// Verify ffmpeg is runnable before the pipeline\nlet ffmpeg = Path::new(\"ffmpeg\");\nanyhow::ensure!(\n    which::which(ffmpeg).is_ok(),\n    \"ffmpeg not found on PATH; install it or configure the path\"\n);","typeGuard":null,"tryCatchPattern":"match measure(&ffmpeg, &input, &filter).await {\n    Ok(m) => m,\n    Err(e) if e.to_string().contains(\"ffmpeg nao iniciou\") => {\n        return Err(anyhow!(\"ffmpeg is not installed or not executable: {e}\"));\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Check ffmpeg availability at app startup, not per operation","Pin the ffmpeg path in configuration","In packaged apps, verify the bundled binary has +x permission","Distinguish io::ErrorKind::NotFound vs PermissionDenied in messages"],"tags":["ffmpeg","process-spawn","audio","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"}