View Full Version : --uhd-bd option precise function & other UHD-BD specific constraints
A.Fenderson
22nd January 2018, 07:11
I'm very new to x265 and HEVC encoding in general.
Can someone please give me an exhaustive list of all options enforced by the --uhd-bd flag? I've not been able to find a complete functional explanation of this option anywhere.
From what I've been able to piece together from other threads here, it might be something like this:
--aud
--hrd
--no-open-gop (since UHD-BD open-gop is more and very specifically constrained relative to the general HEVC definition)
--min-keyint 1
--keyint XX (where XX is equal to fps)
--chromaloc 2 (for bt.2020, anyway)
I read in the makeMKV forums that UHD-BD requires 8 slices for ease of decode, so though I've never seen it referenced here, I'm wondering if
--slices 8
is not also enforced.
Also, if anyone has any information on the precise VBV settings that should be used for the various allowable media types, that would be great.
Thanks for any and all input.
sneaker_ger
22nd January 2018, 13:39
List:
https://bitbucket.org/multicoreware/x265/src/3712d13c09bf3b9db105c7f97188bcc11b8f83cd/source/encoder/encoder.cpp?at=default&fileviewer=file-view-default#encoder.cpp-2888
Slices does not seem to be enforced. Most people here have only seen a "whitepaper" for UHD Blu-Ray (http://www.blu-raydisc.com/assets/Downloadablefile/BD-ROM_Part3_V3.0_WhitePaper_150724.pdf). The complete specs are not freely available.
Only thing about slices I see in the whitepaper:
3.5.1 Parameter limits
Minimum size per one slice segment is 1 row of a coding tree block. A slice segment shall be
composed of one or more rows of a coding tree block. A row of a coding tree block indicates all the
coding tree blocks in a horizontal row of coding tree block.
Maximum number of slice segments is 34.
A.Fenderson
23rd January 2018, 06:55
Thank you very much for your reply.
OK, here's my attempt to parse the code and translate it to human-readable form, with an eye to the corresponding CLI options. Anyone care to correct my mistakes?
p->bEnableAccessUnitDelimiters = 1;
p->vui.aspectRatioIdc = 1;
p->bEmitHRDSEI = 1;
int disableUhdBd = 0;
--aud
--sar 1
--hrd
if (p->levelIdc && p->levelIdc != 51)
{
x265_log(p, X265_LOG_WARNING, "uhd-bd: Wrong level specified, UHD Bluray mandates Level 5.1\n");
}
p->levelIdc = 51;
--level-idc 51
if (!p->bHighTier)
{
x265_log(p, X265_LOG_WARNING, "uhd-bd: Turning on high tier\n");
p->bHighTier = 1;
}
--high-tier
if (!p->bRepeatHeaders)
{
x265_log(p, X265_LOG_WARNING, "uhd-bd: Turning on repeat-headers\n");
p->bRepeatHeaders = 1;
}
--repeat-headers
if (p->bOpenGOP)
{
x265_log(p, X265_LOG_WARNING, "uhd-bd: Turning off open GOP\n");
p->bOpenGOP = false;
}
--no-open-gop
if (p->bIntraRefresh)
{
x265_log(p, X265_LOG_WARNING, "uhd-bd: turning off intra-refresh\n");
p->bIntraRefresh = 0;
}
(override/disable --intra-refresh option if it has been set by the user)
if (p->keyframeMin != 1)
{
x265_log(p, X265_LOG_WARNING, "uhd-bd: keyframeMin is always 1\n");
p->keyframeMin = 1;
}
--min-keyint 1
int fps = (p->fpsNum + p->fpsDenom - 1) / p->fpsDenom;
if (p->keyframeMax > fps)
{
x265_log(p, X265_LOG_WARNING, "uhd-bd: reducing keyframeMax to %d\n", fps);
p->keyframeMax = fps;
}
--keyint XX (where XX is the value of the ceiling function applied to the value given for --fps option by the user)
if (p->maxNumReferences > 6)
{
x265_log(p, X265_LOG_WARNING, "uhd-bd: reducing references to 6\n");
p->maxNumReferences = 6;
}
-- ref 6 (if and only if the user-supplied value of --ref is greater than 6)
if (p->bEnableTemporalSubLayers)
{
x265_log(p, X265_LOG_WARNING, "uhd-bd: Turning off temporal layering\n");
p->bEnableTemporalSubLayers = 0;
}
--no-temporal-layers (possibly only if user specified --temporal layers, but unsure due to no specified default behavior in x265 documentation)
if (p->vui.colorPrimaries != 1 && p->vui.colorPrimaries != 9)
{
x265_log(p, X265_LOG_ERROR, "uhd-bd: colour primaries should be either BT.709 or BT.2020\n");
disableUhdBd = 1;
}
else if (p->vui.colorPrimaries == 9)
{
p->vui.bEnableChromaLocInfoPresentFlag = 1;
p->vui.chromaSampleLocTypeTopField = 2;
p->vui.chromaSampleLocTypeBottomField = 2;
}
(if --colorprim has been set with a value other than 1 or 9, disable --uhd-bd format support option, otherwise do the below)
--chromaloc 2 (only if --colorprim is set to 9/bt2020)
if (p->vui.transferCharacteristics != 1 && p->vui.transferCharacteristics != 14 && p->vui.transferCharacteristics != 16)
{
x265_log(p, X265_LOG_ERROR, "uhd-bd: transfer characteristics supported are BT.709, BT.2020-10 or SMPTE ST.2084\n");
disableUhdBd = 1;
}
if (p->vui.matrixCoeffs != 1 && p->vui.matrixCoeffs != 9)
{
x265_log(p, X265_LOG_ERROR, "uhd-bd: matrix coeffs supported are either BT.709 or BT.2020\n");
disableUhdBd = 1;
}
if ((p->sourceWidth != 1920 && p->sourceWidth != 3840) || (p->sourceHeight != 1080 && p->sourceHeight != 2160))
{
x265_log(p, X265_LOG_ERROR, "uhd-bd: Supported resolutions are 1920x1080 and 3840x2160\n");
disableUhdBd = 1;
}
if (disableUhdBd)
{
p->uhdBluray = 0;
x265_log(p, X265_LOG_ERROR, "uhd-bd: Disabled\n");
}
(disable --uhd-bd under any of the following circumstances:
* --transfer has been set to something other than 1/bt709, 14/bt2020-10, or 16/smpte2084
* --colormatrix has been set to something other than 1/bt709 or 9/bt2020nc
* the source resolution is anything other than 1920x1080 or 3840x2160
)
Well, how did I do? :-)
sneaker_ger
23rd January 2018, 13:17
Looks correct.
Actually, there's an error in the x265 code.
if ((p->sourceWidth != 1920 && p->sourceWidth != 3840) || (p->sourceHeight != 1080 && p->sourceHeight != 2160))
{
x265_log(p, X265_LOG_ERROR, "uhd-bd: Supported resolutions are 1920x1080 and 3840x2160\n");
disableUhdBd = 1;
}
Will accept 1920x2160 and 3840x1080 resolutions.
A.Fenderson
23rd January 2018, 17:50
Looks correct.
Actually, there's an error in the x265 code.
if ((p->sourceWidth != 1920 && p->sourceWidth != 3840) || (p->sourceHeight != 1080 && p->sourceHeight != 2160))
{
x265_log(p, X265_LOG_ERROR, "uhd-bd: Supported resolutions are 1920x1080 and 3840x2160\n");
disableUhdBd = 1;
}
Will accept 1920x2160 and 3840x1080 resolutions.
Oh, nice catch. So it should be:
if ((p->sourceWidth != 1920 && p->sourceHeight != 1080) || (p->sourceWidth != 3840 && p->sourceHeight != 2160))
{
x265_log(p, X265_LOG_ERROR, "uhd-bd: Supported resolutions are 1920x1080 and 3840x2160\n");
disableUhdBd = 1;
}
FranceBB
24th January 2018, 04:21
Sorry if I sneak into this topic.
Is this command line going to be UHD-BD compatible?
x265.exe --y4m - --preset medium --level 5.1 --tune fastdecode --ref 2 --rc-lookahead 3 -b 2 --profile main10 --bitrate 25000 --deblock -1:-1 --overscan show --colormatrix bt709 --range limited --transfer bt709 --colorprim bt709 --videoformat component --no-open-gop --min-keyint 1 --repeat-headers --rd 3 --vbv-maxrate 25000 --vbv-bufsize 32000 --asm=sse4.2 --wpp -o "D:\raw_video.hevc"
It's supposed to give me a 25Mbit/s CBR HEVC file that I think it's also UHD-BD compatible.
It's actually compatible with a playout system a TV company is using, so I was wondering whether it's gonna be UHD-BD compatible as well.
A.Fenderson
24th January 2018, 06:43
I'm a complete x265 newbie, so I cannot fully answer your question. Having looked at your options, I cannot find anything that seems to conflict any of the above parameters that --uhd-bd sets. I think it might be worthwhile, however, to just use the --uhd-bd option because you are missing many of the settings/options that it does adjust/set.
I have been trying to track down VBV constraints/settings for UHD-BD compatibility, but have had no success. However, in the case for h264 encodes for standard HD Blu-rays, it was required that --vbv-bufsize be less than or equal to --vbv-maxrate, and further there was a hard limit of 30000 for --vbv-bufsize. (https://forum.doom9.org/showthread.php?p=1399419#post1399419) Assuming similar rationale for UHD-BD, then (which is not necessarily a safe assumption), your value of --vbv-bufsize would need to be set at 25000, which, being less than even standard BD h264 requirements, should be fine. I would think. :-)
I'm hoping someone with more knowledge can answer both our remaining questions.
sneaker_ger
24th January 2018, 11:01
Yes, maxrate must be equal or greater than bufsize (ignoring units).
And he is missing e.g. keyint, aud and tier.
I don't know how reliable anything of this is, though. x264 got verified professionally for BD (and even then there were still small bugs) . Haven't seen the same for x265 yet.
FranceBB
25th January 2018, 05:02
Got it.
I just added --keyint 24 --aud --profile Main10 --level 5.0
Although up to level 5.1 and high tier are supported by UHD BD, I'm encoding at CBR 25 Mbit/s, so --level 5.0 and main tier should be enough.
Next week I'll test it on a BD player and I'll let you know.
This is my actual command line:
x265.exe --y4m - --profile Main10 --level 5.0 --preset medium --tune fastdecode --no-high-tier --ref 2 --rc-lookahead 3 -b 2 --profile main10 --bitrate 25000 --deblock -1:-1 --overscan show --colormatrix bt709 --range limited --transfer bt709 --colorprim bt709 --videoformat component --no-open-gop --min-keyint 1 --keyint 24 --aud --repeat-headers --rd 3 --vbv-maxrate 25000 --vbv-bufsize 25000 --asm=sse4.2 --wpp -o "D:\raw_video.hevc"
I'll let you know next week.
EDIT: I tested it on few blurays and it worked flawlessly.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.