Skip to content

Instantly share code, notes, and snippets.

@xyvs
Last active June 23, 2020 04:21
Show Gist options
  • Save xyvs/dccbce39ec4ee718996973c9eca2771b to your computer and use it in GitHub Desktop.
Save xyvs/dccbce39ec4ee718996973c9eca2771b to your computer and use it in GitHub Desktop.
#!/bin/bash
####################
# Thumbnail Maker - V1.0
# Usage: thumbnailmaker video.mp4 | thumbnailmaker video.mkv 10
# Author: https://gist.github.com/xyvs
####################
if [ "$1" ]; then
image () {
percent=$(echo $RANDOM % 80 + 10 | bc)
filename="thumbnails/$filename-$percent.png"
ffmpegthumbnailer -i "$1" -s 0 -q 10 -t $percent -o "$filename"
}
# Make Folder
filename="${1%.*}"
if [ -d "thumbnails" ]; then
echo "[NFO] Folder Exists"
else
mkdir "thumbnails"
fi
# Make Image/s
if [ "$2" ]; then
for $(seq $2); do
image $1
done
else
image $1
fi
echo "[DONE] Your files are available at $(pwd)/thumbnails"
else
echo "[USAGE] thumbnailmaker video.mp4 | thumbnailmaker video.mkv 10"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment