Skip to main content

Convert an animated GIF to an MP4 with ffmpeg

I sometimes need to convert animated GIFs into MP4 movie files – this can often result in much smaller files, which is useful for serving the images on the web.

This is the ffmpeg command I use:

ffmpeg \
  -movflags faststart \
  -pix_fmt yuv420p \
  [-vf scale=WIDTH:HEIGHT] \
  [-y] \

Here’s what it’s doing: