I am trying to make a simple bash script for a command so i can make it reusable for me the command has been taken from another post to convert videos with ffmpeg then upload.
Here is what i have so far.
#!/bin/bash
MOVIES=$1
EXT=$2
BUCKET=$3
find "$MOVIES" -name "*.$EXT" -exec sh -c 'ffmpeg -i "$0" -c:v libx264 -crf 22 -c:a libfaac -movflags faststart "${0%%.mov}.mp4" && s3cmd put "${0%%.mov}.mp4" "$BUCKET""$(basename "${0%%.mov}.mp4")"' {} \;
exit;
I am having issues with the third var if i run it like this.
sh batch.sh ~/Documents/screengrabs/ mov s3://bucket/
I am getting a error it encodes properly.
ERROR: Parameter problem: Destination must be S3Uri. Got: file://49A22352-9F41-48B9-BF97-610CBF699025-630-0000055828D0D55F.mp4
This means it is not parsing the $3 parameter $BUCKET properly.
Any help this is my first bash script attempt.
Thanks
Update still not working
#!/bin/bash
MOVIES="$1"
EXT="$2"
BUCKET="$3"
find "$MOVIES" -name "*.${EXT}" -exec sh -c 'ffmpeg -i "$0" -c:v libx264 -crf 22 -c:a libfaac -movflags faststart "${0%%.mov}.mp4" && s3cmd put "${0%%.mov}.mp4" "${BUCKET}/sam.mp4"' {} \;
exit;
WORKING
#!/bin/bash
MOVIES=$1
EXT=$2
export BUCKET=$3
find "$MOVIES" -name "*.$EXT" -exec sh -c 'ffmpeg -i "$0" -c:v libx264 -crf 22 -c:a libfaac -movflags faststart "${0%%.mov}.mp4" && s3cmd put "${0%%.mov}.mp4" "$BUCKET""$(basename "${0%%.mov}.mp4")"' {} \;
exit;
echo "$BUCKET"output if you put it just before thefindcommand?