Last active
November 14, 2018 04:25
-
-
Save dev01d/3fbd34b3e27838adb5d486d58cec6b04 to your computer and use it in GitHub Desktop.
This script automatically converts a directory of video files to H.265 HEVC with HandBrake and deletes the old files.
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 | |
# | |
# This script automatically converts a directory of video files to H.265 HEVC with HandBrake and deletes the old files. | |
# | |
if [ -z "$1" ]; then | |
SRC="." | |
else | |
SRC="$HOME/$1" | |
fi | |
find "$SRC" -iregex '.*\.\(mkv\|avi\)$' -exec bash -c 'HandBrakeCLI -i "$1" -o "${1%\.*}".mp4 -e x265 -q 22 -E av_aac --custom-anamorphic --keep-display-aspect' __ {} \; && find "$SRC" -iregex '.*\.\(mkv\|avi\)$' -exec rm -r {} \; | |
# | |
## Desktop notification | |
# | |
unameNote="$(uname -s)" | |
case "${unameNote}" in | |
Linux*) | |
notify-send "Encode complete." | |
;; | |
Darwin*) | |
osascript -e 'display notification "Encode complete." with title "HEVC Conversion"' | |
;; | |
*) | |
machine = "UNKNOWN:${unameOut}" | |
esac | |
echo ${desktopNotify} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment