Convert a Twitter (X) Video to GIF with ffmpeg or Free Apps
Turn a downloaded Twitter (X) MP4 into a real animated .gif with ffmpeg's two-pass palette method or free apps, plus tips for keeping the file small.
Every "GIF" you see on X (formerly Twitter) is actually a short, silent MP4 loop, so when you save one with Twget you get a video file, not a .gif. That is the right format for most uses, but sometimes you need a genuine GIF: a chat app that only accepts images, a slide deck, a README on GitHub, or a site that will not autoplay video. This guide shows how to convert a downloaded MP4 into a good-looking .gif with ffmpeg, and lists free alternatives if you would rather not use a terminal.
Step 1: Download the MP4 first
Before converting anything, you need the source video on your computer. Paste the post link into Twget, choose the resolution you want, and save the MP4. If you are on a desktop and want the full walkthrough, including where browsers put the file, read how to download Twitter videos on Mac and Windows. If the post contains an X "GIF" specifically, the background on why it arrives as MP4 is covered in how to save GIFs from Twitter.
One practical note: for GIF conversion, the highest resolution is rarely the best pick. You will usually scale the output down to 480 pixels wide or less anyway, so a 720p source is plenty and keeps the conversion fast.
Why GIF conversion needs care
GIF is an old format with hard limits. According to the MDN guide to image file types, each GIF frame is 8-bit indexed color, meaning a palette of at most 256 colors, and the data is compressed losslessly with the LZW algorithm. Video, by contrast, uses millions of colors and lossy compression that exploits motion between frames. The Wikipedia article on GIF notes that platforms such as Telegram re-encode GIFs to MPEG-4 precisely because the video version can need up to 95 percent less space at the same quality.
Two consequences follow:
- A naive conversion picks a generic 256-color palette, which produces banding and speckled noise on gradients and skin tones.
- A GIF of the same clip will be several times larger than the MP4, and it grows quickly with resolution, frame rate, and duration.
The fix for the first problem is to generate a custom palette from the actual video. The fix for the second is to be deliberate about size, frame rate, and length.
Step 2: Install ffmpeg
ffmpeg is a free, open-source command-line tool that handles almost every video and image format. Official builds and package-manager instructions are on the ffmpeg download page.
- macOS: with Homebrew installed, run
brew install ffmpeg. - Windows: download a static build linked from the ffmpeg download page, unzip it, and add the
binfolder to your PATH, or run the executable from its folder. - Linux: use your distribution's package manager, for example
sudo apt install ffmpeg.
Confirm it works by typing ffmpeg -version in a terminal.
Step 3: Convert with the two-pass palette method
The ffmpeg filter documentation describes two filters built for exactly this job: palettegen, which analyses the video and produces an optimal 256-color palette, and paletteuse, which applies that palette with dithering. Both are documented in the ffmpeg filters reference.
Open a terminal in the folder containing your downloaded file (call it clip.mp4) and run the two commands below.
Pass 1: build the palette
ffmpeg -i clip.mp4 -vf "fps=15,scale=480:-1:flags=lanczos,palettegen" palette.png
Pass 2: encode the GIF using that palette
ffmpeg -i clip.mp4 -i palette.png -filter_complex "fps=15,scale=480:-1:flags=lanczos[x];[x][1:v]paletteuse" out.gif
What each piece does:
fps=15drops the frame rate to 15 frames per second. Most X videos are 30 fps; halving it cuts the size roughly in half and still looks smooth for reaction clips.scale=480:-1sets the width to 480 pixels and keeps the aspect ratio. Use-2instead of-1if ffmpeg complains about odd heights.flags=lanczospicks a sharper scaling algorithm.[x][1:v]paletteusefeeds the scaled video and the palette image into the palette filter.
The two filter chains must match; if you change the fps or scale in pass 1, change it in pass 2 as well.
Optional: a single-command version
Newer ffmpeg releases let you do both passes in one command using split:
ffmpeg -i clip.mp4 -vf "fps=15,scale=480:-1:flags=lanczos,split[a][b];[a]palettegen[p];[b][p]paletteuse" out.gif
This is convenient but uses more memory on long clips. Either approach gives the same result.
Trim before you convert
GIFs should be short. To convert only a section, add -ss (start) and -t (duration) right after ffmpeg, before -i:
ffmpeg -ss 2 -t 4 -i clip.mp4 -vf "fps=15,scale=480:-1:flags=lanczos,palettegen" palette.png
Repeat the same -ss and -t values in the second pass.
Size tips that actually matter
The four levers, in order of impact:
| Lever | Typical setting | Effect |
|---|---|---|
| Duration | 2-6 seconds | Linear: half the length, half the size |
| Width | 320-480 px | Quadratic: 480 to 320 px cuts pixels by more than half |
| Frame rate | 10-15 fps | Linear; below 10 fps motion looks choppy |
| Colors | 64-128 for flat graphics | palettegen=max_colors=128 shrinks files with simple art |
A few more adjustments worth knowing:
- Dithering.
paletteuse=dither=bayer:bayer_scale=5produces a cleaner pattern and often a smaller file than the default error-diffusion dither, at the cost of a faint crosshatch. Try both on the same clip. - Cropping. Add
crop=w:h:x:ybeforescaleto remove borders or focus on the subject. - Static background. If the camera does not move,
palettegen=stats_mode=diffandpaletteuse=diff_mode=rectangletell ffmpeg to spend the palette on the parts that change, which reduces both noise and size.
Free apps if you prefer a GUI
- gifski (GitHub) is an open-source encoder that produces unusually high-quality GIFs from video, with a drag-and-drop macOS app and a command-line version for Windows and Linux. Its output tends to be larger than ffmpeg's because it favours quality; use its width and fps controls to compensate.
- ezgif (video to GIF) is a browser-based converter with trimming, resizing, and optimisation steps. It is the fastest route if you convert once in a while. As with any upload-based tool, remember that your file is sent to a third-party server.
- GIMP can open an image sequence exported by ffmpeg (
ffmpeg -i clip.mp4 frame_%03d.png) and export it as an animated GIF, which is useful when you also want to add text or edit frames.
Frequently asked questions
Why is my GIF so much bigger than the MP4 I downloaded?
Because GIF stores every frame as an indexed image with lossless compression, while the MP4 stores mostly the differences between frames with lossy compression. A 10 MB GIF from a 1 MB video is normal. Reduce the width, frame rate, and duration before anything else.
Can I convert directly from the X link without downloading?
No. Conversion needs the actual video data on your machine or on a server. Download the MP4 with Twget first, then convert locally. That also keeps the original in case you want to try different settings.
Should I just keep the MP4 instead?
Often, yes. Most chat apps, X itself, and modern browsers play a silent looping MP4 more efficiently than a GIF. Convert only when the destination genuinely requires the .gif format.
Converting a Twitter video to GIF comes down to two things: a palette generated from the real footage and sensible limits on size and length. With the two ffmpeg commands above you get a clean result in seconds, and if you would rather click than type, gifski or ezgif will do the job. Start by grabbing the MP4 from Twget, then pick the tool that fits your workflow.
Sources
- ffmpeg filters documentation: palettegen and paletteuse — FFmpeg, accessed November 30, 2025
- Download FFmpeg — FFmpeg, accessed November 30, 2025
- Image file type and format guide — MDN Web Docs, accessed November 30, 2025
- GIF — Wikipedia, accessed November 30, 2025
- gifski — GitHub, accessed November 30, 2025
- Video to GIF converter — ezgif, accessed November 30, 2025
व्हिडिओ जतन करण्यास तयार आहात? पोस्टची लिंक Twget वर पेस्ट करा.
Twget उघडा