Batch transcode a folder of videos with Handbrake's CLI
I've used Handbrake for years, to transcode practically any video file—including ripped DVDs and Blu-Rays—so I can watch the videos on practically any device. It's especially helpful for .mkv files, which can have a hodgepodge of video formats inside, and are notoriously difficult to play back, especially on older or more locked down playback devices.
But Handbrake's achilles heel, as a GUI-first application, is in a lack of easy batch operation. You can queue videos up one at a time, which is nice, but more recently, as I've ripped more TV seasons onto my NAS, I've wanted to transcode 5, 10, or 20 files at a time.
Enter HandBrakeCLI. Assuming you're on a Mac and installed Handbrake already (e.g. with
brew install --cask handbrake), download
HandBrakeCLI, mount the downloaded disk image, and copy the executable into a system path:
sudo cp /Volumes/HandBrakeCLI-1.5.1/HandBrakeCLI /usr/local/bin/
Then you can use it to loop over an entire directory—even recursively—and transcode all the video files within.