tonhowtf/omniget · error

paleta

Error message

paleta: {}

What it means

Raised after the first ffmpeg pass (palettegen with stats_mode=diff and clamped max_colors) exits with a non-zero status; the {} is ffmpeg's stderr tail. The temporary palette file is removed before the error propagates, aborting the two-pass GIF conversion in convert_one.

Solutions

  1. Read the stderr after 'paleta:' for ffmpeg's concrete failure.
  2. Check ffmpeg supports palettegen: `<ffmpeg> -filters | grep palettegen`; upgrade ffmpeg if missing.
  3. Verify TMPDIR/temp_dir is writable so the palette PNG can be written.
  4. Validate the input decodes (`ffprobe <input>`); repair or re-download corrupt media.

Example fix

// before
return Err(anyhow!("paleta: {}", String::from_utf8_lossy(&pass1.stderr).trim()));
// after
let stderr = String::from_utf8_lossy(&pass1.stderr).trim().to_string();
if stderr.contains("No such filter") {
    anyhow::bail!("ffmpeg build lacks palettegen; install a full ffmpeg build");
}
anyhow::bail!("paleta: {}", stderr);
Defensive patterns

Strategy: try-catch

Validate before calling

let out = crate::core::process::command(ffmpeg)
    .args(["-hide_banner", "-filters"])
    .output().await?;
anyhow::ensure!(String::from_utf8_lossy(&out.stdout).contains("palettegen"), "ffmpeg sem filtro palettegen");

Try / catch

match convert_one(...).await {
    Err(e) if e.to_string().starts_with("paleta:") => {
        log::error!("palettegen falhou: {e}"); // fallback: convert without palette
    }
    r => r,
}

Prevention

When it happens

Trigger: Pass 1 (`palettegen` with max_colors clamped 4-256) returns non-zero: input can't be decoded, the -vf palettegen arguments are rejected by the installed ffmpeg version, or the temp output PNG path is unwritable.

Common situations: Very old ffmpeg without palettegen filter (added in ffmpeg 2.x, but some minimal builds strip filters); corrupt input video; TMPDIR pointing to a read-only location; max_colors producing an invalid filter string.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/f995af8aaecd9fe0. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/video_gif.rs:173

            .args(["-y", "-hide_banner", "-loglevel", "error"])
            .args(&cut)
            .arg("-i")
            .arg(inp)
            .args([
                "-vf",
                &format!(
                    "{},palettegen=max_colors={}:stats_mode=diff",
                    chain,
                    opts.max_colors.clamp(4, 256)
                ),
            ])
            .arg(&tmp)
            .output()
            .await
            .map_err(|e| anyhow!("ffmpeg nao iniciou: {}", e))?;
        if !pass1.status.success() {
            let _ = std::fs::remove_file(&tmp);
            return Err(anyhow!(
                "paleta: {}",
                String::from_utf8_lossy(&pass1.stderr).trim()
            ));
        }
        let pass2 = crate::core::process::command(ffmpeg)
            .args(["-y", "-hide_banner", "-loglevel", "error"])
            .args(&cut)
            .arg("-i")
            .arg(inp)
            .arg("-i")
            .arg(&tmp)
            .args([
                "-lavfi",
                &format!(
                    "{}[x];[x][1:v]paletteuse={}",
                    chain,
                    dither_arg(&opts.dither)
                ),

View on GitHub (pinned to 8600b91f42)