HDR -> SDR conversion
HDR -> SDR conversion
I'll be setting up my new 4K system this weekend.
If it is of any help I can run test scripts right afterward and report back
Or if I can of some help beforehand please let me know
If it is of any help I can run test scripts right afterward and report back
Or if I can of some help beforehand please let me know
Re: HDR -> SDR tonemapping for DGDecodeNV
All help will be welcome. Thanks!
What do you mean by a "4K system"?
What do you mean by a "4K system"?
Re: HDR -> SDR tonemapping for DGDecodeNV
GTX 1080Ti hooked up to a receiver which goes to a 65" 4K TV
All HDR10 and Dolby Vision capable
All HDR10 and Dolby Vision capable
Re: HDR -> SDR tonemapping for DGDecodeNV
Hopefully I'll be able to do a comparison of HDR to HDR>SDR to a native SDR clip
P.S.
Santa was good to me... until he stuck me with the bill for this stuff
P.S.
Santa was good to me... until he stuck me with the bill for this stuff
Re: HDR -> SDR tonemapping for DGDecodeNV
my goodness Guest, envious of the equipment if not the bill.
A query ...
I have (a) an old PC with a 750Ti nvidia card and another with a low-cost 1050Ti (b) a low cost samsung telly which claims to do 4k and hdr ... but no media player which does 4k or hdr.
I do have a chromecast ultra attached to that telly though.
In your view, would this be reasonable to test and compare with ?
1. for HDR
save native HDR file -> on a chromecast server filesystem (on a raspberry pi3) -> use a tablet to cast the HDR file from the Pi3 to the chromecast ultra
2. for SDR:
convert HDR file -> h.264.avc.SDR.mp4 using NVENC to a chromecast server filesystem (on a raspberry pi3) -> use a tablet to cast the SDR file from the Pi3 to the chromecast ultra
PS IIRC the 750Ti won't encode h.265 nor HDR using NVENC in ffmpeg, but does a 1050Ti do either/both ?
A query ...
I have (a) an old PC with a 750Ti nvidia card and another with a low-cost 1050Ti (b) a low cost samsung telly which claims to do 4k and hdr ... but no media player which does 4k or hdr.
I do have a chromecast ultra attached to that telly though.
In your view, would this be reasonable to test and compare with ?
1. for HDR
save native HDR file -> on a chromecast server filesystem (on a raspberry pi3) -> use a tablet to cast the HDR file from the Pi3 to the chromecast ultra
2. for SDR:
convert HDR file -> h.264.avc.SDR.mp4 using NVENC to a chromecast server filesystem (on a raspberry pi3) -> use a tablet to cast the SDR file from the Pi3 to the chromecast ultra
PS IIRC the 750Ti won't encode h.265 nor HDR using NVENC in ffmpeg, but does a 1050Ti do either/both ?
Re: HDR -> SDR tonemapping for DGDecodeNV
You need to make all your devices are HDMI 2.0 capable.
Make your HDMI cables are rated, Amazon basics cables are good enough (18Gbps)
The 1050Ti can decode and encode HEVC, don't think the 750 can do hardware decoding of HEVC
CPU decoding of 4K HEVC would be a massive load
If everything is decrypted HDCP is not an issue
1050Ti > TV (4K+HDR) with proper cables sounds good enough
NVEnc does not retain the HDR metadata, (it does use the parameters) meaning you have to turn on HDR manually on the TV
or
Use nvhsp to apply the metadata back into the HEVC stream
Its quite easy to use
Make your HDMI cables are rated, Amazon basics cables are good enough (18Gbps)
The 1050Ti can decode and encode HEVC, don't think the 750 can do hardware decoding of HEVC
CPU decoding of 4K HEVC would be a massive load
If everything is decrypted HDCP is not an issue
1050Ti > TV (4K+HDR) with proper cables sounds good enough
NVEnc does not retain the HDR metadata, (it does use the parameters) meaning you have to turn on HDR manually on the TV
or
Use nvhsp to apply the metadata back into the HEVC stream
Its quite easy to use
Re: HDR -> SDR tonemapping for DGDecodeNV
Link for nvhsp?
Re: HDR -> SDR tonemapping for DGDecodeNV
https://github.com/SK-Hardwired/nv_hevc ... /nvhsp.zip
my template command line
MediaInfo 17.10 still gives the actual numbers
G, B, R, and WP are the numbers reported by MediaInfo x 50000
Edit
P65 should actually read DCI-P3 D65
my template command line
This is good for P65? I believe, change maxcll and L values as required"C:\Program Files (Portable)\HDRpatcher\nvhsp.exe" -full_range tv -colorprim bt2020 -colormatrix bt2020nc -transfer smpte-st-2084 -chromaloc 2 -maxcll 1000,300 -masterdisplay "G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,0)" "T:\IMPORTS\.hevc" "I:\.hevc"
MediaInfo 17.10 still gives the actual numbers
G, B, R, and WP are the numbers reported by MediaInfo x 50000
Edit
P65 should actually read DCI-P3 D65
Re: HDR -> SDR tonemapping for DGDecodeNV
One other item
The color characteristics (BT2020nc etc) aren't added in, so they must be added in at the container level
My final format is MKV so I use MKVToolNix to add these in when I mux the patched HEVC stream with the audio, etc (no chapters
)
The color characteristics (BT2020nc etc) aren't added in, so they must be added in at the container level
My final format is MKV so I use MKVToolNix to add these in when I mux the patched HEVC stream with the audio, etc (no chapters

Re: HDR -> SDR tonemapping for DGDecodeNV
would you be able to share an example commandline ?
Re: HDR -> SDR tonemapping for DGDecodeNV
If you mean for MKVToolnix I simply add
in the GUI in the input pane.--colour-matrix 0:9 --colour-transfer-characteristics 0:16 --colour-primaries 0:9
Note that the number 0 refers to the track id for the video
Edit
Tested it and the TV switches to HDR mode automatically
Re: HDR -> SDR tonemapping for DGDecodeNV
So, I've been doing some research and it's clear that there are a boatload of different tone-mapping algorithms that we could choose to implement with CUDA. I'm looking at Hable but also a method based on adaptive histogram equalization. The latter would be reminiscent of my VirtualDub windowed histogram equalization filter.
http://rationalqm.us/winhistogram.html
An interesting technical reference in this regard is:
http://citeseerx.ist.psu.edu/viewdoc/do ... 1&type=pdf
I may try to implement something like that. I think a spatially variable method would intuitively give better results, and a CUDA implementation could make it practical.
@Guest
How is the new TV working out and do you have some interesting HDR streams to share with us? Have you experimented with any HDR->SDR stuff?
http://rationalqm.us/winhistogram.html
An interesting technical reference in this regard is:
http://citeseerx.ist.psu.edu/viewdoc/do ... 1&type=pdf
I may try to implement something like that. I think a spatially variable method would intuitively give better results, and a CUDA implementation could make it practical.
@Guest
How is the new TV working out and do you have some interesting HDR streams to share with us? Have you experimented with any HDR->SDR stuff?
Re: HDR -> SDR tonemapping for DGDecodeNV
The new set is working great, the hdr color is the best part.
Got the re encode somewhat figured out, the TV automatically switches to HDR mode automatically.
Note
When using MKVToolNix to mux raw streams, FPS must be specified or it uses 25FPS as default
I almost deleted a bunch of stuff because of synch issues, but I remember to check FPS in time.
I am using my movies as sources, and the set usually brings a 4K and BD discs, so HDR > SDR hasn't been an issue
However this does present a testing opportunity in the comparison stage
Tidbit
4K discs are for vast majority movie only, and they tend to 55GB to 90GB in size
I have seen bitrates, on the video, as high as 90+Mbps
Got the re encode somewhat figured out, the TV automatically switches to HDR mode automatically.
Note
When using MKVToolNix to mux raw streams, FPS must be specified or it uses 25FPS as default
I almost deleted a bunch of stuff because of synch issues, but I remember to check FPS in time.
I am using my movies as sources, and the set usually brings a 4K and BD discs, so HDR > SDR hasn't been an issue
However this does present a testing opportunity in the comparison stage
Tidbit
4K discs are for vast majority movie only, and they tend to 55GB to 90GB in size
I have seen bitrates, on the video, as high as 90+Mbps
Re: HDR -> SDR tonemapping for DGDecodeNV
Thanks for the info, Guest.
What set did you get?
What set did you get?
Re: HDR -> SDR tonemapping for DGDecodeNV
Vizio M65 E0
https://www.amazon.com/VIZIO-M65-E0-Sma ... zio+m65-e0
Extra bit of info
With my single video card I am averaging 80 to 90 FPS on NVEnc encodes
The card is doing double duty, frame serving with DGDecodeNV and encoding with NVEnc
On a double GPU system the speeds could double?
https://www.amazon.com/VIZIO-M65-E0-Sma ... zio+m65-e0
Extra bit of info
With my single video card I am averaging 80 to 90 FPS on NVEnc encodes
The card is doing double duty, frame serving with DGDecodeNV and encoding with NVEnc
On a double GPU system the speeds could double?
Re: HDR -> SDR tonemapping for DGDecodeNV
Thanks. I cannot guess about the answer to your question, because it all depends on how the encoder uses the VP engine versus CUDA, and I don't know anything about that.
Re: HDR -> SDR tonemapping for DGDecodeNV
Quick test encode just to answer my own question
Seems that NVEnc is using 50% to 51% of the VPU
Hardware Monitor says that my VPU is under 97% + load
DGDecodeNV and NVEnc are sharing the VPU fairly equally
Two GPU cards should double the speed, more or less.
Seems that NVEnc is using 50% to 51% of the VPU
Hardware Monitor says that my VPU is under 97% + load
DGDecodeNV and NVEnc are sharing the VPU fairly equally
Two GPU cards should double the speed, more or less.
Re: HDR -> SDR tonemapping for DGDecodeNV
Sounds reasonable.
Re: HDR -> SDR tonemapping for DGDecodeNV
Hey Guest, if I read you correctly you are converting your UHD disks to MKV. How are you ripping these disks?
Re: HDR -> SDR tonemapping for DGDecodeNV
Three decryption tools work
MakeMKV > with hashed key file from MakeMKV website
AnyDVDHD > as is
DeUHD > as is
Note
Check the recommended drives, that is important
MakeMKV > with hashed key file from MakeMKV website
AnyDVDHD > as is
DeUHD > as is
Note
Check the recommended drives, that is important
Re: HDR -> SDR tonemapping for DGDecodeNV
OK, mkv ...
Hmm, for a HDR file playback (vs playback of an SDR file via an older media player, since we are also talking about hdr->sdr) things like "Chromecast Ultra" seem to be becoming ubiquitous, where one can cast files to it from a local media server or from internet sources.
The Chomecast Ultra documentation is ambiguous, it seems to only accept cast files in webm or mp4 media containers per https://developers.google.com/cast/docs/media and it does not mention which container hevc goes into, eg
Without any good reason, I suspect webm is the container to use. I guess that means ffmpeg/VS-with-DG or Nvencc/VS-with-DG to encode to h.265 (did I read somewhere DG liaising with Nvencc's author ?) and then something (ffmpeg?) to mux to webm.
Anyway, for hdr -> sdr/1080i, for me it'd seem to be
(i) ffmpeg/vs-with-DG->mp4mux most likely, or
(ii) Nvencc/vs-with-DG->mp4mux, to a .mp4
... unless you have other thoughts
Hmm, for a HDR file playback (vs playback of an SDR file via an older media player, since we are also talking about hdr->sdr) things like "Chromecast Ultra" seem to be becoming ubiquitous, where one can cast files to it from a local media server or from internet sources.
The Chomecast Ultra documentation is ambiguous, it seems to only accept cast files in webm or mp4 media containers per https://developers.google.com/cast/docs/media and it does not mention which container hevc goes into, eg
Code: Select all
Video codecs (Chromecast Ultra)
HEVC / H.265 Main and Main10 Profiles up to level 5.1 (2160p/60fps)
VP9 Profile 0 and Profile 2 up to level 5.1 (2160p/60fps)
Code: Select all
WebM video and audio
Format Video codec Audio codec Media type string
WebM VP8 Vorbis video/webm; codecs="vp8, vorbis"
WebM (audio only) Vorbis audio/webm; codecs="vorbis"
Anyway, for hdr -> sdr/1080i, for me it'd seem to be
(i) ffmpeg/vs-with-DG->mp4mux most likely, or
(ii) Nvencc/vs-with-DG->mp4mux, to a .mp4
... unless you have other thoughts

Re: HDR -> SDR tonemapping for DGDecodeNV
All I can say is start with a small clip and see which way works best for your needs