{"record":{"id":"703bb69225dfe26a","repo":"tonhowtf/omniget","slug":"ffmpeg-nao-iniciou-subtitle","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/subtitle.rs","lineNumber":525,"sourceCode":"        .args([\"-y\", \"-hide_banner\", \"-loglevel\", \"error\", \"-i\"])\n        .arg(video)\n        .args([\"-vf\", &filter])\n        .args([\n            \"-c:v\",\n            \"libx264\",\n            \"-preset\",\n            \"veryfast\",\n            \"-crf\",\n            \"20\",\n            \"-c:a\",\n            \"copy\",\n            \"-movflags\",\n            \"+faststart\",\n        ])\n        .arg(&output)\n        .output()\n        .await\n        .map_err(|e| anyhow!(\"ffmpeg nao iniciou: {}\", e))?;\n    if !out.status.success() {\n        return Err(anyhow!(\"{}\", String::from_utf8_lossy(&out.stderr).trim()));\n    }\n    super::report(&progress, \"subtitle\", \"done\", 1, Some(1), None);\n    Ok(output.to_string_lossy().to_string())\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    const SRT: &str = \"1\\n00:00:01,000 --> 00:00:03,500\\nPrimeira fala\\n\\n2\\n00:00:05,000 --> 00:00:06,000\\nSegunda\\nem duas linhas\\n\\n\";\n\n    #[test]\n    fn reads_srt_with_multiline_text() {\n        let cues = parse(SRT).unwrap();\n        assert_eq!(cues.len(), 2);\n        assert_eq!(cues[0].start_ms, 1000);","sourceCodeStart":507,"sourceCodeEnd":543,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/subtitle.rs#L507-L543","documentation":"subtitle::burn spawns ffmpeg to hard-burn subtitles into the video; if the spawn itself fails (the process never started — io error from .output()), it maps the io::Error into \"ffmpeg nao iniciou: {}\" (ffmpeg didn't start). This is distinct from a non-zero exit: ffmpeg never ran at all.","triggerScenarios":"Calling burn when ffmpeg binary cannot be spawned: binary not found on PATH, no execute permission, invalid UTF-8 in args (on Windows), or OS-level resource limits (E2BIG from a huge subtitles filter path/escaping).","commonSituations":"ffmpeg missing from PATH in production/container while present locally; ensure_ffmpeg passed but binary removed since; extremely long Windows paths or special characters in the subtitle path breaking argument passing.","solutions":["Verify ffmpeg is installed and executable (ffmpeg -version) and on PATH","Check the video/subtitle/output paths for invalid characters or excessive length","Confirm ensure_ffmpeg resolved the same binary that gets spawned","Check OS error appended in the message (e.g. No such file, Permission denied) for the exact cause"],"exampleFix":"// before\nlet out = Command::new(\"ffmpeg\").args(...).output().await;\n// after\nmatch which::which(\"ffmpeg\") { Ok(p) => ..., Err(_) => anyhow::bail!(\"ffmpeg not found on PATH\"), }\nlet out = Command::new(p).args(...).output().await;","handlingStrategy":"try-catch","validationCode":"let ffmpeg_ok = tokio::process::Command::new(\"ffmpeg\").arg(\"-version\").output().await.map(|o| o.status.success()).unwrap_or(false);\nif !ffmpeg_ok { return Err(\"ffmpeg not installed or not executable\"); }","typeGuard":null,"tryCatchPattern":"match burn(opts, progress).await {\n    Err(e) if e.to_string().starts_with(\"ffmpeg nao iniciou\") => {\n        // spawn failed: check PATH / permissions; do not retry blindly\n        tracing::error!(\"ffmpeg spawn failed: {e}\");\n    }\n    other => other,\n}","preventionTips":["Ensure ffmpeg is on PATH in every deployment (container images included)","Check binary permissions after install","Keep subtitle/video paths short and ASCII-safe on Windows","Bundle a known-good ffmpeg with the app"],"tags":["ffmpeg","spawn-failure","process","io-error","rust"],"backgroundTag":"missing-dependency","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"}