Codementor Events

H.265 (HEVC), WEBM, and AVIF with alpha channels from one source file.

Published Mar 10, 2023

Making the latest format animated content for deployment on websites, with alpha channels and animation isn't always easy. So to save you some hassle in future, just use the code below.

That's why we made this bash script:

for FILE in input-prores; do
    fbname=$(basename "$FILE" | cut -d. -f1)
    echo "Creating HEVC for $fbname";
    avconvert --preset PresetHEVC3840x2160WithAlpha --source $fbname --output output/$fbname-hevc.mp4;
    echo "Creating WEBM for $fbname using ffmpeg";
    ffmpeg -i $FILE -c:v libvpx-vp9 -b:v 0 -crf 30 -c:a libopus -b:a 128k -strict -2 output/$fbname-webm.webm;
     echo "Creating AVIF for $fbname using ffmpeg";
    ffmpeg -i $FILE -c:v libaom-av1 -crf 30 -b:v 0 -strict -2 output/$fbname-avif.avif;
done

That will turn mov files with alpha channels into animated web ready content in all 3 formats. Good luck!

Discover and read more posts from John Dodds
get started
post commentsBe the first to share your opinion
Show more replies