Software Used

  • Handbrake v1.7.2

Introduction/Who This Is For

If you are looking for ways to burn Bluray remuxes to disc or to transfer them to a flash drive for playback, then this guide is not for you. There are plenty of guides on how to make a homemade Bluray disc, and loading remuxes to a flash drive is pretty straightforward. You just need to look up what codecs and containers your playback device of choice supports.

Instead, this guide is for small indie creators who make videos and want to distribute 4K Bluray quality encodes of their videos on physical flash drives. Either for personal use or as a crowdfunding reward to your supporters.

Most of this information comes from this guide on x265 UHD-BD compliant settings. I am just translating them into settings for Handbrake since it’s an easier program to use. I will also try my best to explain what each of those flags mean.

x265 Encoding Settings In Handbrake

Summary Tab:

  • Format: Matroska

Dimensions Tab:

  • Resolution Limit: 2160p 4K Ultra HD

Video Tab:

  • Video Encoder: H.265 10-bit (x265)

  • Framerate: 23.976 (NTSC Film)

  • Bitrate (kbps): 70000

  • Multi-Pass Encoding: Enabled

  • Turbo Analysis Pass: Enabled

  • Preset: medium

  • Tune: grain

  • Profile: main10

  • Level: 5.1

  • More settings: uhd-bd:vbv-maxrate=90000:vbv-bufsize=70000:keyint=24:min-keyint=1:high-tier:aud:sar=1:hrd:repeat-headers:no-open-gop:ref=5:no-temporal-layers:overscan=show:wpp

x265 Encoding Parameters Explained

Format: Matroska sets the container of your video stream to be a .MKV file. This format is supported on fairly modern 4K UHD Bluray Players.

Resolution Limit: 2160p 4K Ultra HD sets our max video resolution. If you are encoding a video with a higher resolution, it will be downscaled to 2160p in the output.

Video Encoder: H.256 10-bit (x265) this tells Handbrake that we want to use the x265 encoder and output a 10-bit video file. This is supported by any player that supports native playback of 4K content.

Framerate: 23.976 (NTSC Film) sets the framerate to the NTSC film standard. By default, Handbrake uses this option along with Variable Framerate. This should not cause problems if your source video uses a constant framerate. If your source is variable, setting this with the Constant Framerate flag is generally a good idea to avoid potential incompatability.

Bitrate (kbps): 70000 sets the target bitrate to 70 Mbps. This is a decent target as UHD Bluray discs support up to 100 Mbps. While we could go higher since this content will be played back off a flash drive or external hard drive, then the bottleneck will become the speed of the hard drive/flash drive and the bandwidth of USB 3.0. You can adjust this to taste.

Multi-Pass Encoding: Enabled tells the encoder that we want to do two-pass encoding. This is super slow and only recommended after experimenting with single-pass encodes. The benefit of two-pass encoding is allowing the encoder to analyze the video on the first pass to allow for better motion estimates and bitrate allocations. Meaning that the video will fit better within it’s bitrate constraints while not losing too much quality.

Turbo Analysis Pass: Enabled tells the encoder to speed up the first pass. This is still slow compared to encoders such as libvpx or aomenc. Does not hurt to enable it.

Preset: Medium sets the encoder speed to medium. Medium seems to be the sweet spot for speed and quality. For 4K video, it is still pretty slow. But going faster or slower will introduce compromises between encode time and final encode quality. You can adjust to taste, but medium is a fine default.

Tune: grain tells the encoder to enable parameters optimized for footage with grain. All live action footage has grain to some degree. A grain-free image does not exist in real life since photons are not uniform when they hit a digital image sensor. Any image without grain has been digitally manipulated. If your source is not live-action and has no grain, feel free to change the tune.

Profile: main10 tells the encoder that we want the output file to conform to the “Main 10” H.265 profile. This allows 10-bit color, which means each color value gets access to 1024 levels of brightness instead of the 256 levels of 8-bit color. This helps if your source is 10-bit, and it does not hurt if your source is 8-bit.

Level: 5.1 tells the encoder that we are targetting the supported data rate of the 5.1 level for H.265. Which is the compliant level for Bluray Players.

Custom x265 Parameters

uhd-bd according to the x265 documentation, this enables UHD Bluray support and attempts to correct any incorrect paramters that would prevent incompatability. We add this to enforce this support.

vbv-maxrate=90000 this option is one of two required to enable Variable Bitrate Mode, which allows us to set a bitrate target and range for our encode. This sets the max bitrate for our encode

vbv-bufsize=70000 this option is the second parameter needed to toggle Variable Bitrate Mode. This option sets the amount of data buffered until the encoder checks and adjusts bitrate accordingly. So we want to set this to the same value as our target bitrate.

keyint=24 this option sets the max amount of time between keyframes. A keyframe is basically a reference frame for inter-frame compression. Depending on what mode you are encoding, this either affect filesize or compression quality.

min-keyint=1 this option sets the minimum size between GOP keyframes.

high-tier this option enables the encoder to support high tier at the set level.

aud I am not entirely sure what this option does. My best guess from reading the documentation is that it allows the access unit delimiter to be used, which adds metadata to the video stream about the stream. I’m not sure if it’s necessary, but I left it since the results seem to work with it.

sar=1 this stands for “Sample Aspect Ratio”. We leave it at one to indicate that each pixel is a square.

hrd This provides timing information to the decoder. Which seems like a good idea for compliant playback on a Bluray player.

repeat-headers this VPS, SPS, and PPS headers with every keyframe. Allowing the stream to have this information instead of relying on the container.

no-open-gop disabled open-gop. Not sure why since it is enabled by default. According to a thread I found, disabling open-gop is for compatability purposes.

ref=5 this parameter sets the max frames used for motion search. 5 is less than the default 8. This affects speed.

no-temporal-layers this disables the temporal sub layer. I am not sure how it works, but it has to do with block artifact reduction.

overscan=show this shows the overscan area without cropping it. This is not signaled by default, but we tell the decorder to show the area if it expects that flag.

wpp this is for parallel processing. It encodes in rows and assigns them to compute threads giving a speedup with miniscule loss in compression efficiency.

Audio Settings

I’ve set Handbrake to encode AC3 to 640 kbps for Stereo audio. AC3 is the most compatible.

Conclusion

These parameters should encode a UHD compliant video that can be read by a Bluray player with no technical issues. If you are looking for something less restricted and more useful for digital distribution. I recommend Kokomins’ Anime Encoding Guide for x265 (HEVC) & AAC/OPUS (and Why to Never Use FLAC). It is written with the intent of encoding Anime, but goes in depth with x265 parameters and optimizations for the most optimal H.265 encode.