Skip to content

Instantly share code, notes, and snippets.

@geerlingguy
Created October 24, 2022 14:13
Show Gist options
  • Save geerlingguy/b21cc38430d06d39df82b0ab4f6c7d00 to your computer and use it in GitHub Desktop.
Save geerlingguy/b21cc38430d06d39df82b0ab4f6c7d00 to your computer and use it in GitHub Desktop.
Handbrake CLI batch transcoding script
#!/bin/bash
#
# This script requires HandBrakeCLI. On macOS, at least, you need to download
# and install it separately from Handbrake.
#
# See: https://handbrake.fr/downloads2.php
if [ -z "$1" ] ; then
TRANSCODEDIR="."
else
TRANSCODEDIR="$1"
fi
# Change the preset if you like (see options: "HandBrakeCLI --preset-list")
# If you want to transcode ALL movie files, remove the -name option.
find "$TRANSCODEDIR"/* -type f -name "*.mkv" -exec bash -c 'HandBrakeCLI -i "$1" -o "${1%\.*}".mp4 --preset="General/HQ 1080p30 Surround"' __ {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment