Backup DVD Using HandBrakeCLI

Making copies of your DVD movies into MKV format has never been easier thanks to HandBrake.

Below is a small shell script that uses HandBrakeCLI to save the longest title and Swedish subtitle into MKV format.

1
2
3
4
5
6
7
8
9
#!/bin/bash
# This is a simple shell script which will 
# grab the longest title and Swedish subtitle and 
# then encode it as MKV
#
TITLE=`lsdvd -c | grep "Disc Title" | gawk '{
       print tolower($3);
}'`
HandBrakeCLI -f mkv -N swe -m -i /media/cdrom/VIDEO_TS -o $TITLE.mkv -e ffmpeg -b 2000 -B 192 --longest

Later versions of HandBrakeCLI uses the commandline option –main-feature instead of –longest.