#!/usr/bin/env bash

# on Windows, you can use MSYS MINGW64 to do this

for video_file in $(ls videos/*.{webm,mp4}); do
    video_filename=$(basename -- "${video_file}")
    thumbnail_filename="videos/${video_filename%.*}_thumbnail.jpg"
    if [[ ! -e "${thumbnail_filename}" ]]; then
    	ffmpeg -i "${video_file}" -s 480x270 -q:v 2 -frames:v 1 -y "${thumbnail_filename}"
    fi
done

