Convert Video to Animated WebP Using FFmpeg

This article provides a straightforward, step-by-step guide on how to convert high-resolution videos into optimized, lightweight animated WebP files using the powerful command-line utility FFmpeg. You will learn the specific command-line arguments needed to scale down high-resolution source files, adjust frame rates, control image quality, and set looping options to ensure your output files are perfectly balanced between visual quality and file size.

The Basic Conversion Command

For a simple conversion without any specific optimizations, you can use the default FFmpeg command. However, because WebP is designed for short, web-friendly animations, converting a raw high-resolution video this way will likely result in an excessively large file size.

ffmpeg -i input.mp4 output.webp

Optimizing High-Resolution Video for WebP

To make a high-resolution video suitable for web delivery as an animation, you must scale the resolution down, lower the frame rate, and adjust the compression settings.

Here is the recommended command for a balanced, high-quality, and highly compressed animated WebP:

ffmpeg -i input.mp4 -vf "fps=15,scale=800:-1:flags=lanczos" -vcodec libwebp -lossless 0 -q:v 75 -loop 0 -an output.webp

Breakdown of the Command Parameters

Advanced Quality Tuning

If the resulting file size is still too large, or if you need higher visual fidelity, you can adjust the following parameters: