This repository provides a tutorial and script for converting .mp4
videos to .avif
animations. It's a GitHub representation of the blog post available at: Converting an MP4 to an Animated AVIF.
- Better quality
- Smaller file sizes
- Faster page loads
Ensure you have ffmpeg
and libavif
installed. For MacOS users, you can use brew
:
brew install ffmpeg libavif
- Navigate to the directory where your
.mp4
file is saved. - Use the provided script to convert your mp4 file to avif:
./script/mp4_to_avif.sh path_to_your_file.mp4
For example:
./script/mp4_to_avif.sh /Users/videos/input.mp4
Note: Ensure that both ffmpeg
and libavif
are installed and available in your PATH for the script to work properly.
As of writing this, MacOS doesn't natively support viewing animated AVIF files. If you try opening the file using MacOS' native Preview app, you'll see a static frame. To properly view the animated AVIF file, consider using third-party solutions like the IINA media player, or viewing in a supported browser.
For convenience, a bash script mp4_to_avif.sh
is provided within this repository to automate the conversion process. Ensure you've made the script executable with chmod +x mp4_to_avif.sh
before using.