# Ffmpeg Gif

> Generate optimized GIFs from video files using ffmpeg palette optimization. Use for creating GIFs from screen recordings, clips, or animations for documentation, chat, issue attachments, or README embeds. Covers two-pass palette generation for quality and small file size.

- **Type:** Skill
- **Install:** `agentstack add skill-roysahar11-agentic-video-editing-collab-ffmpeg-gif`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [roysahar11](https://agentstack.voostack.com/s/roysahar11)
- **Installs:** 0
- **Category:** [Content & Media](https://agentstack.voostack.com/c/content-and-media)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [roysahar11](https://github.com/roysahar11)
- **Source:** https://github.com/roysahar11/agentic-video-editing-collab/tree/main/ffmpeg-gif

## Install

```sh
agentstack add skill-roysahar11-agentic-video-editing-collab-ffmpeg-gif
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# ffmpeg-gif

Convert video to GIF with palette optimization. Two-pass approach (palettegen + paletteuse) produces much better quality and smaller file sizes than direct GIF encoding.

## Single command (two-pass via filter_complex)

```bash
ffmpeg -i input.mp4 \
  -vf "fps=8,scale=400:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=192:stats_mode=diff[p];[s1][p]paletteuse=dither=bayer:bayer_scale=4" \
  output.gif
```

Key params:
- **`fps=8`** — GIF frame rate. 8-12 is plenty for most documentation. 15+ bloats the file for negligible visual gain.
- **`scale=400:-1`** — width in pixels, preserves aspect ratio (`-1` auto). For README/issue embeds, 400-600px is typical.
- **`max_colors=192`** — palette size. 192 is a good default; drop to 128 for smaller files at some quality loss.
- **`stats_mode=diff`** — palettize based on frame differences (better for screen recordings where most of the frame is static).
- **`dither=bayer:bayer_scale=4`** — Bayer dithering reduces banding. `bayer_scale=3` is sharper but noisier; `5` is smoother but softer.

## Smaller files

For the smallest reasonable GIF:
```bash
ffmpeg -i input.mp4 \
  -vf "fps=6,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=128:stats_mode=diff[p];[s1][p]paletteuse=dither=bayer:bayer_scale=5" \
  output.gif
```

## Higher quality

For screen recordings with fine text:
```bash
ffmpeg -i input.mp4 \
  -vf "fps=10,scale=600:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=256:stats_mode=diff[p];[s1][p]paletteuse=dither=bayer:bayer_scale=3" \
  output.gif
```

## Trim to a segment first

Chain with `trim` or use `-ss`/`-t`:
```bash
ffmpeg -ss 5 -i input.mp4 -t 10 \
  -vf "fps=8,scale=400:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=192:stats_mode=diff[p];[s1][p]paletteuse=dither=bayer:bayer_scale=4" \
  output.gif
```

## Check file size

```bash
ls -lh output.gif
```

Target: under 5MB for GitHub embeds (hard limit 10MB), under 1MB for Slack/chat pastes.

If too large: reduce `fps`, `scale`, or `max_colors`. Every halving of width quarters the file size approximately.

## When NOT to use GIF

- Video with audio → use MP4 or WebM, not GIF (GIF has no audio)
- Long clips (>15 seconds) → file size explodes; consider MP4
- High-detail footage → GIF's 256-color palette is too limited; use MP4
- Modern platforms that accept video attachments → just send the MP4

## Not for editing workflows

This skill is for **standalone GIF generation** — converting an existing clip or recording to a GIF output. For video editing operations (trim, concat, speed, fade, scale, pad), use `/ffmpeg-editing` instead.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [roysahar11](https://github.com/roysahar11)
- **Source:** [roysahar11/agentic-video-editing-collab](https://github.com/roysahar11/agentic-video-editing-collab)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-roysahar11-agentic-video-editing-collab-ffmpeg-gif
- Seller: https://agentstack.voostack.com/s/roysahar11
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
