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.

Streaming services lost the plot

Do you remember when Netflix first started their movie streaming service, back in 2007?

2007 era Netflix home page courtesy of the Wayback Machine

Physical media was still the preferred way to consume media. Besides sports content, and some TV shows that were cable-exclusive for a time, most people would run by Blockbuster and pick up a movie.

Netflix started with mail-order DVDs, then switched to streaming. The absence of ads (which were rampant on cable channels) and the convenience of not having to drive to a physical store (Blockbuster et all) made Netflix a no-brainer, especially considering the depth of their initial library.

How I rip DVDs and Blu-Rays into my Mac (2022 Edition)

It's been more than a decade since I wrote Ripping Movies from Blu-Ray, HD-DVD and DVD, Getting them onto Apple TV, iPad, iPhone, etc.. Heck, back then I didn't write everything as a 'blog post'—that was labeled as an 'article' :P

In a surprising twist of fate, we went from a somewhat more centralized online media situation back then (basically, Netflix) to a hellscape of dozens of streaming services today. And in many cases, older movies can only be found as used and/or pirated DVDs on eBay!

Thus, I'm writing a fresh guide to how I rip DVDs and Blu-Ray discs into my Mac, then transcode them with Handbrake. Heck, some people who are deeper into the r/datahoarder rabbit hole even have dedicated transcoding servers so they can generate optimal archival copies in 4K, 1080p, etc. akin to how YouTube and other online platforms set up their files!

But for me, the basic process goes:

Convert .MTS file to .MOV or .MP4 on a Mac (for iMovie, etc.)

I recently received a few .mts files from a friend. These files are AVCHD high-definition video files from consumer-grade HD video cameras, and they've traditionally been a pain to work with.

If you have the files on your camcorder or an SD card from your camcorder, you can just open up iMovie '08 or iMovie '09 and click 'import from camera.' It'll take forever to transcode the files into something iMovie can use, but it will work. If, however, you're like me and you just have the files (no camcorder), you'll need to transcode the files before you can edit them or compress them further.

The easiest way to do this, in my experience, is to use Handbrake, the best/simplest transcoding software you can get on the Mac... and it's free! Don't pay any money for fancy GUI wrappers like the ones you'll find on mtsconverter.com, applemacvideo.com, mtsconvertermac.biz, etc... these are all ripoffs of ffmpeg, a free and open source video transcoding library.