{"record":{"id":"0008c4befb2429eb","repo":"tonhowtf/omniget","slug":"video-gif","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/video_gif.rs","lineNumber":149,"sourceCode":"    ));\n    let chain = vf_chain(opts.fps, opts.width);\n    let cut = cut_args(opts.start, opts.duration);\n\n    if output_ext(&opts.format) == \"webp\" {\n        let out = crate::core::process::command(ffmpeg)\n            .args([\"-y\", \"-hide_banner\", \"-loglevel\", \"error\"])\n            .args(&cut)\n            .arg(\"-i\")\n            .arg(inp)\n            .args([\"-vf\", &chain, \"-c:v\", \"libwebp_anim\", \"-lossless\", \"0\"])\n            .args([\"-q:v\", &opts.quality.clamp(1, 100).to_string()])\n            .args([\"-loop\", \"0\", \"-an\"])\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    } else {\n        let tmp =\n            std::env::temp_dir().join(format!(\"omniget-palette-{}.png\", uuid::Uuid::new_v4()));\n        let pass1 = crate::core::process::command(ffmpeg)\n            .args([\"-y\", \"-hide_banner\", \"-loglevel\", \"error\"])\n            .args(&cut)\n            .arg(\"-i\")\n            .arg(inp)\n            .args([\n                \"-vf\",\n                &format!(\n                    \"{},palettegen=max_colors={}:stats_mode=diff\",\n                    chain,\n                    opts.max_colors.clamp(4, 256)\n                ),\n            ])\n            .arg(&tmp)","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/video_gif.rs#L131-L167","documentation":"Raised when the ffmpeg process for animated WebP conversion fails to start or its first spawn/output step errors; the {} carries the underlying OS/process error (e.g. ffmpeg binary missing, permission denied). It fires in the webp branch of convert_one before any encoding output is produced.","triggerScenarios":"The single-pass conversion (libwebp_anim or GIF with the built filter chain) fails: corrupt/undecodable input, unsupported input codec/pixel format, invalid -vf chain (e.g. bad fps/scale values), or output path not writable.","commonSituations":"Input video with odd dimensions or an exotic codec ffmpeg can't decode; requested fps/width producing a scale filter error (e.g. division by zero on 0-width); ffmpeg build without libwebp_anim or GIF encoder; disk full at output location.","solutions":["Inspect the embedded stderr message — it is ffmpeg's own error (e.g. 'Invalid argument', 'Unknown encoder').","Validate the input with `ffprobe <input>`; re-encode or repair unreadable sources before conversion.","Check that scale/fps options are positive and that even dimensions are used for webp/gif output.","Ensure the ffmpeg build includes the target encoder (`<ffmpeg> -encoders | grep -E 'gif|libwebp'`)."],"exampleFix":"// before\nif !out.status.success() { return Err(anyhow!(\"{}\", String::from_utf8_lossy(&out.stderr).trim())); }\n// after\nif !out.status.success() {\n    let stderr = String::from_utf8_lossy(&out.stderr).trim().to_string();\n    anyhow::bail!(\"conversao gif falhou (exit {:?}): {}\", out.status.code(), stderr);\n}","handlingStrategy":"try-catch","validationCode":"let probe = crate::core::ffmpeg::probe(input).await?;\nanyhow::ensure!(probe.duration_seconds > 0.0, \"entrada não decodificável\");\nanyhow::ensure!(opts.width.unwrap_or(2) > 0 && opts.fps.unwrap_or(1.0) > 0.0, \"fps/largura devem ser positivos\");","typeGuard":null,"tryCatchPattern":"match convert_one(...).await {\n    Err(e) if !e.to_string().contains(\"nao iniciou\") => {\n        log::error!(\"ffmpeg stderr: {e}\"); // parse decoder/encoder messages\n    }\n    r => r,\n}","preventionTips":["ffprobe every input before conversion; reject unreadable media early.","Use even dimensions and positive fps in filter chains.","Verify encoder availability (gif/libwebp_anim) in the bundled ffmpeg."],"tags":["ffmpeg","nonzero-exit","video-conversion","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"}