If you like keeping videos around after you’ve watched them, soon you will find yourself running out of storage space. When in this tight spot, you have three options: buy more hard disk drives to expand your available storage, delete the files, or start re-compressing them to reduce their size.
The last solution is the best for most people, as you keep access to the content without having to buy new hardware. The ideal way to do it would be by treating each video as a separate entity, specifying different parameters for its encoding. Thankfully, there’s a more straightforward way to approach this.
You can create different compression quality profiles within Handbrake. After that, you’ll be able to encode any video by loading it up into Handbrake, choosing the desired quality preset, and clicking “Encode.”
If you are using Linux, most distributions today come with Handbrake in their repository so you can install them easily. On Debian/Ubuntu-based distro, use the following command:
Or you could use the Software Center / App Store / Package Manager Front-End of your distribution, search for Handbrake’s name and click on “Install.”
For Windows or Mac users, you can download Handbrake from its Downloads page.
Load your first test file
To set everything up, it’s better if you use a video file with excellent image quality and short duration. Each recompression will also lead to a reduction in quality, so having a good quality original will help in preserving more detail and judging how the results could look for more files.
Move to the Picture tab of Handbrake’s encoding settings. Here you can find the parameters that affect each frame’s size and geometry. Set the settings as:
- Auto Crop: Enabled
- Loose Crop: Disabled
- Filters: ALL off
- Storage Geometry
- Width & Height: Ignore for now
- Optimal for source: Disabled
- Anamorphic: Loose
- Alignment: 2
- Display Geometry: Nothing to do here (everything should be non-tweakable by default)
Proceed to the Video tab where you can change the algorithm used for the encoding and some of its most important options. We’ll start with our High-Quality setting.
1. Change the Video Encoder to H.265.
2. Notice how the “Tune” option has a “grain” setting. If your source is grainy, you should keep this option in mind and enable it on a case-by-case scenario, after importing a file into Handbrake and selecting the preset you’ll use to encode it.
3. Keep the framerate “Same as source” and set it to “variable.”
4. Drag the Preset slider to Normal or Slower. Slower takes (much) more time but produces better / higher quality results.
5. “Constant Quality” should be pre-selected instead of Bitrate mode. Change the RF setting to 20 – a nice compromise between quality and compression.
Just as with the video, the audio portion of the video file can also be encoded in many different ways. For a great quality/compression combination, move to the Audio Defaults tab and set the Audio Encoder Settings as:
- AAC (avcodec)
- Bitrate: 160 or, even better (but larger), 192
- Mixdown: 5.1 channels if you have a 5.1 audio system, Dolby Surround if you have a typical two-speaker setup.
Presets and more presets
Those were the most important options – you don’t have to change anything else (if you don’t want to). Now, do a test encode of your file and check the results.
- If you find the quality more than okay, you can increase the compression level. Change the RF to 21 in the Video tab and re-encode. Repeat until you find the drop in quality perceivable.
- If you thought the quality was bad, you can do the opposite: reduce the RF setting to 19. Note, though, that after 18, the gains from any compression don’t justify the time it will take. (Think one to twenty hours of compression, depending on CPU, for a 5 to 15 percent reduction in size, depending on video’s contents.)
To save this as your High Quality preset, select “Presets -> Save.” Enter a Preset Name and notice that it contains options for the video’s resolution. We suggested you skip setting the resolution in the Picture tab because this one overrides it. Enter the Maximum Width of your monitor – usually 1920 for Full HD screens – and leave the Maximum Height unchecked. Save your preset with a click on OK.
Medium Quality Preset
To create your medium quality preset, follow these steps:
- Go back to the Video tab and change the RF to 23. If you think H.265 is too slow for your CPU, also swap to the older but faster H.264 encoder.
- Move to the Audio tab and change the Bitrate to 128 and the Mixdown to Stereo.
- Do some test encodes for this preset as you did with the High-Quality one. Note that since this is a Medium Quality preset, a perceivable drop in quality here should be not only expected but a given.
- Select to save your Preset, but enter half the horizontal width of your screen as its Maximum Width – for Full HD 1920 x 1080 displays, that would be 960.
Low Quality – Very Fast Preset
The last profile will offer the worst possible quality and produce larger files but will compress your files in significantly less time compared to the previous ones. Set it up like this:
- At the Video tab, set the Video Encoder to MPEG-4.
- Set the Framerate as Constant.
- Change the encoding type to Bitrate and enter a 1200 kbps value.
- Enable 2-Pass Encoding and Turbo First Pass.
- Set the Audio Settings as in the Medium Quality Preset, but change the Samplerate to 44.1 for maximum compatibility with standalone media player devices. Disable ALL “Passthru” options on the top right.
- There’s no point in doing test encodes with MPEG4 because the results depend much more on the content of your video, and for best results, you should change the Bitrate setting for each video independently. 1200 is an excellent “one size fits all” for most encoding needs.
- Save the Preset as before, but enter an “old TV-friendly” resolution of 640 for Maximum Width.
And now, encode!
With your presets set up, from now on, whenever you want to encode your videos, you can import them in Handbrake, choose one of your profiles from the Presets List on the top right and just hit “Start.” It’s easier and much quicker than having to change those options manually every time.
It’s worth noting that you can also queue many encodings together, one after the other. So, you can load one file, select your HQ profile and click Enqueue, then repeat the procedure with the Medium Quality profile for the next two files, the Low Quality for the one after, and so on.