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. |
1st July 2013, 16:29 | #1 | Link |
Registered User
Join Date: Mar 2013
Posts: 27
|
Correcting a video with huge contrast?
Hi. I'm dealing with a terrible source again, and this time it's the Bad Tour Wembley DVD of Michael Jackson (released in 2012). There are lots of problems with the "enhancing" job of the VHS tape, like over-sharpened, but the biggest problem is the contrast of the video was adjusted way large. It's too black on places that aren't supposed to be that black, especially with his eyes. Same problem with white areas but lighter compared to the black problem.
Here's a comparison. On the left is the video source I'm trying to improve, and on the right is the normal color. Levels and Tweak won't make it look much better, because there are some places like the background that's truly supposed to be black, and they only makes the picture looks more grey. My idea is to make gradual change of luma. Use Levels to make black parts not so black at first, detect dark areas and gradually make the middle part darker. For small black areas like his eyes, the gradual change won't make much different, but for large black areas like the background, it could make it's middle part darker like it's supposed to be. This, I think, could make the picture looks better in some degree. But unfortunately I haven't found any filters doing that, and I'm not able to make my idea into script so far. So, could anyone here help me find a way to solve that problem? Thanks in advance! |
1st July 2013, 19:22 | #3 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
Looks like a job for SGradation (discussed here)
Code:
# output luma with gamma < 1.0 # ^ # 255+ + # | + # | + # | + # | + # | + # | + # 128+ +++ # | + # | + # | + # | + # |+ # |+ # 0+-------------+-------------+> input luma # 0 128 255 Last edited by raffriff42; 24th August 2013 at 22:37. Reason: link to updated SGradation entry |
1st July 2013, 22:09 | #4 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,695
|
AVISynth and its plugins are a marvelous tool for many jobs, but if I were facing this problem, AVISynth would be the last thing I would think of using. In my video editing program (Vegas), I have a number of "plugins" that the program provides, including a histogram correction feature, similar to what "raffriff42" shows above. I'd use that, along with color correction, in order to match different scenes.
|
1st July 2013, 22:21 | #5 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,695
|
I did a screen grab of the "bad" still shot you posted, and then put that in my video editing program (Vegas). It took three plugins, adjusting the controls interactively using the real-time GUI feedback that any full-fledged editing program provides, but in the end I think I came up with something that is pretty close to matching the "good" still shot you posted above:
So, once again, try the controls in your video editing program and I think you'll get better results than anything you are likely to be able to do with AVISynth. |
1st July 2013, 23:00 | #6 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
Meh, not great, but better than before. EDIT - agreed, a GUI would have been helpful.
Code:
#avisynth C1=ImageSource("sgrad-test-1.jpg") C1=C1.Crop(0, 0, 512, 384).ConvertToYV12() ## original image #return C1 #@func SGradation2(clip clp, val "gammalite", val "gammadark") ## less midrange contrast C2=C1.SGradation2(0.3, 0.3) ## more overall contrast C2=C2.Levels(42, 1.0, 192, 16, 235) ## stage one complete #return C2 ### optional ### LoadModule("avslib", "filters", "channels") ## clamp red, hackishly (EDIT: should have used Limiter) V=C2.ShowV V=V.Levels(0, 1.0, 160, 0, 255, coring=true) V=V.Levels(0, 1.0, 255, 0, 160) C3=MergeYUV(C2.ShowY, C2.ShowU, V) ## stage two complete #return C3 ### compare all ### return StackVertical( \ C1.Histogram(mode="levels").Subtitle("before"), \ C2.Histogram(mode="levels").Subtitle("SGrad+Levels"), \ C3.Histogram(mode="levels").Subtitle("clamp red")) Last edited by raffriff42; 16th March 2017 at 14:41. Reason: (fixed image link) |
2nd July 2013, 03:22 | #7 | Link | ||
Registered User
Join Date: Mar 2013
Posts: 27
|
Quote:
Quote:
That looks much better. Thank you so much for it, and I'll try adjusting it with that method right away. |
||
2nd July 2013, 15:02 | #8 | Link |
Registered User
Join Date: Mar 2013
Posts: 27
|
SGradation works great, but this happens sometimes (on the right, where you can see the luma blocks):
What should I do? Is there a better way than MaskTools + MedianBlur, without ruining useful details? Or is there a smart luma smoother that can handle it (I tried SmoothHiQ but it doesn't work)? |
3rd July 2013, 13:02 | #10 | Link | |
Registered User
Join Date: Mar 2013
Posts: 27
|
Quote:
Edit: Oh, sorry, should have increased the thr value. Last edited by HappyLee; 3rd July 2013 at 13:49. |
|
3rd July 2013, 23:14 | #11 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
There is only so much that can be done. See the HDR AGC thread for a good discussion of the issues involved.
This call to HDRAGC Code:
HDRAGC(max_gain=2.0, max_sat=1.0, black_clip=10.0) Code:
SGradation2(0.3, 0.55) Last edited by raffriff42; 3rd July 2013 at 23:32. Reason: sample code |
4th July 2013, 21:39 | #12 | Link | |
Registered User
Join Date: Dec 2007
Location: Germany
Posts: 632
|
Quote:
SmoothCurve() will give you plenty control. Make use of it's debug view show=true. |
|
5th July 2013, 00:45 | #13 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
i'm going to post in defence of colourists everywhere and say perhaps the producers wanted it that way?
it's a bit heavy-handed i'll agree. also, having graded live shows before, you can't be sure those two pics are even slightly comparable (his pose is identical, but he's perhaps the best dancer in the last century so that makes sense). if the flare abates for a few frames you'll find the black-level crashes through the floor... with crushed blacks, there's no recovering them... best just let them go. personally i would never have smashed them that hard unless johnny-big-nuts-producer insisted and i wanted to placate him or shut him up...
__________________
sucking the life out of your videos since 2004 |
5th July 2013, 03:32 | #14 | Link | |
Registered User
Join Date: Mar 2013
Posts: 27
|
Quote:
|
|
5th July 2013, 05:27 | #15 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
SmoothAdjust is pretty neat. I found I could stretch the blacks to an extreme degree without banding or blotchiness.
Code:
#avisynth C1=ImageSource("sgrad-test-2.jpg") C1=C1.Crop(0, 128, 512, 256).ConvertToYV12() ## SGrad C2=C1.SGradation2(0.6, 0.6) ## Smooth - moderate #C3=C1.SmoothCurve(Ycurve="0-0;4-0;8-12;36-66;245-235;255-255", smooth=200, dither=100, show=false) #C3=C3.SmoothLevels(23, 1.1, 255, 0, 255) ## Smooth - extreme C4=C1.SmoothCurve(Ycurve="0-0;4-0;8-26;36-66;245-235;255-255", smooth=200, dither=100, show=false) C4=C4.SmoothLevels(30, 1.35, 255, 0, 255) S=StackVertical( \ C4.Subtitle("Smooth"), \ C2.Subtitle("SGrad")) ## exaggerate the artifacts return S.Levels(0, 1.9, 255, 0, 255) Agree w/ Mug Funky on the futility of trying to rescue this particular video, especially if the stage lights are constantly changing. Last edited by raffriff42; 18th March 2017 at 01:40. Reason: (fixed image link) |
21st July 2013, 17:21 | #16 | Link |
Registered User
Join Date: Mar 2013
Posts: 27
|
I improved SGradation with SmoothAdjust. Finally the color banding problem is solved. Here's my code for SGradation2S (S for smooth):
Code:
function SGradation2S(clip clp, val "gammaW", val "gammaB") { gW=float(default(gammaW,1.0)) gB=float(default(gammaB,1.0)) gc=clp.GreyScale() dk=gc.SmoothLevels(16,1.0/gB,127,16,127,smooth=200,limiter=1) lt=gc.SmoothLevels(235,1.0/gW,128,107,0,smooth=200) r=Overlay(dk,lt,mode="add") r.MergeChroma(clp) } Last edited by HappyLee; 22nd July 2013 at 05:10. |
Thread Tools | Search this Thread |
Display Modes | |
|
|