Levels before and after filtering
I have written an avs script trying to "improve" the look of my captures: following most of the recommendations about correct levels in yuy2, before filtering I fix the luma in the range 16-235 and then apply TemporalDegrain2 and LimitedSharpenFaster, and I stay in the yuy2 color space without any conversion.
If I check the levels after the filtering, they are in the range 0-255! Is it a normal behaviour for the filters to expand the yuy2 luma to 0-255? Do I have to re-establish 16-235 correct range at the end of my script? |
Can you post your script?
|
Yes, some plugins do expand levels so the output min/max is smaller/larger than the input min/max. I guess you have 2 options: 1.) apply levels again after all plugins that effect levels are used, or 2.) reduce your min/max input levels further in from 16/235 before using plugins that effect levels.
I don't have a lot of experience here. However, if I were in this situation, I would choose option 2. My current view is option 1 sort of seems like undoing some of what the plugins are trying to do. So it may be preferred to give yourself more headroom before using such plugins. Trial and error would be needed to find how much further in from 16 and 235 to go to prevent exceeding those levels after using those plugins. Other threads talk about avisynth or virtualdub utilities that can be used to help find your min and max values. I suppose the best approach would be to trim the entire clip down to one or more sample sections that reach your input level min and max levels, thus saving you the time of iterating through script changes on the entire video. |
3 Attachment(s)
Here is my script:
Code:
# "progressive" fields I use ColorYUV() to reduce the luma range to 16-235 range and some color adjustement to my personal taste, Tweak() to increase contrast and saturation, which increase the levels to 17-254, and then LevelsLumaOnly to shrink back the levels at 16-235 (and a small gamma correction). I simply apply TemporalDegrain2 and LimitedSharpenFast and after the processing the luma levels are now 0-255. At the end I slightly adjust the "black" levels to my taste with LevelsLumaOnly again (still 0-255 range). I am also attaching some picture to show an example of the levels before and after and the results of the script. Levels of original frame: http://www.digitalfaq.com/forum/atta...er-originaljpg Levels of final frame (the "dark distibution" and the "bright distribution" seem ok, but some pixels are out of range) http://www.digitalfaq.com/forum/atta...after-finaljpg Comparison original/restored http://www.digitalfaq.com/forum/atta...-comparisonjpg |
1 Attachment(s)
Thanks Keaton for your reply.
I already tried apply at the end a 16-255 shrink with ColorYUV(levels="PC->TV"), but the result is bad (see picture). http://www.digitalfaq.com/forum/atta...1&d=1593944156 About option 2 I think that the filter may expand anyhow the final levels at 0-255 even with a small correction before (but I have not experiment it). And I think is not recommended to shrink too much the input levels. Your approach to separate the video in several portion is convincing! My concern is that there is a certain effort to work with the proper yuy2 levels before filtering, but finally the levels are 0-255. I also understand that the filters work better with correct input range, so the fix is appropriate. I can leave the final level as they are, because I will play the files only on my PC, but I am not sure that a player will not clip or clamp the queues. And more, if I wish to rework again the colors, for example in VirtualDub, I may have a problem... |
Quote:
|
Are the loose minimum and loose maximum also out of range? It is normal for a few pixels to be out of range in some scenes, such as on the nose of a person. This is done to ensure the rest of the face is properly exposed.
|
Good point!
What I did was to run a small code writing in a file the luma parameters of all frames: Code:
# convert to YV12 (required for Y statistics) What I had was (video --> Luma Min-Max / Luma Loose Min-Loose Max (-4%): org --> 16-254 / 16-250 ColorYUV(cont_y=-20, off_y=-9, off_u=5, off_v=-5) --> 16-235 / 16-231 Tweak(sat=1.3, cont=1.1, coring=false, dither=true) --> 17-254 / 17-250 #LevelsLumaOnly(17, 1.05, 254, 16, 235, coring=false, dither=true) -> 16-235 / 16-231 Loose Max was out of range also, and I checked some significant frame with Code:
Limiter(16, 235, 16, 240, "luma_grey") |
It's not possible to give accurate advice without an unfiltered sample of the original video.
Processing in RGB will expand YUV levels from 16-235 to RGB 0-255. A better analysis would be available with a piece of the original video. |
1 Attachment(s)
Attached a portion of the original video (frame 0 to 220).
It has been captured in HuffYUV with AmarecTV from a S-VHS tape recorded 20 years ago from a DVB-S broadcast (bad transmission, bitrate was low). The VCR is a JVC S-VHS HR-S9500MS, used in play with TBC/NR=on, B.E.S.T.=on, edit=off, D3R=on (setting that in my case gives the best results imo). No frame TBC. The capture card is a Hauppauge USB-Live2. PC is an ASUS laptop running Windows 10. |
I've always been more fond of GUI color grading in VirtualDub ColorMill or Premiere.
I've toyed with DaVinci recently, not fond of the experience. Avisynth is possible, but I generally do all color grading type scripting separate from any sort of corrective or NR filters. Sometimes Avisynth doesn't play nice, doesn't make sense, conflicts. |
Thanks for your reply.
I am a beginner and just wanted to do some basic color correction (in my captures there is too much yellow for my taste), and did it with simple avisynth functions. I will upgrade to ColorMill and VirtualDub for a more advanced correction. I did not know that AviSynth can be problematic mixing color corrections and filtering. I will reduce the avs script to only denoise and sharpening, but at some point in time I have to combine it with the color correction. Do you suggest to include the color correction before, in the middle, or after the denoise+sharpening? (in the meantime I will run some experiment) |
Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.