Skip to content

Instantly share code, notes, and snippets.

@thedava
Last active February 6, 2024 00:18
Show Gist options
  • Save thedava/95ed199d8dd966c9bd8d4a8bcde9acc8 to your computer and use it in GitHub Desktop.
Save thedava/95ed199d8dd966c9bd8d4a8bcde9acc8 to your computer and use it in GitHub Desktop.
Create thumbnails for all video files in directory using ezthumb
#!/usr/bin/env bash
# https://sourceforge.net/projects/ezthumb/
function create_thumbnail {
ext="$1"
find . -type f -name "*.${ext}" -printf '%h\0' | sort -zu | while IFS= read -r -d '' dir; do
ezthumb --grid 8x5 --format "jpg@99" "${dir}/*.${ext}"
#echo "${dir}/*.${ext}"
done
}
# find . -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -u
declare -a extensions=('MKV' 'avi' 'flv' 'm4v' 'mkv' 'mov' 'mp4' 'mpeg' 'wmv')
# (Re)Create thumbnails
find . -type f -regex '.*_thumb\(\.[0-9]+\)?\.jpg' -delete
for ext in "${extensions[@]}"; do
#echo "${ext}"
create_thumbnail "${ext}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment