Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
6th March 2017, 15:42 | #1 | Link |
Registered User
Join Date: Oct 2016
Posts: 56
|
Convert HDR to SDR
Hello!
How to make HDR conversion in SDR (fullrange 8bit bt709)? Here are two examples, HDR and SDR. HDR 2160p (UBDRip): https://yadi.sk/i/wP4oZQjo3F6BnZ SDR 1080p (BDRip): https://yadi.sk/i/aXC0fsF73F6Bnh If use a conversion madVR http://s012.radikal.ru/i319/1703/4a/30402f28b209.png That result looks like this http://screenshotcomparison.com/comp...2580/picture:0 upd: more samples https://cloud.mail.ru/public/2iEk/CiyUARGZy Last edited by zub35; 23rd March 2017 at 14:34. |
6th March 2017, 16:55 | #2 | Link |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,905
|
FFMpegSource2 or LibawVideoSource can dither it down to 8bit 2160p for you, then all you need is a resizer and colormatrix.
Something like: FFMpegSource2("video.h265", fpsnum=24000, fpsden=1001) Spline64Resize(1920, 1080) Converttoyv12(interlaced=false, matrix="PC709") It's really simple as that. Feel free to use Spline64ResizeMT for better performance, or any other resizer. If you want even more quality, use NNEDI, even though, for downscaling, Spline64Resize is generally enough. |
7th March 2017, 20:32 | #6 | Link |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,905
|
Ok, so if both ffms2 and libaw screw levels while dithering, then maybe how about using the 10bit hack to import the HDR source directly into avisynth and then use the Dither Tool to dither down to 8bit instead?
|
8th March 2017, 13:16 | #7 | Link |
Registered User
Join Date: Oct 2016
Posts: 56
|
FranceBB, I think that the Y-component needs to be cut somehow before converting from 10 to 8 bits.
Simple conversion gives a faded result. Without contrast аs SDR. MadVR does this via pixel shading, additionally applying filtering compress highlights. From 10 bits to 8 bits, this is one case with the application of dithering. But the conversion of HDR to SDR here is already a more complicated case, and is not limited to just dithering. Example of a file with HDR and example necessary result - I gave. If necessary, I will provide more examples of HDR&SDR sources. Maybe for proper conversion, is needed new plugin or new instructions in Avisynth+ Last edited by zub35; 8th March 2017 at 14:30. |
11th March 2017, 00:23 | #8 | Link | |
Registered User
Join Date: Nov 2004
Location: Poland
Posts: 2,843
|
Quote:
|
|
12th March 2017, 08:45 | #10 | Link |
Registered User
Join Date: Oct 2002
Location: France
Posts: 2,316
|
Do you have a link, by any chance, which explain where the complexity lies ?
Because i didn't realy understand where it could be. The only thing i may see whould be just if there is a non-linear function somewhere, and instead of just a linear matrix : YUV (REC2020) -> RGB -> YUV (REC709) you would have : YUV (REC2020) -> (linear matrix) R'G'B' -> RGB (with non linear function) -> YUV (REC709) (linear matrix). So, if you have any link which may explain the detail/specificiation of it, and why it's more complex, i'm curious. |
12th March 2017, 13:39 | #12 | Link | |
Registered User
Join Date: Nov 2004
Location: Poland
Posts: 2,843
|
Quote:
http://www.mysterybox.us/blog/2016/1...delivering-hdr |
|
13th March 2017, 14:40 | #13 | Link |
Registered User
Join Date: Oct 2002
Location: France
Posts: 2,316
|
I have the feeling i'm missing or don't understand something.
The video (in H265 for exemple), has to be decoded to "standard" RGB values to be displayed, otherwise the display will be wrong. I can understand that in the process of the creation of the UHD Blu-Ray (for exemple), there is some non-linear parts, but, after, this has to be displayed, so the decoder during one step of the process has to "reverse" this, to create a "standard" RGB. Meaning, there is a "simple" equation/formula to do this, otherwise, it would not be possible to display such streams. ... There something i've the feeling i'm missing... |
13th March 2017, 15:32 | #14 | Link |
Registered User
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,079
|
Have you seen this post in the VapourSynth thread? Looks interesting...
https://forum.doom9.org/showthread.p...67#post1800667 |
23rd March 2017, 10:07 | #16 | Link |
Registered User
Join Date: Oct 2002
Location: France
Posts: 2,316
|
I've got informations here :
BT.2020 BT.709 From what i've understood (some, anyone else is free to read and correct me if necessary) : The gama correction formula is the same between BT.709 and BT.2020. But, in BT.2020, there is two YCbCr possibilities, when there is only one in BT.709. If you are in what they call "Non-constant luminance", the standard linear matrix formula will work, and the usual method used for doing BT.601 <-> BT.709 conversion will also work with BT.2020. But, if you are in what they call "Constant luminance", things are differents ! But with these documents, we have all necessary formula to make HDR/SDR conversion (i think...). |
23rd March 2017, 11:11 | #17 | Link |
Registered User
Join Date: Nov 2004
Location: Poland
Posts: 2,843
|
"Non-constant luminance" is used way more for Rec.2020.
For HDR you actually need to look at HDR10 (SMPTE ST-2084, HLG, etc), which I assume should give you some hint how to go from HDR to SDR. Also, looks like things going to be shifting into Rec.2100 with new ICtCp color space, which meant to improve compression by 10%. Last edited by kolak; 23rd March 2017 at 11:20. |
23rd March 2017, 11:17 | #18 | Link |
Registered User
Join Date: Oct 2002
Location: France
Posts: 2,316
|
The problem, is if you are in "Non-constant luminance", i don't see what could prevent HDR/SDR conversion like described in post #2 working...
Except in post 2 it's missing BT.2020 somewhere... I would see more ConvertToRGB(matrix="REC2020") (don't remember exactly the name of matrix). ConvertToYV12(matrix="PC709") But according document, doing this should work on "Non-constant luminance". Last edited by jpsdr; 23rd March 2017 at 11:23. |
23rd March 2017, 11:25 | #19 | Link |
Registered User
Join Date: Nov 2004
Location: Poland
Posts: 2,843
|
I don't know, but HDR to SDR is not trivial. It's more about how to shrink all these HDR info into much "tighter" SDR signal avoiding any tint, hue shifts etc. I know that eg. Technicolor is trying to make some tools for semi automated conversion. This tool analyses each scene an uses some adaptive conversion.
It ca be doe with fixed math- Resolve has node (and LUT) for it and this is rather simple fixed math. |
23rd March 2017, 12:25 | #20 | Link |
Registered User
Join Date: Oct 2002
Location: France
Posts: 2,316
|
I see nothing of the sort in the R-REC-BT.2020-2-201510-I!!PDF-E document, maybe this document is not enough to convert BT.2020 and don't cover the whole part, but i thought it would be...
Or... i've missed it in the document...? Didn't see the edit part, i'll look for this. Edit Found things here on ITU... But access only to ITU users... Seems to be difficult to get proper informations. It seems maybe there is things here. Bigger than others, it will take a little more time to understand properly i think. There is also the R-REP-BT.2390-2016-PDF-E document. Edit 2 WTF !!! I've begin to try to read the R-REC-BT.2100-0-201607-I!!PDF-E document, it's horrible, and yes... not so easy at all. Last edited by jpsdr; 23rd March 2017 at 12:48. |
|
|