Skip to content

Instantly share code, notes, and snippets.

@ice-blaze
Last active September 10, 2017 21:04
Show Gist options
  • Save ice-blaze/c9d990e10dfdcc3ffcdeeb016b3c16c5 to your computer and use it in GitHub Desktop.
Save ice-blaze/c9d990e10dfdcc3ffcdeeb016b3c16c5 to your computer and use it in GitHub Desktop.
#!/bin/bash
IFS=$'\n'; set -f
for filepath in $(find ./ -name '*.avi' -or -name '*.mp4' -or -name '*.wmv'); do
if [[ $filepath == *".ignore"* ]]; then
continue
fi
dir=$(dirname $filepath)
base=$(basename $filepath)
encodeFolder="$dir/encode/"
mkdir -p "$encodeFolder"
HandBrakeCLI -i "$filepath" -o "$encodeFolder${base%.*}.mp4" -e x265 -q 20 -B 160
done
unset IFS; set +f
# TODO replace the generate with original only if they are the same size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment