How to Encode HEVC: The Set-Up and Test Files
Now that we’ve looked at how to playback HEVC-encoded files, it’s time to create them. There are a whole collection of tools and utilities that can encode HEVC, but in this article I’m going to focus on those that are easiest to use and provide the best quality options.
Throughout this section I’ll be looking at encoding two TV show episodes I ripped from a Blu-ray earlier. If you want to learn how to rip Blu-rays, there are plenty of guides around, and plenty of ways to do so. For this guide, however, I created two high-bitrate H.264 files that are of excellent quality, essentially representing what you’d get from the source material.
It should be noted here that if you rip a Blu-ray at original quality you will get a massive file size as Blu-rays use high-bitrate media for the ultimate in quality. Whether you use original quality or slightly compressed files really doesn’t matter, as encoding to lower bitrate H.264 or HEVC will lead to a slight reduction in quality for either type of file. The end result will usually be the same as well: a 10 GB Blu-ray source or a medium-bitrate 2.5 GB H.264 rip will both be compressed to 700 MB using the same HEVC settings, for example.
What I wouldn’t recommend doing is ripping your Blu-rays to a low quality file before re-encoding them to HEVC, as you can expect to lose even more quality in the process. In general, you want a source quality file before compression to deliver the best results, although most files you acquire through more dubious means should also suffice.
A single, high-detail frame from The Big Bang Theory sample used for encoding test purposes
The two files I’ll be using as examples in this guide are as follows:
- Game of Thrones, Season 2, Episode 1: 1920 x 1080, approximately 5,000 kbps H.264 with 1,500 kbps DTS 5.1 channel audio, encoded using x264
- The Big Bang Theory, Season 8, Episode 11: 1920 x 1080, approximately 9,000 Kbps H.264 with 1,500 kbps DTS 5.1 channel audio, encoded using x264
The Game of Thrones file is of higher visual quality due to the way the show was filmed and produced, with excellent detail, motion scenes, panning, and some dark environments. It’s a very good test bed for a typical TV show or movie file. The Big Bang Theory is of lesser visual quality despite its high bit rate, due to a differing camera setup. It also has less movement and detail, representing many sitcom TV shows that you may be wanting to encode.
This is a frame from the Game of Thrones test file
I also want to explain some terms before encoding these files:
- MP4 and MKV are containers, which are used to house the video and audio streams. In the case of MKV files, subtitles are also embedded in some circumstances.
- H.264 and HEVC are coding formats, and describe how to encode a video file using the accompanying compression standard
- x264 and x265 are encoding libraries, used to create H.264- and HEVC-encoded videos respectively
Therefore, it’s correct to say that we’ll be creating MKV files which include HEVC video streams encoded using x265.
For both H.264 and HEVC encoding using the CPU, we’ll be using Handbrake, and you’ll need at least version 0.10.0 for x265 support. I’ve used version 0.10.3.0 64-bit for this guide, which was the latest version at the time.
As a benchmark, I’ll be comparing encoded HEVC files to a compressed H.264 file created using what I believe are settings that achieve a great balance between small file size and quality. This includes using Handbrake’s constant quality setting at 23 RF for 1080p files, strict anamorphic picture size, and the following collection of advanced settings and filters. Note that to use the advanced settings, you’ll need to tick the appropriate box in the videos tab
For all audio files, whether it’s encoding H.264 or HEVC, I’ll be compressing to 5.1 channel HE-AAC with a bitrate of 256 kbps. If you’re more of an audiophile or if you’re encoding a movie, you might want to consider increasing the bitrate or using a different codec, but I find these settings to be perfectly fine for most TV shows.