agentleFS
memgraftermemgrafter/skills-flatagents/create-gif/SKILL.md

create-gif

Skill3 starsChanged 8 months agoApache-2.0View on GitHub

Turn a video URL or local clip into a crisp, size-efficient GIF with precise timing controls and proven quality/size presets (including hard skin-tone lighting cases).

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create reproducible GIFs quickly without guessing encode settings.

    line 6
  2. Distinctive:

    If target supports MP4/WebP (these are dramatically smaller at better quality)

    line 24
  3. Very specific:

    If timing is off, do final trim by seconds with ffmpeg (-ss, -to/-t)

    line 41
  4. Distinctive:

    If you know clip length, use ffmpeg on the downloaded clip:

    line 61

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Create reproducible GIFs quickly without guessing encode settings.

Why use it

  • Precise clip timing (exact start/end and offset fixes)
  • Better color fidelity for difficult footage (explicit BT.709 → sRGB before palette quantization)
  • Predictable size/quality tuning (resolution, fps, colors, lossy level)
  • Reusable presets from tested runs, not one-off trial-and-error

When to use

  • You need a GIF deliverable (chat apps, docs, issue comments)
  • Source is YouTube or local MP4
  • You need to balance smoothness and file size intentionally
  • Scene has skin tones/high contrast and default GIF conversion looks wrong

When NOT to use

  • If target supports MP4/WebP (these are dramatically smaller at better quality)
  • Very long clips (GIF size grows fast)
  • You need perfect color preservation (GIF is limited to 256 colors)

Requirements (what must be installed)

  • yt-dlp
  • ffmpeg
  • imagemagick (magick)
  • gifsicle

Usage

Segment-first methodology (recommended)

  1. Define segment in seconds first (example: start=14, end=23 or duration=9)
  2. Download only the needed YouTube window
  3. If timing is off, do final trim by seconds with ffmpeg (-ss, -to/-t)
  4. Convert to GIF with the quality preset

Why seconds-based segmenting helps:

  • Fast iteration: change start/end by 1s without rethinking timestamps
  • Reproducible edits: exact same segment can be regenerated later
  • Clear intent: start+duration is great when clip length is fixed
  • Less waste: avoids downloading/processing full videos

1) Download time slice from YouTube

yt-dlp -f "bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4]/best" \
  --download-sections "*00:00:14-00:00:23" \
  --force-keyframes-at-cuts --merge-output-format mp4 \
  -o "yt_clip.%(ext)s" "<YOUTUBE_URL>"

1b) Alternative: start + duration (seconds)

If you know clip length, use ffmpeg on the downloaded clip:

# start at 15s, keep 8s
ffmpeg -y -ss 15 -t 8 -i yt_clip.mp4 -c copy yt_clip_segment.mp4

Or if you prefer start + end:

# start at 15s, end at 23s
ffmpeg -y -ss 15 -to 23 -i yt_clip.mp4 -c copy yt_clip_segment.mp4

2) Gold-standard preset (best compromise found)

ffmpeg -y -ss 1 -t 8 -i yt_clip.mp4 \
  -vf "fps=16,scale=520:-1:flags=lanczos,hqdn3d=1.0:1.0:3:3,colorspace=iall=bt709:ispace=bt709:itrc=bt709:iprimaries=bt709:irange=tv:space=gbr:trc=srgb:primaries=bt709:range=pc,format=rgb24,split[s0][s1];[s0]palettegen=max_colors=160:reserve_transparent=0:stats_mode=full[p];[s1][p]paletteuse=dither=sierra2_4a" \
  jack_typing_520w_16fps_srgb_160_raw.gif

magick jack_typing_520w_16fps_srgb_160_raw.gif -layers Optimize jack_typing_520w_16fps_srgb_160.gif
gifsicle -O3 --lossy=45 jack_typing_520w_16fps_srgb_160.gif -o jack_typing_520w_16fps_srgb_160_lossy45.gif

Validated ranges tested

  • Width/size: 420w, 480p, 520w, 560w, 640w
  • FPS: 10, 12, 16, 20
  • Palette colors: 96, 112, 128, 160, 192, 224, 256
  • Lossy levels: 20, 30, 35, 40, 45, 50, 80
  • Dither modes: none, bayer, sierra2_4a

Output

Typical files produced:

  • *_raw.gif (pre-optimization)
  • *.gif (optimized)
  • *_lossyXX.gif (final size/quality tradeoff)

How it works

Cut exact segment → color-space normalize → generate/apply palette → optimize frames → optional lossy compression.

Trade-off: more fidelity requires bigger GIFs; this workflow gives controlled compromises instead of random artifacts.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.