Animated GIF to MP4 video conversion
mouse 2198 · person cloud · link
Last update
2017-04-07
2017
04-07
« — »
1
2
3
4
5
6
# make a video for PCs:
ffmpeg -i in.gif -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" out.mp4

# make a video optimized for Browsers:
ffmpeg -i in.gif -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" \
  -movflags faststart -pix_fmt yuv420p out.mp4

Options:

  • -vf "...": ensure that both dimensions are divisible by 2 in order to have a valid MP4 file.
  • -movflags: optimize browser file loading time.
  • -pix_fmt yuv420p (chroma subsampling): set a high compatibility pixel format for all browsers.

Source: Rigor.com