Programster's Blog

Tutorials focusing on Linux, programming, and open-source

FFMPEG - Create WebP Animated Images

I wanted to find an animated image format that would allow me to have a larger, better quality image, than what I can achieve with GIF.

This is how one can use ffmpeg to convert a short video into a WebP animated image.


Copy, paste, and execute the script below after having tweaked the variables at the top to match your needs.


# Specify the path to the video you wish to convert to an animated webp.

# Set framerate of animated image.

# Set output width/height

# Set compression of webp images between 1-100 with 100 being perfect.

ffmpeg \
  -vcodec libwebp \
  -preset default \
  -loop 0 \
  -an -vsync 0 \
  -vf "fps=$FRAMERATE, scale=$WIDTH:$HEIGHT" \
  -qscale $QUALITY \

Below is an animated WebP image I managed to create that would fit within Discord's 8 MB file limit:

Unfortunately, it appears that Discord does not currently support WebP images, but they did in the past.

Gif Comparison

I converted the video to a GIF as well for comparison (below), which resulted in a larger file and a much poorer quality.


Last updated: 28th February 2021
First published: 28th February 2021