- Offizieller Beitrag
Previousely discussed here: H.265 HDR
Previousely discussed here: H.265 HDR
I can only help with x265. (Not sure if the other codecs even support HDR right now) These are the settings that need to be applied with every HDR encode:
--colorprim bt2020
--colormatrix bt2020nc (It may also be a good idea to allow bt2020c)
--transfer smpte2084
--output-depth 10
--chromaloc 2
--hdr-opt
the user may optionally also want --uhd-bd which enforces compliance with the UltraHD Blu-ray spec.
they will also need the metadata. These will need to be inputted manually by the user, although you may use these as defaults
First, the user will need to define their monitor's capabilities. You have RGB chromaticity points, and max/min luminance. The following is for a monitor with rec2020 chromaticity points, 1000 nit maximum luminance, and 0 nit minimum luminance. Notice the chromaticity points are multiplied by 50000 and the luminance numbers are multiplied by 10000:
--master-display "G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(10000000,0)"
Next, the user will need to define the MaxCLL and MaxFALL metadata. MaxCLL refers to the brightest pixel in the entire content, and MaxFALL refers to the frame with the brightest average light level. These are described in integer nits. Here is an example with the common 1000 nit MaxCLL, and 400 nit MaxFALL:
--max-cll "1000,400"
(for a "correct" encode, these values should be different for each sequence)
--------------
The tricky thing here is there are essentially two different ways to approach HDR in premiere. The way I'm doing it, you can edit the raw PQ-formatted HDR video in the default rec709 space. Premiere thinks you're working with rec709 video and it will look all washed out and flat on a rec709 monitor, but when displayed on an HDR monitor, it looks correct. This would be fully compatible with the above options without changing anything else.
--------
The other way, however, is that premiere actually has some (limited) native HDR functionality. If you pull in an HDR video and Premiere recognizes it as HDR video, it will display colors correctly, but it will clip the video at the 100nit level. Which means you can't display it correctly on an HDR monitor, and more than likely it will look blown out on an SDR monitor. As far as I know, currently the only way to view this in HDR is to export it back out using Premiere's built-in HEVC codec, with the HDR option enabled. What I assume this does, is before applying similar options to those listed above (without the metadata part), it takes the video information as linear floating point values with 1.000 representing 100 nits and 100.000 representing 10,000 nits, and then applies a transform to the ST2084 PQ space (sort of HDR's gamma), before encoding as HDR video.
If you can obtain this raw HDR linear floating point data, then an equation to translate this to ST2084 compatible values between 0 and 1 would be:
y = ((1.10147*x^0.1593+0.101713)/(x^0.1593+0.111442))^78.8438 / 1023
y represents the final output in a floating point value between 0 and 1. If you skip the /1023 at the end, you can also get values between 0 and 1023, which may be useful for 10bit encoding.
x represents a floating point value where 1.000 is 100 nits and 100.000 is 10,000 nits. If x is 0, make sure to manually translate that to y=0, as that won't work with the equation.
I would also check to see if premiere has any option to natively do that conversion from native HDR to ST2084 for you, similar to that checkbox in the built in HEVC encoder.
This second method is messy, but it's more in line with how premiere does HDR natively. I don't personally recommend people to use Premiere's native HDR workflow right now as it's severely limited, but if they so happened to use that method, it would be nice to have a way to export that as well. Not really sure how you would be able to explain that in voukoder however. Perhaps a checkbox, selected by default that says something like "preformatted for HDR/ST2084". The box being checked would skip the ST2084 transformation formula from above.
If you have to pick one, go with the first option for now until premiere gets better at its HDR workflow.
I hope you can get this done, because I just exported a project using x265vfw with these options, through Premiere's AVI output, and it's clear premiere is clamping to 8bit before encoding in that mode, even though x265 is encoding in 10bit. This is causing banding issues in my HDR colors. While I can export 10bit HEVC through voukoder, I don't know how to inject the correct metadata into the stream after it's been encoded, plus the encoding won't be as "correct" or efficient if it doesn't know those things about the luma/color format during the process either. Is there currently a way to type commands manually into Voukoder R2? Because even if something isn't implemented in the UI, being able to type it manually would at least provide the option.
Btw, after much testing, I just figured out a solution using 1.2.1 and the piping out functionality (I couldn't find that feature in R2)
First, the program that I'm piping to is a build of ffmpeg that supports 10bit x265. I used Zeranoe Windows x64, but if it supports 10bit x265 it should work.
The piping command I used for my project (MaxCLL 1075 and MaxFALL 226) was this:
-i - -pix_fmt yuv420p10 -c:v libx265 -x265-params crf=18:colorprim=bt2020:colormatrix=bt2020c:transfer=smpte2084:chromaloc=2:hdr-opt=1:master-display="G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(10000000,0)":max-cll="1075,226" D:\Movie.mp4
You would obviously need to tweak your MaxCLL/MaxFALL and preferably your mastering display values, as well as the output location. This produces only video, but it could probably be tweaked to include audio as well. I found the output location had trouble with longer directory+file names (Such as D:\Users\Andy\Desktop\Movie.mp4) so I decided to stick it on the root of my drive since I wouldn't know where it would go if I just said Movie.mp4.
For now this will be my solution until you can release an update with built in functionality. Maybe this sample command line will also help you.
In Version 2.0.7 there will be these additional fields (with all their parameters according to https://x265.readthedocs.io/en/default/cli.html):
"colorprim",
"colormatrix",
"transfer",
"output-depth",
"chromaloc",
"hdr-opt",
"master-display",
"max-cll",
"uhd-bd",
"sar",
"range",
"aud",
"hrd",
"repeat-headers",
I guess that will be helpful to you, right?
Alles anzeigenIn Version 2.0.7 there will be these additional fields (with all their parameters according to https://x265.readthedocs.io/en/default/cli.html):
"colorprim",
"colormatrix",
"transfer",
"output-depth",
"chromaloc",
"hdr-opt",
"master-display",
"max-cll",
"uhd-bd",
"sar",
"range",
"aud",
"hrd",
"repeat-headers",
I guess that will be helpful to you, right?
Awesome yes this will be very helpful.
Color range : Limited
Color primaries : BT.2020
Transfer characteristics : SMPTE ST 2084
Matrix coefficients : BT.2020 constant
Mastering display color primar : R: x=0.708000 y=0.292000, G: x=0.170000 y=0.797000, B: x=0.131000 y=0.046000, White point: x=0.312700 y=0.329000
Mastering display luminance : min: 0.0000 cd/m2, max: 1000.0000 cd/m2
Maximum Content Light Level : 1075 cd/m2
Maximum Frame-Average Light Le : 226 cd/m2
Ah, crap. I just realized the format I was piping over the command line was actually 8bpc. I originally thought RGB32 meant 32bpc. Well, that's not going to work. I definitely notice banding so the output, while 10bit, isn't actually true 10bit. When 2.0.7 comes, I'm assuming this will this be delivering proper 10bit per channel from the source, not from RGB32 like the pipe?
Yes, This piping feature supported only RGB which is not relevant for the implemented encoders ...
If you select any non 8bit pixel format in the encoder settings ...
Perfect. Just did a short test with a standard 10bit encode (no HDR, just encoded normally in 10bit), reimported it and applied a custom HDR-to-SDR LUT I made and indeed, no color banding like my other tests.
Looking forward to 2.0.7!
NVENC h.265 (NVidia GPU accelerated) with 10-Bit HDR UHD ist perfekt!!! Like libx265!
To my knowledge NVENC does not support HDR yet.
I don't see any HDR encoder options.
Why can NVENC and StaxRip do that?
I support your job!
I don't know how StaxRip does it.
Currently I have these options available:
Encoder h264_nvenc [NVIDIA NVENC H.264 encoder]:
General capabilities: delay hardware
Threading capabilities: none
Supported pixel formats: yuv420p nv12 p010le yuv444p p016le yuv444p16le bgr0 rgb0 cuda d3d11
h264_nvenc AVOptions:
-preset <int> E..V..... Set the encoding preset (from 0 to 11) (default medium)
default E..V.....
slow E..V..... hq 2 passes
medium E..V..... hq 1 pass
fast E..V..... hp 1 pass
hp E..V.....
hq E..V.....
bd E..V.....
ll E..V..... low latency
llhq E..V..... low latency hq
llhp E..V..... low latency hp
lossless E..V.....
losslesshp E..V.....
-profile <int> E..V..... Set the encoding profile (from 0 to 3) (default main)
baseline E..V.....
main E..V.....
high E..V.....
high444p E..V.....
-level <int> E..V..... Set the encoding level restriction (from 0 to 51) (default auto)
auto E..V.....
1 E..V.....
1.0 E..V.....
1b E..V.....
1.0b E..V.....
1.1 E..V.....
1.2 E..V.....
1.3 E..V.....
2 E..V.....
2.0 E..V.....
2.1 E..V.....
2.2 E..V.....
3 E..V.....
3.0 E..V.....
3.1 E..V.....
3.2 E..V.....
4 E..V.....
4.0 E..V.....
4.1 E..V.....
4.2 E..V.....
5 E..V.....
5.0 E..V.....
5.1 E..V.....
-rc <int> E..V..... Override the preset rate-control (from -1 to INT_MAX) (default -1)
constqp E..V..... Constant QP mode
vbr E..V..... Variable bitrate mode
cbr E..V..... Constant bitrate mode
vbr_minqp E..V..... Variable bitrate mode with MinQP (deprecated)
ll_2pass_quality E..V..... Multi-pass optimized for image quality (deprecated)
ll_2pass_size E..V..... Multi-pass optimized for constant frame size (deprecated)
vbr_2pass E..V..... Multi-pass variable bitrate mode (deprecated)
cbr_ld_hq E..V..... Constant bitrate low delay high quality mode
cbr_hq E..V..... Constant bitrate high quality mode
vbr_hq E..V..... Variable bitrate high quality mode
-rc-lookahead <int> E..V..... Number of frames to look ahead for rate-control (from 0 to INT_MAX) (default 0)
-surfaces <int> E..V..... Number of concurrent surfaces (from 0 to 64) (default 0)
-cbr <boolean> E..V..... Use cbr encoding mode (default false)
-2pass <boolean> E..V..... Use 2pass encoding mode (default auto)
-gpu <int> E..V..... Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on. (from -2 to INT_MAX) (default any)
any E..V..... Pick the first device available
list E..V..... List the available devices
-delay <int> E..V..... Delay frame output by the given amount of frames (from 0 to INT_MAX) (default INT_MAX)
-no-scenecut <boolean> E..V..... When lookahead is enabled, set this to 1 to disable adaptive I-frame insertion at scene cuts (default false)
-forced-idr <boolean> E..V..... If forcing keyframes, force them as IDR frames. (default false)
-b_adapt <boolean> E..V..... When lookahead is enabled, set this to 0 to disable adaptive B-frame decision (default true)
-spatial-aq <boolean> E..V..... set to 1 to enable Spatial AQ (default false)
-temporal-aq <boolean> E..V..... set to 1 to enable Temporal AQ (default false)
-zerolatency <boolean> E..V..... Set 1 to indicate zero latency operation (no reordering delay) (default false)
-nonref_p <boolean> E..V..... Set this to 1 to enable automatic insertion of non-reference P-frames (default false)
-strict_gop <boolean> E..V..... Set 1 to minimize GOP-to-GOP rate fluctuations (default false)
-aq-strength <int> E..V..... When Spatial AQ is enabled, this field is used to specify AQ strength. AQ strength scale is from 1 (low) - 15 (aggressive) (from 1 to 15) (default 8)
-cq <float> E..V..... Set target quality level (0 to 51, 0 means automatic) for constant quality mode in VBR rate control (from 0 to 51) (default 0)
-aud <boolean> E..V..... Use access unit delimiters (default false)
-bluray-compat <boolean> E..V..... Bluray compatibility workarounds (default false)
-init_qpP <int> E..V..... Initial QP value for P frame (from -1 to 51) (default -1)
-init_qpB <int> E..V..... Initial QP value for B frame (from -1 to 51) (default -1)
-init_qpI <int> E..V..... Initial QP value for I frame (from -1 to 51) (default -1)
-qp <int> E..V..... Constant quantization parameter rate control method (from -1 to 51) (default -1)
-weighted_pred <int> E..V..... Set 1 to enable weighted prediction (from 0 to 1) (default 0)
-coder <int> E..V..... Coder type (from -1 to 2) (default default)
default E..V.....
auto E..V.....
cabac E..V.....
cavlc E..V.....
ac E..V.....
vlc E..V.....
-b_ref_mode <int> E..V..... Use B frames as references (from 0 to 2) (default disabled)
disabled E..V..... B frames will not be used for reference
each E..V..... Each B frame will be used for reference
middle E..V..... Only (number of B frames)/2 will be used for reference
-a53cc <boolean> E..V..... Use A53 Closed Captions (if available) (default true)
Alles anzeigen
I don't see the HDR relevant options here.
I support your job!
Thanks for your support!!
You can encode 10 Bit but I don't think that NVEnc can encode HDR conform.
Oh nvm. you can encode HDR conform. I found a 4K Video file which I encoded a few months ago with NVEnc.
you can encode HDR conform
And how do you do that?
Edit: It seems they patch the stream afterwards. So it is correct that NVENC does not support it. People just modify the files afterwards.
I encoded it with StaxRip which uses NVEnc by rigaya with this parameters I think:
--vbrhq 10000 --codec h265 --preset quality --profile main10 --tier high --output-depth 10 --weightp --max-bitrate 10000 --aq --aq-temporal --cuda-schedule spin --videoformat ntsc --colormatrix bt2020nc --colorprim bt2020 --transfer smpte2084 --cabac
In the new NVEnc version you can also set this parameter:
It should be also possible to use ffmpegs filter for that