sitewww/casamento/thumbnails.sh
vinicius 2ac0e030e0
Some checks failed
Deploy para Servidor de Produção / Deploy para (push) Has been cancelled
Deploy para Servidor de Produção / Determinar ambiente de destino (push) Failing after 5415h48m32s
update contendo a galeria do casamento
2026-01-18 16:03:22 -03:00

32 lines
999 B
Bash
Executable file

#!/bin/bash
# Generate video thumbnails for all videos in conteudo directories
# Requires: ffmpeg
CONTENT_DIR="./conteudo"
echo "Generating video thumbnails..."
# Find all video files
find "$CONTENT_DIR" -type f \( -iname "*.mp4" -o -iname "*.mov" -o -iname "*.avi" -o -iname "*.webm" -o -iname "*.mkv" \) | while read video; do
# Get the thumbnail path (same name but .jpg)
thumbnail="${video%.*}.jpg"
# Skip if thumbnail already exists
if [ -f "$thumbnail" ]; then
echo " ⏭ Skipping (exists): $(basename "$thumbnail")"
continue
fi
echo " ⚡ Generating: $(basename "$thumbnail")"
# Extract frame at 1 second (or first frame if video is shorter)
ffmpeg -i "$video" -ss 00:00:01 -vframes 1 -q:v 2 "$thumbnail" -y 2>/dev/null
# If that failed (video too short), try first frame
if [ $? -ne 0 ]; then
ffmpeg -i "$video" -vframes 1 -q:v 2 "$thumbnail" -y 2>/dev/null
fi
done
echo "✓ Done! Video thumbnails generated."