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. |
18th June 2021, 18:47 | #1 | Link |
Registered User
Join Date: Dec 2003
Posts: 485
|
range limited required?
I have formulated what I hope to be a nice setting for 4k content, however recently noticed some individuals having range=limited in their configuration. Is this a good idea to set? I know my output shows a color range of Limited but didn't physically set that. The source is Limited as well.
|
18th June 2021, 19:03 | #2 | Link | |
Moderator
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,771
|
Quote:
There's also no benefit for encoding in Full from Limited source unless you're coming from a higher bit depth. So doing 8-bit full from 10-bit limited makes sense (64-960 to 0-255 instead of 16-235 preserves more details with less dithering or banding risk). But if the source is already 64-960, there's not really a good way to turn it into 0-1023 that results in better quality. And in the HEVC world, 10-bit decode is pretty universal today, with the exceptions mainly being old mobile devices. |
|
18th June 2021, 19:13 | #3 | Link |
Registered User
Join Date: Dec 2003
Posts: 485
|
Thanks Ben. Do we know if ffmpeg defaults to the source value when encoding? So as part of my workflow should I check the source in MediaInfo and if Color range comes back with Full then add range=full and if it comes back Limited add range=limited? Not sure if it's required to set either way.
Last edited by jriker1; 18th June 2021 at 19:25. |
18th June 2021, 19:46 | #4 | Link |
Registered User
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
|
It does not default to the same as the source, it simply does not set that flag at all.
Players will assume limited if nothing is set, but you must set range=full if the range is full.
__________________
madVR options explained |
18th June 2021, 19:58 | #5 | Link |
Registered User
Join Date: Dec 2003
Posts: 485
|
Thanks. Trying to find it out there. When you are defining this in an x265-params block do you set range=0 if the video is Limited and range=1 if Full? Or do you spell it out?
Last edited by jriker1; 18th June 2021 at 20:46. |
19th June 2021, 08:30 | #8 | Link | |
Registered User
Join Date: May 2005
Posts: 1,462
|
Quote:
Yours is a good question. I too have been surprised to learn all my HDR blu-rays so far (all original, of course) have color range set to Limited. I would have thought HDR would, as first order of business, go to Full range directly.
__________________
Gorgeous, delicious, deculture! |
|
19th June 2021, 11:59 | #9 | Link |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,905
|
I personally always set --range limited to make sure the result is flagged as Limited TV Range and I also make sure that it indeed IS limited tv range when I encode.
Some people also turn on the hard-clipping feature in x265 like so: --min-luma 64 --max-luma 940 for 10bit planar Limited TV Range output. I found that to be a pretty cool feature, 'cause most of the times I output a Limited TV Range 16bit from Avisynth and I checked most of the source, so it should be limited, but just to be sure, I turn on 10bit hard-clipping in x265 as well. I wish x264 had it as well, it would be useful, really useful. Yes. It is a good idea to set it, 'cause if you don't, the decoder (so the player) will have to "guess" and it might guess wrong. Keep in mind that all displays work in RGB and RGB is always Full Range ***, therefore when you specify Limited TV Range, you're telling the decoder how to convert to RGB. For instance, if your source is 64-940 Limited TV Range and you set --range Limited, then the decoder is gonna "expand" 64 to 0 and 940 to 1023 and then it's gonna display it to the screen. On the other hand, if your source is Full Range 0-1023, it will convert it to RGB without changing levels. If you don't set the flag, the player will guess and most of them will just guess that it's Limited TV Range, so nothing bad is gonna happen if your source is limited, but something bad is gonna happen if your source is full. Not just that: people should check using a waveform monitor regardless of the flag when re-encoding. The reason is that I've found plenty of Limited TV Range files whose luma starts right at 64 (as it should) but the highlights exceed 940 by a lot and hence are considered out of range. What happens in this situation? Easy: if you re-encode with the Limited Flag and you send it to a TV, the TV will convert it to RGB and will expand 64 to 0 and 940 to 1023. Fair enough, but what about the values over 940? Well, they're gonna be lost (i.e "clipped out") hence "clipping" occurs. What should be done in that case is a soft highlights roll-back so that those are gonna be brought down to 940. This is a classic example of a 10bit video ending up out of range: over the 0.7V (770mV) and hence over the 940 as you can see from the brown bar. See the wall that looks white? Well, it ain't white, there's still something there, but the end user won't be able to see it, sadly... Few notes: - Broadcast In broadcast studios it is mandatory to have everything in Limited TV Range without it going out of range 'cause not only people are not gonna see it but it *might* result in fines according to which watchdog is watching, how much is out of range and the country you live in, which is why not only I make sure that everything is limited by manually adjusting the waveform, but I also add hard-clipping at the very end so that in things like Live Events like in Sports I don't get surprises. - Overshooting Some light overshoots are still allowed, though. The reason is that, even though you might get the waveform perfectly fine in Avisynth, once you encode with a lossy codec, the approximations that are gonna occur might lead to overshooting, so slightly out of range values. This was very much true for MPEG-2, but way less pronounced for H.264 and H.265, but it still occurs, which is why nobody is gonna tell you anything if you get some light compression overshooting every now and then. - ***RGB is always full range Well, I had to put * here 'cause Studio RGB exists and it's very much a thing. I recently received files from Warner Bros in MJPEG 2000 4:4:4 Studio RGB 12bit planar, which means Limited TV Range 12bit in BT2100 PQ, so not only Studio RGB exists but what I found out is that plenty of the LUTs that are professionally made and agreed between parties work in Studio RGB 16bit planar, which is why in another occasion I had to employ avsresize telling it to convert without changing levels back and forth between RGB and YUV. Last edited by FranceBB; 19th June 2021 at 12:04. |
19th June 2021, 13:06 | #10 | Link | |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,733
|
Quote:
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
|
19th June 2021, 13:08 | #11 | Link | |
Registered User
Join Date: May 2006
Posts: 3,997
|
Quote:
|
|
19th June 2021, 14:24 | #12 | Link | |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,905
|
Quote:
When I'm at that point I'm generally already working on a file in our MAM with Davinci Resolve or AVID Media Composer, but Avisynth-wise that would be done with a custom made LUT which you can apply in RGBP16 with Cube(). Last edited by FranceBB; 19th June 2021 at 14:27. |
|
21st June 2021, 23:15 | #14 | Link |
Registered User
Join Date: May 2006
Posts: 3,997
|
Is 'limited range' really legacy only? Isn't it a a measure to prevent signal clipping which would produce harmonics and intermodulation, broadening the analog spectrum which may cause crosstalk and interference between adjacent broadcast (TV) channels? Even in digital systems the transmitted signal is still an analog waveform (e.g. modem on last mile copper wires).
Last edited by Sharc; 21st June 2021 at 23:19. |
22nd June 2021, 00:22 | #15 | Link | |
Moderator
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,771
|
Quote:
While RF may require a limited range in the signal domain, today RF is just delivering a digital payload, video levels and RF levels are entirely decoupled. And it's been a long time since we've had to worry about 0 - 6 <> 0. I advocated for us to use PQ in full range, because a new EOTF needed to be implemented anyway, and with PQ there cannot be anything below the minimum value because you can't have negative light, and being able to code >10,000 nits would be asking for trouble. And getting the extra 128 steps back could help reduce banding a bit. But someone had already shipped something that needed limited range for HDR, and the opportunity was lost. And thus a lot of time was lost instead in messed-up range conversions for RGB or XYZ to YUV PQ, which took months to iron out. |
|
22nd June 2021, 20:44 | #16 | Link | |
Registered User
Join Date: May 2006
Posts: 3,997
|
Quote:
|
|
24th June 2021, 17:50 | #17 | Link | |
Moderator
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,771
|
Quote:
I don't think I've seen an actual wraparound problem in video this millennium. Although there are so many kinds of video glitches it can be hard to know what's the cause of any given one. |
|
24th June 2021, 19:40 | #18 | Link | |
Registered User
Join Date: May 2006
Posts: 3,997
|
Quote:
While full range or limited range and Studio Encoding acc. ITU-R BT.601-7 etc. may indeed be confusing, I found it often more difficult to ensure that the encoded YUV (YCbCr) triplets - although all valid within the specified range - result in valid RGB values after conversion to RGB (for viewing on a monitor) without compromising too much on 'vibrance' and saturation. |
|
24th June 2021, 23:53 | #19 | Link | |
Moderator
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,771
|
Quote:
In Y'CbCr one can define a very red-saturated black mathematically, even though that can't be expressed in RGB (or via light for that matter). Half of my contributions in video pipeline optimization over the decades was asking "do we REALLY need to convert into RGB to do that? Hand me the dry erase marker..." I've seen Y'CbCr -> RGB -> HSL to figure out luminance too many times. In my ideal world it'd all be Bayer -> ACES -> encoder. Or, ideally ACES -> ACES profile of VVC -> ACES display controller -> native panel color volume. |
|
28th June 2021, 07:55 | #20 | Link |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,905
|
Well, since we're talking about annoying things from the past, what about overscan/safe area?
To this very day, in 2021, some TVs still crop the image... and for what? Only 'cause back in the days timecodes and teletex subtitles were not muxed but rather displayed in the inactive lines of the screen which were not meant to be displayed to the user... Nowadays, in 2021, everything is muxed, it would be madness to put the timecode or subtitles there when you can easily just mux them in the container, but TVs still crop all around the screen, getting rid of what is actually a part of the image that should be displayed and they do that "just to play safe"... |
|
|