handbrake

Limiting Handbrake threads to prevent throttling on M2 Macbook Air

Due to a recent surgery, I've been recovering at a location outside my home for a few weeks. I brought all my media with me on a spare hard drive, but one movie I had ripped but never transcoded wouldn't play on the 'Smart' TV here.

It seems to do okay with some H.264 profiles, but not the one for this 4K Blu-Ray rip. Therefore, I thought I'd transcode the file so it would play.

I also wanted to do other work on my laptop—in my lap. And unfortunately for Apple's latest M2 MacBook Air, there's no fan or heat sink to keep the M2 SoC cool.

And that meant the temperature around the top middle of the keyboard—and the bottom middle of the laptop—got quite uncomfortably hot with Handbrake's default settings, which would max out the CPU during the transcoding process.

I could encode anywhere between 10-18 fps at 4K resolution with x264, but the SoC temperature rose to 105°C and was uncomfortably hot within a minute or so.

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.