View Full Version : Black Level Correction
datascab
3rd February 2004, 23:38
Hi,
I'm using Real Producer and it has a nice feature called Black Level correction which fixes the washed out look.
I think it corrects black and white contrast areas.
I notice it most when viewing my encode on my TV.
Without the correction, the dark screens have like macroblocks, whatever the bitrate.
With the correction, they are not visible and the video looks much better.
I was hoping to do something similar in avisynth since I do all my other pre-processing in it.
Thanks
Data
sh0dan
3rd February 2004, 23:59
Try adding:
Levels(0,1.0,255,0,255)
Histogram("levels")
This will diplay luma levels visually. Adjust the first '0' upwards until black is where the brown area begins in the top graph. Do the same to the first "255". Now you have the best possible black level.
See more about Histogram here (http://www.avisynth.org/index.php?page=Histogram) and more about Levels here (http://www.avisynth.org/index.php?page=Levels). The advanced version is to do the adjustments visually in ffdshow, and transfer the numbers to the script - but you need to know a bit about ffshow.
Valky
16th September 2004, 15:43
Like this?
http://students.turkuai.fi/users/toviital/temp/pic.jpg
I can clearly see that upper picture is much better when the first value is adjusted, but what about settings in other value (the first 255)?
Is the original picture in bottom better in this area? If I raise the 255 value too much, then the whole picture gets too dark.
Bottom picture values are default and settings for the upper picture is:
Levels(14,1.0,265,0,255)
Wow! The difference is amazing when watchin clip on TV.
Since this is realtime filter, is this same kind of adjusting possible to do in ffdshow decoder, so you can see how much to adjust in realtime on your TV? Now I have to adjust different settings for every encoded material in VDub.
I wish I had known this before, when I encoded my fishing videos. Althought they look good in your monitor, they all loog too greenish on TV.
Cyberia
16th September 2004, 19:34
I can clearly see that upper picture is much better when the first value is adjusted, but what about settings in other value (the first 255)?
Is the original picture in bottom better in this area? If I raise the 255 value too much, then the whole picture gets too dark.
Bottom picture values are default and settings for the upper picture is: Levels(14,1.0,265,0,255)
No, no, no. You want to lower the Input Max, not raise it. What you are doing is defining the min and max brightness/contrast and then stretching those values to the absolute limit.
Set the input limit to be <= the output limit. If I am reading the histogram right, you could lower the input max to 200ish.
Basically, define the band where the useful/desired brightness/contrast information is define, then stretch that range to fill 0-255.
Valky
16th September 2004, 20:09
Ah, just like I thouht. Thanks for clarifying this. Itäs just that I got the wrong expression from shodan's post that I should go upwards on both numbers.
But I understand now what histogram means.
EpheMeroN
16th September 2004, 22:36
Try adding:
Levels(0,1.0,255,0,255)
Histogram("levels")
Should we use that levels setting for output that will be displayed on both Televisions and Monitors? ...because I thought TV Levels by default were 16,235. Please clarify this :)
sh0dan
17th September 2004, 17:48
@EpheMeroN: Levels are per default scaled from 0->255 to 16->235 in YUV mode, so (0,1.0,255,0,255) will be neutral, and NOT affect non 601 range. If you want to specify it in full-range YUV, use (coring=false) - default settings will be the same, but the scale will be different. And it will result in 0->255 ranged output video.
sweeppicker
17th November 2004, 23:34
Thanks for your post. Im a newbie to avisynth and a dummy about scripting. Could you post the script verbatim you just reffered to that gives you full range YUV for encoding. Does this explain why DV source material in YUV space looks washed out after burned to DVD ? Is it because DVD encoders clamp everything to 16-235. I use CCE and I thought it let me encoded full range 0 -255. But the videos still looked washed out and the colors faded. (I'm feeding it .mov files in Quicktime exported from Final Cut Pro in YUV colorspace.) I'm amazed when I watch professional DVDs and they have full range black levels. So from what it sounds like your script will allow me to use CCE and produce DVDS that have black levels that are faithful to my NLE master ? I know this is a big problem that affects alot of us. Our japanese DV cameras record 0 -255 but when you preview your levels and color correction on an NTSC monitor as you edit and you then burn your DVD to have everything looked washed out its soooo frustrating. Thanks a bunch !
trevlac
21st November 2004, 15:04
@sweeppicker
(I'll just talk Blacklevel but this applies to all the values)
This topic always seems to be more confusing and messy than it should be. Bottom line, every step of the process could mess with it, and most steps allow you to change/fix it.
If CCE is receiving RGB from your codec, there is a CCE setting to adjust between 16-235 and 0-255. Even if your codec is a native YUV type, you can't really assume you are feeding CCE YUV.
In the spirit of generally knowing what is really going on ... I recommond one of the following:
1) Run a known value all the way thru the process and see what you get. You can then adjust just before the end (like in CCE). Hopfully your cam outputs colorbars. If not, maybe you can film with the cap on and assume it is close to black. Make an mpeg and open it and measure black. Depending on how you do this, you are probably going to be looking at RGB values. Black should be zero. You have to be careful in this measuring. It really depends on what the decoder is doing ... but the standard should be zero.
2) Run a known value and measure it every step of the way. This is really where you learn what is going on. Avisynth is great for this. With info functions, you can see what your decoders are producing (YUV or RGB) and the values. Once you know what is going on, try to make sure things don't keep changing back and forth. AKA get it to the colorspace and range you want, and try to keep it there thru the process.
BTW: If you stay in digital, NTSC, NTSC-J, PAL, etc. have zero differences when it comes to black level. Black is always 16 YCbCr for DV. What cam's output analog may well differ, so they may not be great to use as a DV-Analog converter, but digital is nice in that you can set balck (and white) on the PC, using numbers not your eyes.
Sorry for such a long post ... but I tend to babble about this stuff.
ColorYUV(Levels="PC->TV") would map 0-255 YUV to 16-235 YUV. May or may not fix your problem.
trevlac
21st November 2004, 15:16
Originally posted by datascab
Without the correction, the dark screens have like macroblocks, whatever the bitrate.
With the correction, they are not visible and the video looks much better.
I think this is a problem with coring/truncation. If the YUV black ranged say from 8 to 32 and it was all set to 32, you'd get a lack of color depth. I believe this is called contoring for the general case, and happens when any of the colors are 'compressed' to a too small range. This is why 10-bit is better than 8-bit. Bigger color range.
Anyway, i wanted to pipe in just to say that there are a bunch of ways to adjust for this. But in the end, you want the blacks that matter (not like the borders) to have a big enough range so they appear smooth. Beleive it or not, adding noise does this.
sweeppicker
21st November 2004, 18:59
HI Trevlac,
I m gonna run a known value like you said. I ve never used Avisynth so hopefully this will be easy to figure out. However, I am staying digital through the entire process - firewire dv capture to dvd burning. My camera captures black down to 0 IRE not the 7.5 standard we have in the US. All my NLE color corrections are done within a range of 0 -255 and exported that way in the resulting .mov file.
"ColorYUV(Levels="PC->TV") would map 0-255 YUV to 16-235 YUV. May or may not fix your problem."
I ll try this but I dont see how it would preserve my black levels if it forces the lowest value to 16. There must be some trick those hollywood dvd authors are using to keep their blacks so true. lol.
"AKA get it to the colorspace and range you want, and try to keep it there thru the process."
This is the part I havent figured out how to do.
I m gonna try and run the tests this weekend and report my findings afterwards. Thanks !
trevlac
21st November 2004, 20:36
My camera captures black down to 0 IRE not the 7.5 standard we have in the US. All my NLE color corrections are done within a range of 0 -255 and exported that way in the resulting .mov file.
...
I ll try this but I dont see how it would preserve my black levels if it forces the lowest value to 16. There must be some trick those hollywood dvd authors are using to keep their blacks so true. lol.
Hi,
You are talking about a few different things at once. Not that you are wrong ... just that mixing them together makes things unclear.
You camera 'captures' analog black thru its lense and puts it on tape compressed as DV. DV compression uses the YCbCr color space (most often called YUV which is not technically the same thing). 8-bit YCbCr, there are 0-255 possible values. Absolute black is set at 16. White at 235. You camera may well go outside of this range, but it is doubtful that it actually sets black at 0 YCbCr. 16-235 is the standard. Since the DVD player knows black is 16 (because it knows the standard) it sets the proper voltage when it outputs an analog signal for your TV. IRE is a generic analog scale. Once in digital, this is the wrong thing to use. When your DVD player outputs a value of 16, it should set black to IRE 7.5 in the US and IRE 0 elsewhere. The point to be concerned about IRE is way past your camera. The only reason to fret about this setup thing is if you use your camera to output to an NTSC monitor. In this case, just output colorbars and adjust the monitor black level. Don't adjust the video.
The doom9 capture guide has a bunch of stuff about digital color that might help. http://www.doom9.org/capture/digital_video_color.html
I know there are write-ups about the 7.5IRE setup issue, but they cause more confusion than they should.
PS: I'm no pro at this stuff. It's just that after enough little bits become clear ... the other stuff falls into place.:D
sweeppicker
21st November 2004, 23:04
Hi Trevlac,
Thanks for correcting me. I've read alot of posts on this topic and I don't want to bore you with it. From what I've deciphered I'm probally looking at my video wrong since I'm color correcting it off a computer LCD instead of a professional monitor. It's on my to do list ! lol. My DVD videos in fact looking pretty damn good on a tv set thanks to CCE SP. I m just trying to overcome the balck levels issue. I see darker black levels on commercial dvds than my own. Maybe I 'm just out of luck without a pro monitor. Perhaps the fact that my video is displayed in RGB on my computer screen is the problem and I'm getting a false impression of what it actually looks like in YCbCr. Hope I didnt mix any terms up.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.