Skip to content

Instantly share code, notes, and snippets.

@jorgemrisco
Last active August 7, 2021 19:18
Show Gist options
  • Save jorgemrisco/86e66cff9740842e35c98ff2a31f030f to your computer and use it in GitHub Desktop.
Save jorgemrisco/86e66cff9740842e35c98ff2a31f030f to your computer and use it in GitHub Desktop.
Handbrake script to convert all videos inside a folder (must have `HandBrakeCLI` installed)
#!/bin/bash
SRC="$1"
DEST="$2"
DEST_EXT=mp4
HANDBRAKE_CLI=HandBrakeCLI
PRESET="Chromecast 1080p30 Surround"
for FILE in "$SRC"/*
do
echo $FILE
filename=$(basename "$FILE")
extension=${filename##*.}
filename=${filename%.*}
$HANDBRAKE_CLI -i "$FILE" -o "$DEST"/"$filename".$DEST_EXT --all-subtitles --preset="$PRESET"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment