Menu

Post image 1
Post image 2
1 / 2
0

How to Convert MP4 to GIF with FFmpeg (High Quality, Small File)

DEV Community·Javid Jamae·about 1 month ago
#hSZUF4cI
Reading 0:00
15s threshold

Originally published at ffmpeg-micro.com . Converting an MP4 to a GIF with FFmpeg sounds simple until you actually try it. The default output is either a blurry mess or a 50MB file that nobody wants to load. The trick is knowing which FFmpeg flags control quality and file size independently. The Basic Command (and Why It Looks Bad) The most basic FFmpeg conversion looks like this: ffmpeg -i input.mp4 output.gif Enter fullscreen mode Exit fullscreen mode This technically works. But the result will look terrible. GIFs are limited to 256 colors per frame. FFmpeg's default color selection doesn't pick the right 256 to keep, so you get banding, dithering artifacts, and washed-out colors. The file will also be massive because there's no compression optimization happening. A 10-second 1080p clip can easily produce a 100MB+ GIF. High-Quality GIFs with Palette Generation The fix is FFmpeg's palettegen and paletteuse filters.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More