Skip to content

Instantly share code, notes, and snippets.

@ryanfb
Last active February 28, 2019 00:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanfb/ee31af4bf611ff707d9b to your computer and use it in GitHub Desktop.
Save ryanfb/ee31af4bf611ff707d9b to your computer and use it in GitHub Desktop.
#!/bin/bash
rawout=$(HandBrakeCLI -i /dev/cd0 -t 0 2>&1 >/dev/null)
#read handbrake's stderr into variable
count=$(echo $rawout | grep -Eao "\\+ title [0-9]+:" | wc -l)
#parse the variable using grep to get the count
for i in $(seq $count)
do
HandBrakeCLI --input /dev/cd0 --title $i --output $1-$i.mkv -e x265 -q 23 --encoder-preset slow -E av_aac --custom-anamorphic --keep-display-aspect -O -Neng -sscan --decomb
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment