Skip to content

Instantly share code, notes, and snippets.

@janvojt
Last active August 15, 2022 20:44
Show Gist options
  • Save janvojt/5cb21102b52fc228e5eb94895724ff62 to your computer and use it in GitHub Desktop.
Save janvojt/5cb21102b52fc228e5eb94895724ff62 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# This script will compress videos from GoPro Hero 5 using h.265 codec.
USAGE="Usage: $0 file1 file2 ... fileN"
if [ "$#" == "0" ]; then
echo "$USAGE"
exit 1
fi
while (( "$#" )); do
srcFile="$1"
dstFile=$(echo "$srcFile" | sed 's/\.mp4$//i')".m4v"
echo "Converting '$srcFile' into '$dstFile' ..."
HandBrakeCLI -i "$srcFile" -o "$dstFile" -e x265 -q 14 -r 30 -B 128
echo "Done converting '$srcFile' into '$dstFile'."
shift
done # end while
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment