MY WEBCAM TEST GUIDE

How to Convert MP4 to AVIF

Learn how to convert an MP4 video into AVIF image frames using FFmpeg and other local tools, with practical settings for quality, size, and GPU use.

Before you start

MP4 is a video container, while AVIF is a compressed still-image format based on the AV1 codec. MP4 to AVIF conversion therefore means extracting one or more video frames and encoding them as AVIF files. The most common local method uses FFmpeg; version 6.1 and later include libaom-av1 encoding support, while builds with librav1e or SVT-AV1 may also be available. This process runs entirely on your computer and does not require an online conversion service.

Check which AVIF encoders your FFmpeg build provides by running ffmpeg -hide_banner -encoders and looking for av1 entries. If the build lists libaom-av1, you can proceed with the default approach. If only librav1e or libsvtav1 is available, adjust the encoder name and options accordingly.

Step-by-step instructions

The following steps are written for FFmpeg from a command prompt or terminal. Replace input.mp4, timestamp, and image dimensions with your own values.

1) Install FFmpeg and confirm that the command ffmpeg -version is available in your terminal.

2) Run ffmpeg -hide_banner -encoders and find the list of supported AV1 or AVIF encoders.

3) Convert the MP4 file into one AVIF frame using libaom-av1:

ffmpeg -i input.mp4 -ss 00:00:01 -frames:v 1 -c:v libaom-av1 -still-picture 1 -crf 32 output.avif

The -ss option selects the timestamp, and -frames:v 1 limits extraction to one frame. Lower CRF values such as 24 retain more detail; higher values such as 38 create smaller files with more visible compression.

4) To change the output dimensions before encoding, add a scale filter:

ffmpeg -i input.mp4 -ss 00:00:01 -frames:v 1 -vf "scale=1280:720:force_original_aspect_ratio=decrease" -c:v libaom-av1 -still-picture 1 -crf 32 output.avif

The force_original_aspect_ratio option prevents unwanted stretching when the source shape does not match the requested dimensions.

5) If your FFmpeg build uses SVT-AV1 instead, a corresponding command may be:

ffmpeg -i input.mp4 -ss 00:00:01 -frames:v 1 -c:v libsvtav1 -still-picture 1 -crf 32 output.avif

Encoder option names are not universal. Run ffmpeg -h encoder=libaom-av1 or the matching help command for your selected encoder before changing advanced settings.

Check the output

Open the generated AVIF in a current browser or image viewer. If the image appears with the expected frame, colors, and dimensions, the conversion worked. Some older image viewers do not support AVIF, so a browser is often the most reliable preview tool.

For file properties, run ffprobe output.avif to read the encoded format and pixel dimensions. This verifies that the result is an AVIF still image rather than a video stream or an accidentally empty file.

AVIF is designed for photographic and illustrated stills, not live video. Converting a long MP4 into many AVIF files is possible but produces a sequence of still images, not a playable AVIF video. Expect larger AVIF outputs when the source frames have fine detail or when low CRF values are used.

Common problems and next steps

The command runs but the output is empty or a single black frame

Check that the input timestamp exists within the MP4 duration. Use ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 input.mp4 to confirm the length, then choose an earlier timestamp.

The encoder reports that libaom-av1 is unavailable

Use the encoder names listed by your FFmpeg build. If no AV1 encoder is present, install a newer FFmpeg package that includes AV1 support or build it with the required encoding library.

The resulting AVIF file is much larger or softer than expected

Raise the CRF value to increase compression, or lower it to preserve more detail. Scaling down the frame before encoding is usually the most effective way to reduce a large still image.

Reverse direction: AVIF to MP4

AVIF to MP4 requires turning one or more still frames back into a video. For a single AVIF image, use FFmpeg to encode a short MP4:

ffmpeg -i image.avif -c:v libx264 -pix_fmt yuv420p -t 5 output.mp4

The -t 5 option specifies a five-second video from the still image. For a sequence of AVIF files, first check that the filenames form a clean ordered sequence before attempting to combine them.