Resize all pictures in a folder and create WebM video in Linux Bash with ffmpeg

2020-11-10

Few days ago I wrote about how to Resize all pictures in a folder and create animated GIF in Linux Bash with ImageMagick. Checking the page speed with Google Lighthouse the speed score was terrible. So I followed the instructions and tried to do better. Here are the commands for creating WebP format rather than GIF. I am still not able to embed the WebP format in an easy way on this blog. But I will try to do so next time.

  1. Install ffmpeg

    sudo apt install imagemagick
    sudo apt install ffmpeg
    
  2. Resize all JPG images starting with PXL in a originals folder to 30% of its original size to downscaled folder

    cd ~/downloads
    convert originals/PXL*.jpg -resize 30% downscaled/PXL.jpg
    
  3. Create ffmpeg-list.txt file as a list of files for ffmpeg

    ls downscaled/*.jpg | sort -V | xargs -I {} echo "file '{}'" > ffmpeg-list.txt
    
  4. Create a WebM of all JPG images

    ffmpeg -r 25 -f concat -i ffmpeg-list.txt -c:v libvpx-vp9 -pix_fmt yuva420p wooden-house-construction.webm
    
EnglishProfessionalLinuxDebianBashImageProcessing

↩︎ Resize all pictures in a folder and create animated WebP in Linux Bash with webp

↩︎ Resize all pictures in a folder and create animated GIF in Linux Bash with ImageMagick