Created
July 20, 2020 09:34
-
-
Save MattLoyeD/f6289000742a29ee68cca2b9fa5f78e7 to your computer and use it in GitHub Desktop.
Make thumbnail and compress mp4 video for web use
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# $1 = Filename | |
# $2 = S3 Bucket Name | |
base=$(basename -- "$1") | |
extension="${base##*.}" | |
filename="${base%.*}" | |
# p720="./videos/720p/$filename.mp4" | |
p1080="./videos/1080p/$filename.mp4" | |
png="./videos/jpg/$base.png" | |
jpg="./videos/jpg/$filename.jpg" | |
#/usr/local/bin/HandBrakeCLI -Z "Vimeo YouTube HQ 720p60" -i "$1" -o $p720 | |
/usr/local/bin/HandBrakeCLI -Z "Vimeo YouTube HQ 1080p60" -i "$1" -o $p1080 | |
/usr/bin/qlmanage -t "$1" -s 1080 -o "/videos/jpg/" | |
/usr/local/bin/magick convert $png $jpg | |
rm $png | |
if [ -n "$2" ]; then | |
bucket=$2 | |
#s3cmd put --acl-public --guess-mime-type $p720 "s3://$bucket/720p/$base" | |
s3cmd put --acl-public --guess-mime-type $p1080 "s3://$bucket/1080p/$base" | |
s3cmd put --acl-public --guess-mime-type $jpg "s3://$bucket/jpg/$filename.jpg" | |
fi | |
echo "$base"; | |
echo "$filename.jpg; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Kudos to https://tyler.io/diy-video-hosting/ for the ressource