Skip to content

Instantly share code, notes, and snippets.

@bmitchinson
Created February 6, 2025 00:28
Show Gist options
  • Save bmitchinson/8c3fcdc5909b1e968a9f71996d939c3f to your computer and use it in GitHub Desktop.
Save bmitchinson/8c3fcdc5909b1e968a9f71996d939c3f to your computer and use it in GitHub Desktop.
Handbreak CLI command to export all titles
#!/bin/bash
set -e
if [ "$#" -ne 2 ]; then
echo "Usage: $0 example_file.iso destination_folder"
exit 1
fi
src="$1"
dest="$2"
mkdir -p "$dest"
for t in $(~/bin/HandBrakeCLI -i $src -t 0 2>&1 | grep -o 'title [0-9]\+' | awk '{print $2}' | sort -u); do
echo "exporting title ${t} to $dest/title_${t}.mp4"
~/bin/HandBrakeCLI -i $src -t $t -o "$dest/title_${t}.mp4"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment