misc/bash/thumbnailify.sh

39 lines
840 B
Bash
Executable File

#!/bin/bash
# NO SPACES, it's haaaard T_T
if [ ! -f "$@" ]; then
echo "file to thumbnailify plz"
return
fi
fullfilename=$(basename -- "$@")
extension="${fullfilename##*.}"
filename="${fullfilename%.*}"
pushd $(dirname "$@")
if [ -f "$filename""_thumbless.$extension" ]; then
echo "there's already a _thumbless in here... I think i'm already done?"
exit 1
fi
if [ -f "testframe.mp4" ] || [ -f "thumbnailism.txt" ]; then
echo "my temp files are already here... I think i'm redundant?"
exit 1
fi
echo "file testframe.mp4" > thumbnailism.txt
echo "file $fullfilename" >> thumbnailism.txt
ffmpeg -i "$fullfilename" -ss 3 -t 0.01666 testframe.mp4
ffmpeg -f concat -i thumbnailism.txt -c copy output.mp4
mv "$fullfilename" "$filename""_thumbless.$extension"
mv output.mp4 "$fullfilename"
rm thumbnailism.txt
rm testframe.mp4
popd