Home โ Convert all PNGs in a folder to WEBP with FFmpeg
Convert all PNGs in a folder to WEBP with FFmpeg
By Alexander Kuzmenok ยท Node.js & JavaScript developer
Published January 19, 2023
FFmpeg is an awesome tool that can convert not only videos but also audio and images.
On Linux and Mac, run it like this in the folder where you want the conversion to run:
for i in *.png; do ffmpeg -y -i "$i" -c:v libwebp "${i%.*}.webp"; done
On Windows:
FOR /F "tokens=*" %G IN ('dir /b *.png') DO ffmpeg -y -i "%G" -c:v libwebp "%~nG.webp"
Resources:
- FFmpeg https://ffmpeg.org/download.html
- Stackoverflow solutions https://stackoverflow.com/questions/5784661/how-do-you-convert-an-entire-directory-with-ffmpeg