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. |
20th November 2022, 16:45 | #201 | Link |
Registered User
Join Date: Oct 2018
Posts: 319
|
May I ask why the default pct_hdr_skin for PQMode in ConvertXYZ_BT2446_C_HDRtoSDR is set to 0.44? I haven't seen anything in ITU-R BT.2408 regarding this, only about HLG.
__________________
AviSynth AiUpscale |
20th November 2022, 19:03 | #202 | Link |
Registered User
Join Date: Oct 2002
Location: France
Posts: 2,309
|
I don't remember exactly... But if indeed there is nothing in BT.2408, i probably "estimate" it using informations from several BT, and i probably choose this value because "it seems not too bad".
There is probably some curve or anything which lead me to this choice.
__________________
My github. |
20th November 2022, 20:45 | #203 | Link |
Registered User
Join Date: Oct 2018
Posts: 319
|
Ah ok, I think I know why you did it. 44% PQ equals 50 nits, same as 50% HLG. It doesn't seem too bad indeed.
__________________
AviSynth AiUpscale |
20th November 2022, 22:49 | #204 | Link |
Registered User
Join Date: Oct 2018
Posts: 319
|
I found something funny looking at your code, not that it's in the least important, but I think I should let you know. You use 2.404 as the power in the BT.1886 EOTF, but the last 4 is actually a footnote . It's not that it's important as I say, but when I found the reason it made me laugh.
Also, I'm not too sure that the inverse OETF should be used, ITU repeats all over the place something that seems to imply this opinion, but I can understand why you do it.
__________________
AviSynth AiUpscale |
4th June 2023, 21:15 | #208 | Link |
Registered User
Join Date: Feb 2014
Posts: 355
|
Color Conversion: How To Tonemap BT.2020 To BT.709
First, many thanks jpsdr for all your effort .
I was gifted a UHD Blu-ray but don't have a 4K TV, so I figured I'd shrivel it to 1080p using AviSynth after color converting and resizing losslessly with VirtualDub2. Unfortunately, after hours of effort, I can't figure out how to tonemap BT.2020 to BT.709. I'm here because it seems to me that that's what your HDRTools plugin is for but using Code:
ConvertYUVToXYZ(Color=1) ConvertXYZToYUV(pColor=1) Ahhh, a video sample. Last edited by LouieChuckyMerry; 4th June 2023 at 21:18. Reason: Link To Test Clip |
5th June 2023, 12:03 | #209 | Link | |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
|
Quote:
Code:
ConvertBits(16) ConvertYUVtoXYZ(Color=0, OutputMode=1, HDRMode=0, fullrange=false) ConvertXYZ_Reinhard_HDRtoSDR(exposure_X=2.5, contrast_X=0.9) ConvertXYZtoYUV(pColor=0) Converttoyuv420() |
|
6th June 2023, 00:48 | #210 | Link |
Registered User
Join Date: Feb 2014
Posts: 355
|
Thanks for your reply, FranceBB. Your suggested script runs fine but doesn't appear to change the video in any way; i.e., the output looks the same as the input, dull and muted (the same-looking result as the script I posted above).
|
6th June 2023, 07:05 | #211 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,718
|
If you have an nVidia GPU available, you can use DGHDRtoSDR to do the grading in one simple step. DGIndexNV can be used to tune the parameters per source.
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
6th June 2023, 11:58 | #212 | Link | |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
|
Quote:
Anyway, here's a comparison: This is done with the following script: Code:
FFVideoSource("D:\TestClip2[2160p].mkv") SinPowerResize(848, 480) original=last.Text("BT2020 HDR PQ 1043 nits - Original") ConvertBits(16) hbd=last ConvertYUVtoXYZ(Color=0, OutputMode=1, HDRMode=0, fullrange=false) ConvertXYZ_Reinhard_HDRtoSDR(exposure_X=2.5, contrast_X=0.9) ConvertXYZtoYUV(pColor=0) Converttoyuv420() ConvertBits(bits=10, dither=1) Text("BT709 SDR 100 nits - Reinhard tonemapping") tonemapped=last ConvertToPlanarRGB(hbd, matrix="Rec2020", interlaced=false) Cube("C:\Programmi\AviSynth+\LUTs\PQ_to_BT709_v2.cube", fullrange=true) Converttoyuv420() ConvertBits(bits=10, dither=1) Text("BT709 SDR 100 nits - FranceBB LUT") lutted=last StackVertical(original, tonemapped, lutted) If you like the last one, then I strongly suggest you to check this out: https://forum.doom9.org/showthread.php?t=176091 |
|
7th June 2023, 01:58 | #213 | Link |
Registered User
Join Date: Feb 2014
Posts: 355
|
Boulder: Thanks for your reply. I do have an nVidia GPU and a license for DGIndexNV, so I'll attack your suggestion ASAP.
_____________ FranceBB: Thanks again for your help. Your latest suggestion looks good but I'll need a goodly stretch of free time to wrap my head around it. _____________ I should have time this weekend to work on the above, possibly (but doubtfully) earlier. I really appreciate the help . _____________ Edit: FranceBB: I took a quick look at your last link and, wow, that's really cool! Of course, I understand it intellectually but not really any of the details . Last edited by LouieChuckyMerry; 7th June 2023 at 18:46. Reason: That's Cool |
18th March 2024, 09:35 | #215 | Link | |
Registered User
Join Date: Jun 2022
Posts: 30
|
Quote:
Code:
Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4 Format settings : CABAC / 4 Ref Frames Format settings, CABAC : Yes Format settings, Reference fra : 4 frames Codec ID : V_MPEG4/ISO/AVC Duration : 3 h 0 min Width : 1 920 pixels Height : 1 080 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 Bit depth : 8 bits Scan type : Progressive Writing library : x264 core 164 r3179 12426f5 Default : No Forced : No Color range : Limited Color primaries : BT.2020 Transfer characteristics : PQ Matrix coefficients : BT.601 ffmpeg sets such data in the output: Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p(tv, smpte170m/bt2020/smpte2084, progressive), 1920x1080, q=2-31, 23.98 fps, 1k tbn Last edited by rgr; 18th March 2024 at 09:43. |
|
18th March 2024, 10:35 | #216 | Link | ||
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
|
Welcome to the world of frame properties, rgr!
No, jokes aside, it's not actually HDR but the reason why ffmpeg is reading it as HDR is that the frame properties are not updated. When I wrote the script initially, we were in simpler times, when Avisynth only had the good old clip properties. Anyway, to signal the right properties to ffmpeg you need to set them manually, so your script would become: - For HDR Tools Quote:
- For LUTs Quote:
Needless to say, I hate frame properties. Frame properties have their own utility in the sense that we can now tell other things outside of Avisynth (like the filter_builder in FFAStrans, FFMpeg, MPV etc) what we're outputting from Avisynth, but the problem is that not every function sets them correctly, so you almost always end up with the wrong ones. An easy workaround is to get rid of them all, always, at the very beginning, right after indexing, write the script as you're used to back when Avisynth didn't have them, then populate the right ones manually at the very end. This is how I've done it for all the supply chains at work anyway, while for my personal stuff at home I use x264/x265 directly which don't really give a crap about frame properties so I'm safe from this. Last edited by FranceBB; 18th March 2024 at 10:40. |
||
18th March 2024, 15:26 | #217 | Link |
Registered User
Join Date: Jun 2022
Posts: 30
|
Yes, I just found out.
If it already exists, it's a pity it doesn't have a pixel aspect ratio. I also found in my notes: "Color primaries" had an effect only on Quick Time... "Transfer characteristics" did not have an effect on any player. "Matrix coefficients" was the one that mattered in proper BT.601/BT.709 reproduction... |
Thread Tools | Search this Thread |
Display Modes | |
|
|