Log in

View Full Version : Please help me fix the colors opening a Rec2020 SDR from UHD with AVISynth+


Qaenos
19th May 2021, 07:47
I have a .mkv file that was taken from a SDR UHD that seems to be Rec2020.

When I use MPC-HC with the MPC Renderer to open the mkv file, the colors look great.

When I use AVISynth+ to open the file (via MPC-HC + MPC Renderer or MadVR), the colors are off - they look like they do when I play the UHD on my tv and force BT.709. Red looks like orange.

I've tried all kinds of source filters including DirectShowSource, DSS2, LSMASH, LibavVideoSource, FFMS2 , and even DGSource. All of them can open the file but have the same problem (wrong colors).

Here's some more details of the video:

Video
ID : 1
ID in the original source medi : 4113 (0x1011)
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : Main 10@L5.1@High
Codec ID : V_MPEGH/ISO/HEVC
Duration : 1 h 37 min
Bit rate : 65.0 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.327
Stream size : 44.2 GiB (96%)
Language : Japanese
Default : Yes
Forced : No
Color range : Limited
Color primaries : BT.2020
Transfer characteristics : BT.2020 (10-bit)
Matrix coefficients : BT.2020 non-constant
Original source medium : Blu-ray


Can anyone help me open the file properly and/or fix the colors via AVISynth+?

Boulder
19th May 2021, 10:45
Take a look at DGHDRtoSDR if you need to tonemap it. If you are planning to re-encode it and watch it on an HDR capable display, there's no need to tonemap.

Qaenos
19th May 2021, 14:03
Take a look at DGHDRtoSDR if you need to tonemap it. If you are planning to re-encode it and watch it on an HDR capable display, there's no need to tonemap.

Thank you for your response.

I thought DGHDRtoSDR was for HDR sources. This is an SDR source. Are you suggesting I use it because of the fact that the color is Rec2020?

It looks like there are two modes in DGHDRtoSDR. "PQ" and "HLG". Which one do I use?

manolito
19th May 2021, 14:39
You are probably correct that your source does not need tonemapping at all, it's just the color primaries, the transfer characteristics and the color matrix which need to be converted.

The ColorMatrix command for AVS does not seem to work correctly for REC.2020, at least this is what I read in some posts here. But there is the zscale command which can do what you need. The syntax is a little complicated, TheFluff and poisondeathray are the guys to help you with this.

But you can also try DGHDRtoSDR. Its tm parameter lets you adjust the strength of the tonemapping:
tm=0.9 Strength of tonemapping. Reduce this towards 0.0 to smoothly transition to blowout (clipping) of highlights. This value controls a LERP between Reinhard tonemapping and no tonemapping. Default is 0.9.

And no idea if PQ or HLG work better for you. Try both...

Qaenos
19th May 2021, 14:43
But you can also try DGHDRtoSDR. Its tm parameter lets you adjust the strength of the tonemapping

Ok, so basically set tm=0 and I'm good to go?

kedautinh12
19th May 2021, 14:47
The ColorMatrix command for AVS does not seem to work correctly for REC.2020

Here for info: http://forum.doom9.net/showthread.php?t=176773

manolito
19th May 2021, 15:04
Ok, so basically set tm=0 and I'm good to go?

I guess so, but I never tried it. Maybe ask videoh (the author)... ;)

Arx1meD
19th May 2021, 18:01
For my videos, I use this method:ConvertBits(16).ConvertToPlanarRGB()
Cube("FranceBB LUT Collection\PQ_to_BT709_v1.cube", cpu=4, fullrange=true)
ConverttoYUV420().ConvertBits(10)