Video
Making a GIF from a video: why it is so heavy, and how to keep it light
Animated GIFs are everywhere: reactions in messaging apps, software demos, tutorials. They have one decisive advantage: they play by themselves, on a loop, with no play button or video player, including in places where a video would not display, such as many email clients or README files. But they also have a flaw everyone discovers sooner or later: they are huge. We measured the gap with a video, and explain how to make a GIF that stays reasonable.
A 1987 format against modern codecs
GIF was designed in 1987 for still images, at a time when screens displayed 256 colours. It has kept two limits from that era. First, each frame can only contain 256 colours, picked from a palette: the gradients of a sky or a face turn into flat areas or grain. Second, its LZW compression only spots repetitions within each frame, taken in isolation.
A video codec such as H.264 works completely differently. Most frames of a video are not stored in full: the encoder only records what changed compared with neighbouring frames, by describing how areas of the picture move. In a scene where only a small part moves, the savings are considerable. A GIF, by contrast, starts almost from scratch with every frame.
What we measured
We took the first five seconds of a smartphone video shot in 1080p at 60 frames per second: a desert landscape, with slight camera movement. We converted it to GIF with FileXvert's settings, then to H.264 MP4 at identical dimensions and frame rate, for a fair comparison.
| Version | Dimensions and frame rate | Size |
|---|---|---|
| Original (H.264 MOV) | 1920 × 1080, 60 fps | 15.8 MB |
| GIF (FileXvert) | 480 × 270, 15 fps | 4.33 MB |
| H.264 MP4, same settings | 480 × 270, 15 fps | 499 KB |
| H.264 MP4, 60 fps | 480 × 270, 60 fps | 648 KB |
At identical dimensions and frame rate, the GIF weighs 8.7 times more than the MP4, while showing fewer colours. Even an MP4 four times smoother, at 60 frames per second, remains almost seven times lighter than the GIF. The ratio varies from one clip to another, but it is always heavily against GIF as soon as the scene contains gradients, grain or camera movement.
The settings FileXvert applies
To limit this weight, FileXvert automatically makes three choices when converting to GIF. The width is reduced to 480 pixels using high-quality resizing (the Lanczos filter), with the height following the video's proportions. The frame rate is set to 15 frames per second, enough for readable motion. Finally, the sound is dropped, since GIF cannot carry it.
These settings produce a GIF suited to a message, documentation or a web page. The lever that remains in your hands is the most effective of all: duration. A GIF's size is almost proportional to its number of frames; at 15 frames per second, every second you cut therefore removes about 15 frames from the file.
Making a light GIF
A few choices made upstream do more than any setting:
- Trim as short as possible before converting: two to five seconds is enough for a reaction or a gesture to show.
- Prefer simple scenes: a software screen, a plain background or a static shot compress far better than a landscape, water or foliage.
- Film without moving: camera movement changes every pixel of every frame, which GIF cannot compress.
- Avoid subtle gradients, which will become colour bands with the 256-colour palette.
- For an animated screen capture, frame only the useful area rather than the whole screen.
When a short video is the better choice
On a website you manage, an MP4 video set to autoplay, muted and looping, does exactly the same job as a GIF for a fraction of the size and with every colour. It is in fact what most large platforms do behind the scenes: the GIFs they display are often videos.
GIF remains the right choice, however, where video is not accepted or will not start on its own: most email clients, many Markdown documentation pages, some ticketing tools and corporate messaging apps. In those cases, its universal compatibility is what counts, and a few well-chosen seconds are enough.