Repository navigation
GIFs from X
Khryz-Navarro edited this page Nov 9, 2026
·
1 revision
Paste a link to a post on X (Twitter) that has a GIF, and get a real .gif file. Today you'd get the silent MP4 that X actually serves.
-
Links from X:
- yt-dlp already downloads X videos.
-
assert_urlinsrc/ytdlp.rsaccepts anyhttp(s)link, so X links already reach yt-dlp. - What's new is recognizing a GIF and converting it.
-
Detecting a GIF:
- X marks these as animated GIFs; check how yt-dlp exposes that in its metadata, for example a format note or the media type.
- Failing that, the signs are a short video with no audio stream.
- When detected, the quality list shows GIF first, and MP4 remains available.
-
Converting:
- ffmpeg, in two passes for good colors:
-
palettegenmakes a palette from the video; -
paletteuseapplies it.
-
- Size and frame rate are capped (for example 480 px wide, 15 fps), because GIFs grow fast.
- This is a new
gif_argsnext toconvert_argsinsrc/ytdlp.rs, with tests.
- ffmpeg, in two passes for good colors:
-
Signing in: X often wants a signed-in session. The existing Cookies setting (Firefox or a
cookies.txt) covers it.
- Should the GIF size and frame rate be a setting, or should the app just pick a sensible default?
- Should a
.webp(smaller, still animated) be offered next to.gif?
- X keeps changing: its access rules and API change often. Downloads depend on yt-dlp keeping up, and on cookies when X demands a sign-in.
- File size: a GIF is often five to ten times larger than the MP4 it came from. The quality list should say so.
Phase 1: links you paste
Phase 2: tools for your files
Phase 3: new engines
Phase 4: beyond the desktop