As a user I would like to export with 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.

    Einmal editiert, zuletzt von morphinapg (30. Mai 2019 um 11:33)

  • 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:

    Code
    -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.

  • Awesome yes this will be very helpful.

    • Offizieller Beitrag

    Code
    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
  • Vouk 30. Mai 2019 um 11:59

    Hat das Label von Geplant auf Fertig geändert.
  • 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?

    • Offizieller Beitrag

    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 ...

    • Premiere will render it in YUV 4:4:4:4 with 32bit float precision.
    • It will then be converted to yuv444p16 to feed it into FFmpeg/libav.
    • And finally converted to the target format (yuv420p10)
  • 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!

    • Offizieller Beitrag

    I don't know how StaxRip does it.

    Currently I have these options available:

    I don't see the HDR relevant options here.

  • I encoded it with StaxRip which uses NVEnc by rigaya with this parameters I think:

    Code
    --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:

    Code
    --dhdr10-info <string> [HEVC only]
    Apply HDR10+ dynamic metadata from specified json file. Requires hdr10plus_gen.exe module additionally.