Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@iemcd
Created May 8, 2020 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iemcd/81ec4cff765d9830efdd6dd574140516 to your computer and use it in GitHub Desktop.
Save iemcd/81ec4cff765d9830efdd6dd574140516 to your computer and use it in GitHub Desktop.
A script to run ffmepgthumbnailer on a cron job (needs arguments supplied)
#!/bin/bash
shopt -s nocasematch
function thumbnail
{
local FILE
for FILE in "$@"
do
# echo "$FILE"
# if [[ -d "$FILE" ]]
# then
# thumbnail "$FILE/*"
if [[ "$FILE" = *.mkv ]] || [[ "$FILE" = *.mp4 ]] || [[ "$FILE" = *.mov ]]
then
# echo "$FILE"
local mvname=${FILE:0:-4}
# echo "$mvname"
local imname="${mvname}.jpg"
# echo "$imname"
if ! [[ -f "$imname" ]]
then
echo "Thumbnailing $mvname"
ffmpegthumbnailer -i "$FILE" -o "$imname" -s 160
fi
fi
done
}
thumbnail "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment