HEVC 10bit encoding with NVENC

Questions involving a Windows version of FFmpeg.
ianken
Posts: 4
Joined: Tue Feb 24, 2015 11:51 pm

Re: HEVC 10bit encoding with NVENC

Post by ianken » Wed Jan 11, 2017 11:35 pm

diehummel wrote:Hello,

i found this thread via google :)
and i have a question.
Does hevc_nvenc already support BT2020 somehow?
When i re-encode an 4k HDR BT2020 Video the BT2020 Metadata gets lost.
With x265 and x265-params i can set bt2020 colormatrix etc.. and its ok. But i would like to use GPU performance.

thanks
Christian
AFAICT it does not. I'm investigating using NVENC to re-compress J2K HDR masters to something that is not so laughably huge. Unfortunately the metadata needs to be saved separately. We still use x265 for the final production encode and re-inject metadata at that time. Keep colorspace conversion upstream of encoding and rely on NVENC to just encode YUV and you're OK.

IMO NVENC lacks the fidelity for production HDR encoding. But it's fast, and at higher bit rates well suited for archival. The limited pixel format support in the ffmpeg builds is also something you need to be aware of. I was hoping the patch noted in this thread would be in the main builds by now, but it looks like that is not the case. Maybe I need to update?

SKHardwired
Posts: 2
Joined: Tue Jan 17, 2017 3:39 pm

Re: HEVC 10bit encoding with NVENC

Post by SKHardwired » Tue Jan 17, 2017 3:59 pm

Yes. NVENC on Pascal doesn't write any SEI NAL and color settings to SPS NAL VUI section, i. e. HDR flags.

I tried to find tool to inject these into existing raw HEVC streams, but found only paid SEIEdit.
So I wrote the python script which parses SPS NAL with color info, adds proper flags, packs to binary stream and replace old SPS NAL with new one. Also it adds SEI NAL with MaxCLL and MaxFall data.
Thanks NVENC generate descriptive NALs only at start of stream once.
So patched HEVC streams at least trigger HDR mode with rec.2020 color on Sony Bravia.

Today uploaded to github, so you may try it.
Basic usage guide and download:
https://github.com/SK-Hardwired/nv_hevc_hdr_patcher

SKHardwired
Posts: 2
Joined: Tue Jan 17, 2017 3:39 pm

Re: HEVC 10bit encoding with NVENC

Post by SKHardwired » Thu Jan 19, 2017 10:54 am

UPD:
1) Rewrote script to get arguments and parameters from cmd line (not from script body anymore). Syntax of giving VUI and SEI params is the same as x265.
2) MAJOR: made binary which can be executed at any PC having MSVC 2015 redist installed. Now it can be used by standalone tool (no python installed required) and embedded into other batch scripts as step between encoding and muxing.

diehummel
Posts: 2
Joined: Fri Dec 23, 2016 8:24 am

Re: HEVC 10bit encoding with NVENC

Post by diehummel » Thu Jan 19, 2017 12:32 pm

thanks for your work.
Just had no time for testing and no need for enconding currently.

hiltron
Posts: 2
Joined: Wed Mar 07, 2018 3:16 am

Re: HEVC 10bit encoding with NVENC

Post by hiltron » Wed Mar 07, 2018 3:32 pm

I know this is an old thread, but I am in need of setting the HDR flags on a 4K HDR file that was compressed with hevc_nvenc. I'm a little confused on the terminology in the script and what I can view with mediainfo.

The main parameters in question that I can't identify are transfer characteristics (mediainfo says PQ but nvhsp doesn't have that), chroma bit location, signal range flag, and SMPTE 2086 metadata.

The below mediainfo is my source test file. With that info, what parameters would you suggest for nvhsp?

Video
ID : 1
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : Main [email protected]@High
Codec ID : V_MPEGH/ISO/HEVC
Duration : 3 min 36 s
Bit rate : 58.3 Mb/s
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0 (Type 2)
Bit depth : 10 bits
Bits/(Pixel*Frame) : 0.293
Stream size : 1.47 GiB (91%)
Writing library : ATEME Titan File 3.8.12 (4.8.12.0)
Language : English
Default : No
Forced : No
Color range : Limited
Color primaries : BT.2020
Transfer characteristics : PQ
Matrix coefficients : BT.2020 non-constant
Mastering display color primaries : Display P3
Mastering display luminance : min: 0.0050 cd/m2, max: 1000 cd/m2

hydra3333
Posts: 201
Joined: Sun Apr 28, 2013 1:03 pm
Contact:

Re: HEVC 10bit encoding with NVENC

Post by hydra3333 » Sun Aug 25, 2019 9:23 am

An old thread, however ... any resolution ?

Post Reply
'