A quick introduction to HandBrakeCLI:
The CLI is Your Friend:
Don't be put off by the CLI bit, once you have the basic command stored in your ~/.bashrc all you have to do is recall the command with a couple of letters, I use "hb" & edit it to suit your project, which is as simple as can be.
I've jumped the gun a bit here, so for those that don't know HandBrake - be it the CLI or GUI version - is a brilliant media ripping tool. If you have a pile of DVD's & you want to rip them to .mp4 or .mkv format, to create a library stored on a HDD, then this is the tool for you.
To see the broad brush picture of what HandBrake can do, have a look at this page.
It also rips to a variety of predefined presets.
HandBrake Loves You to the Core(s):
HandBrake is very intelligent when it comes to using your CPU power, the more cores you have the quicker it does the job. Roughly 1.5hrs on my old iMac core2duo 2.4Mhz, 1GB RAM, which is better than twice as fast as my Athlon64 3500+ single core job with 2GB RAM.
Subtitles? Bring them On:
These days Handbrake handles soft subtitles for both .mp4 & .mkv, it has a plethora of subtitle options which I won't go into here. Suffice it to say that we can now have multiple subs to choose from, that's if we want to use any at all. This is vastly superior to having them hard coded into the movie as was the case with the previous version.
Meet My Alias:
When I use HandBrakeCLI to backup a DVD onto my HDD, I first change directory to where I want the HandBrakeCLI's output to go. I do this via a ~/.bashrc alias as seen below, have a read of it:
#------------------------ # Handbrake & associated: #------------------------ # The following alias ".tmp" allows me in # four keystrokes to changes directory to # where I want HandBrakeCLI's output to # be saved: alias .tmp="cd /mnt/store/pkg/vid/.tmp" # The following alias doesn't do anything but # echo the looong command to the Terminal # window where it can be copied, pasted & # edited for use: alias hb="echo HandBrakeCLI -t 0 -i /media/dvd -o NAME.HERE.mp4 -e x264 -b 1000 -B 192 -s 1 --subtitle-burn # This alias brings up the HandBrakeCLI help: alias hbhelp="HandBrakeCLI --help"
Use Your Alias:
Then I call my HandBrakeCLI command line (which I could never remember) via another ~/.bashrc alias as seen above. Once that command line is echoed to the Terminal, I copy it to the prompt & edit the NAME.HERE.mp4 as seen above in the command line, to the name of the movie.
Finding the Main-Feature:
Then I run the command (by typing hitting the Enter key);- which by using the -t 0 option, it quickly scans the source for titles & displays what it finds as it goes, giving each title a number & showing information about it, most importantly how long it runs for.
I use the length of the title to discern which is the main title & then recall the previously used HandBrakeCLI command line using the curser key & changing the -t 0 to -t 3 or whatever number had the longest run time (if I was after the main feature).
More than One Way to Do It:
Another way to get the main feature is to use the --main-feature argument instead of the -t <number> parameter like so (though I have found this to be unreliable sometimes & the previous method is not):
HandBrakeCLI --main-feature -i /media/dvd -o NAME-HERE.mp4 -e x264 -b 1000 -B 192 -N eng -s1"
Both of the command lines shown for HandBrakeCLI share the -b 1000 video bitrate setting (which is the default these days) which gives me on average about a 1GB sized movie ripped from a dual layer DVD.
I won't list all of the options available for HandBrakeCLI here, as there are a lot of them, & anyone who has HandBrakeCLI just has to enter HandBrakeCLI --help at the command prompt to see them.
Here is a link to the official how-to page for HandBrakeCLI, which is currently up to date. It has all of the command line options & more listed & explained.