Created
April 19, 2017 04:34
-
-
Save petertwise/1782f332f0ae46d04d5b9d571d23d9b6 to your computer and use it in GitHub Desktop.
Custom Elastic Transcoder Script for Bang on a Can by Square Candy
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 | |
# Custom Elastic Transcoder Script for Bang on a Can by Square Candy | |
# Check for valid input | |
[[ "$1" && "$2" && "$3" ]] || { printf "Missing command arguments.\nUsage: awsconvert [audio/video] file-name_base ext\n" >&2; exit 1; } | |
[[ $1 = audio || $1 = video ]] || { printf "First argument must be either 'audio' or 'video'\nUsage: awsconvert [audio/video] file-name_base ext\n" >&2; exit 2; } | |
[[ $2 != *[^a-z0-9\_-]* ]] || { printf "Error: filename argument must contain only lowercase letters, numbers, underscores and dashes.\nUsage: awsconvert [audio/video] file-name_base ext\n" >&2; exit 3; } | |
case "$1" in | |
'audio') | |
pipeline='1490209636517-e047sq' | |
;; | |
'video') | |
pipeline='1488564832779-r6d2jn' | |
;; | |
esac | |
printf "ok. requesting transcoding:\n$2.$3 through pipeline $pipeline\n\n" | |
aws elastictranscoder create-job --pipeline-id $pipeline --input '{"Key":"'$2'.'$3'"}' --outputs '[{"Key": "'$2'_", "PresetId": "1351620000001-200010", "SegmentDuration": "10"}]' --output-key-prefix "$2/" --playlists Name=$2,Format=HLSv3,OutputKeys=$2_ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment