Skip to content

Instantly share code, notes, and snippets.

@blacktaxi
Created August 9, 2015 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blacktaxi/2a4a120e35a5c5c012e1 to your computer and use it in GitHub Desktop.
Save blacktaxi/2a4a120e35a5c5c012e1 to your computer and use it in GitHub Desktop.
Save space on HD phone videos
#!/bin/bash
# this script recodes phone videos to a lower bitrace encoding to save space.
# phones typically encode at a very high bitrate because they don't have enough
# CPU power to do a more compressed encoding in real time.
# generally this recoding does not affect perceived video quality.
# USAGE: encodevid.sh [path]
QUALITY=26.0
INPATH=$1
OUTPATH="${1%*.}-recoded-at-$QUALITY.${1##*.}"
echo "Recoding $INPATH -> $OUTPATH with q=$QUALITY..."
/Applications/HandBrakeCLI \
--format av_mp4 --encoder x264 \
--encoder-tune film --vfr \
--quality $QUALITY --aencoder \
copy --keep-display-aspect \
-i "$INPATH" -o "$OUTPATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment