I want to show you how to shrink your video and guarantee its quality. And I’m going to do that with something called Constant Encoding, using an open-source tool called Handbrake.
Quality, not quantity
I’ll start with a minute-long 4K/UHD video that is the type of file you’d get out of a GoPro or other action camera. It’s currently 490 MB (half a gigabyte!), but I’m going to use Handbrake to shrink it down to 12MB.
While I’m going to use Handbrake for this project, you could achieve the same effect using other tools like the flexible Shutter Encoder. Typically, professional encoding tools like Apple Compressor or Adobe Media Encoder, don’t approach encoding in the same way. They focus on how large a file will be.
What I care about is the quality. Instead of focusing on size, I want quality to be the critical factor. Handbrake/Shutter Encoder and FFMPEG have this capability—and they’re all free tools!
Choosing encoding settings in Handbrake
When you bring a video into Handbrake, it’s easiest to start the process by using one of the presets Handbrake provides. This will guarantee that the resolution and frame rate of your video output matches the source. For my project, I used the Preset called Production Standard as my starting point.
Nearly any time you compress video, you’ll experience some quality loss. Handbrake lets you choose encoding settings specifically based on how much quality you want to retain. On the Video Tab, you’ll see a Quality setting. It goes from 51, super damaged, to 0, nearly lossless.
For HD (1920×1080 or 1280×720) video, the Quality sweet spot is around 18-23. For UHD (3840×2160) video, you can go up to 28.
Handbrake’s default codec, H.264, is excellent, and compatible with nearly every phone and tablet. For higher-quality compression at lower bitrates (reduced file size), you can use HEVC (aka H.265). But keep in mind that it’s less compatible with older hardware.
The final setting that determines the size of your exported video file (and, of course, how long the encoding will take0 is the preset slider for Speed. Your choices are as follows:
- Ultra fast
- Super fast
- Very fast
- Very slow
The slower the speed, the smaller the file. You should never use Placebo for video you plan to distribute online because that’s meant just for internal testing.
My encoding settings
At a setting of 23, I got a couple of interesting results. Fast with H.264 took 3 minutes, and shrank the file to 105 MB, one-fifth its original size. Not bad.
Fast HEVC took 5 minutes and reduced the file size to 37 MB. That’s almost 1/20th of the file’s original size.
I tested several other settings, with fairly predictable results comparable to those above, but one result surprised me. Ultrafast HEVC took only 2 minutes, but gave me a smaller file than any of the other choices. The Ultrafast HEVC file came in at 22MB—1/22nd of the original. It did better than Slow, Slower, or Very Slow.
That’s strange. Ultrafast should have been larger than any other choice.
Pushing the envelope for UHD
I did most of my tests at a Quality setting of 23. But since this source was UHD, for my final test, I wanted to push the envelope a little further by increasing my Quality setting to 28, Ultrafast.
What did I get?
At Quality 28, Ultrafast, Handbrake compressed my 490MB file to 12MB, which means that it was small enough to send it to someone by email. To a video pro, accustomed to working with massive files, that’s crazy.
In summary, Constant Quality encoding prioritizes quality, and output file size is dictated by the speed of the encoding. By using Handbrake—a free, open-source tool—I was able to shrink my video fast, and make it as small as I needed while retaining the quality.
(Footnote: As a media nerd, I’ll let you know the original was in the H.264 codec, 23.976 fps, at 65 Mb/s. The final file was in HEVC at 1.5 Mb/s. Contact me if you want more details)