Convert GIF to MP4
An animated GIF is a very heavy format: an equivalent MP4 is often 10 to 20 times smaller and plays more smoothly. Convert your GIFs to MP4 to embed them in a website, send them by messaging or post them on social media.
Updated on
A GIF loops, an MP4 doesn't: repeat the animation to make the video longer.
How to use it
- Install ffmpeg if you haven't already.
- Open a terminal in the folder containing your file.
- Copy the generated command, adjust the file names if needed, then run it.
- Open the resulting file to check the result.
Embed the MP4 in a web page
To replace a GIF in a web page, use a video tag that behaves like a GIF: autoplay, looping and no sound.
<video src="animation.mp4" autoplay loop muted playsinline></video>
The other way around
To turn a video into a GIF, with an optimized color palette, use the dedicated page.
Frequently asked questions
Why is an MP4 smaller than a GIF?
A GIF stores each frame as a still 256-color image, without taking advantage of the similarities between them. An MP4 only encodes the differences from one frame to the next, which is far more efficient.
Why the scale filter with trunc?
The H.264 format requires an even width and height. Many GIFs have odd dimensions, which would make encoding fail. The filter rounds down to the nearest even value.
The MP4 doesn't loop, what can I do?
Video players don't loop by default. On a web page, add the attributes "loop autoplay muted playsinline" to the video tag; elsewhere, use the repeat option on this page.
Can I keep the transparency?
No: H.264 MP4 doesn't support transparency. The transparent areas of the GIF become black. To keep transparency on the web, use an animated WebP instead.