View Full Version : Chroma correction suggestions needed (sample included)
cherbette
2nd December 2011, 18:08
Thus far, I have been mostly using a combination of Camcorder Color Denoise and Neat in VirtualDub to remove the Chroma & Luma noise. There are a few other slight issues as well like halo'ing which I've never worked with before. Below is an un-touched sample and my script "in progress" lol...any tips would be much appreciated.
Short Clip: http://www.mediafire.com/?ad68557cz7oprob
Script:
Avisource("Cher Bowie.avi")
AssumeTFF()
ConvertToYV12(interlaced=true).Trim(177,8924)
Crop(16,4,-8,-4)
Dehalo_alpha()
AddBorders(12,4,12,4)
ConvertToRGB32(matrix="Rec601",interlaced=true)
Followed by CCD & Neat in VirtualDub
johnmeyer
2nd December 2011, 19:46
I will be very interested in what others come up with. I have quite a few videos with similar halo issues and don't have a good solution.
However, I might be able to help with the denoising. The script below is the combination of several different scripts and code snippets found in this forum. You will see in the degrain interlaced function (MDegrain2i2) a crude attempt at removing chroma haloing using MergeChroma. It works quite well for certain types of VHS chroma problems, but doesn't do anything for your particular example. However, the denoising part of the script, which is pretty much "stock" MDegrain, but adapted for interlaced material, seems to do a nice job on the noise in your clip.
I commented out the sharpening step because, even though it does make the video detail stand out better, it also tends to accentuate the very problem you are trying to eliminate.
SetMemoryMax(768)
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll")
LoadPlugin("c:\Program Files\AviSynth 2.5\plugins\CNR\Cnr2.dll")
SetMTMode(5,0)
source=AVISource("E:\Documents\Dnload\UNPACK\Cher Show ( guest Steve Martin) Sample.avi").AssumeTFF()
SetMTMode(2)
#Old chroma restoration VirtualDub plugin for analog source material
chroma=source.Cnr2("oxx",8,16,191,100,255,32,255,false) #VHS
#Note: I get best results on most VHS sources with MDegrain2i2(chroma,8,4,0) with function below set to use MDegrain3
#However, it is S-L-O-W with these settings, so I didn't use those here
output=MDegrain2i2(chroma,8,0,0)
#stackvertical(source,output)
#stackhorizontal(source,output)
return output
#-------------------------------
function MDegrain2i2(clip source, int "blksize", int "overlap", int "dct")
{
Vshift=0 # determine experimentally
Hshift=4 # determine experimentally
overlap=default(overlap,0) # overlap value (0 to 4 for blksize=8)
dct=default(dct,0) # use dct=1 for clip with light flicker
fields=source.SeparateFields() # separate by fields
#This line gets rid of some types of chroma halo
#fixed_fields=MergeChroma(fields,crop(fields,Hshift,Vshift,0,0).addborders(0,0,Hshift,Vshift))
#This line will shift chroma down and to the right instead of up and to the left (which is what line above does)
fixed_fields=MergeChroma(fields,Crop(AddBorders(fields,Hshift,Vshift,0,0),0,0,-Hshift,-Vshift))
super = fixed_fields.MSuper(pel=2, sharp=1)
backward_vec2 = super.MAnalyse(isb = true, delta = 2, blksize=blksize, overlap=overlap, dct=dct)
forward_vec2 = super.MAnalyse(isb = false, delta = 2, blksize=blksize, overlap=overlap, dct=dct)
backward_vec4 = super.MAnalyse(isb = true, delta = 4, blksize=blksize, overlap=overlap, dct=dct)
forward_vec4 = super.MAnalyse(isb = false, delta = 4, blksize=blksize, overlap=overlap, dct=dct)
MDegrain2(fixed_fields,super, backward_vec2,forward_vec2,backward_vec4,forward_vec4,thSAD=400) #original setting
# Add next three lines and comment out above line to use MDegrain3 instead of MDegrain2
# backward_vec6 = super.MAnalyse(isb = true, delta = 6, blksize=blksize, overlap=overlap, dct=dct)
# forward_vec6 = super.MAnalyse(isb = false, delta = 6, blksize=blksize, overlap=overlap, dct=dct)
# MDegrain3(fields,super, backward_vec2,forward_vec2,backward_vec4,forward_vec4,backward_vec6,forward_vec6,thSCD1=400,thSAD=400)
#Optional sharpening
#unsharpmask(60,3,0) #not sure whether to put this before or after the weave ...
Weave()
}
Didée
2nd December 2011, 21:02
It seems that, for whatever reason, the U channel is delayed by 1 or 2 frames. (Difficult to tell exactly - chroma resolution is very poor, and the motion in the sample is "small")
corrected for an U channel delay of 2 frames, TGMC-bobbed, then used aWarpSharp2 to further squeeze chroma onto luma:
http://thumbnails62.imagebam.com/16246/4a75a0162452591.jpg (http://www.imagebam.com/image/4a75a0162452591)
Video sample (http://www.mediafire.com/?lr9b3xmbw719717)
avisource("Cher.Show.(guest.Steve.Martin).Sample.avi") # avisource did choke one the space characters
assumetff()
YtoUV( UtoY().selectevery(1,2), VtoY(), last )
tempgaussmc_beta3(1,1,2,edimode="--")
mergechroma( awarpsharp2(depth=16,thresh=255,blur=3) )
johnmeyer
3rd December 2011, 01:05
As always, great stuff, Didée.
I've used QTGMC, but not its predecessor (tempgaussmc_beta3) but I assume that its output is progressive. I also assume (perhaps wrongly) that the OP wanted to keep the result interlaced. Therefore, I tried using your technique inside separatefields()-->weave() so as to retain the interlaced nature of the original. Since no re-sizing is being done, I think this is OK.
The result is the script below (same as what I posted above, but with the essence of the Didée function added). I also retained my original chroma shift code, in order to deal with some of the residuals. However, I think my MergeChroma code should be deleted and instead, I should apply a dehalo filter to get rid of the halos (look at his back as he walks right to left). However, I tried this (you can see the code below, commented out), but while it did slightly reduce the intensity of the halos, it killed a lot of detail.
SetMemoryMax(768)
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll")
LoadPlugin("c:\Program Files\AviSynth 2.5\plugins\CNR\Cnr2.dll")
Import("E:\Documents\My Videos\AVISynth Scripts\QTGMC-3.31.avsi") #
import("C:\Program Files\AviSynth 2.5\plugins\Dehalo.avsi")
SetMTMode(5,0)
source=AVISource("E:\Documents\Dnload\UNPACK\Cher Show ( guest Steve Martin) Sample.avi").AssumeTFF().converttoYV12(interlaced=true)
SetMTMode(2)
#Only use chroma restoration for analog source material
chroma=source.Cnr2("oxx",8,16,191,100,255,32,255,false) #VHS
#Set overlap in line below to 0, 2, 4, 8. Higher number=better, but slower
#For VHS, 4,0 seems to work better than 8,2. Most of difference is in shadows
#However, 8,0 is good enough and MUCH faster. 8,2 doesn't seem to make much difference on VHS.
output=MDegrain2i2(chroma,8,0,0)
#stackvertical(source,output)
#stackhorizontal(source,output)
return output
#-------------------------------
function MDegrain2i2(clip source, int "blksize", int "overlap", int "dct")
{
Vshift=0 # 2 lines per bobbed-field per tape generation (PAL); original=2; copy=4 etc
Hshift=2 # determine experimentally
overlap=default(overlap,0) # overlap value (0 to 4 for blksize=8)
dct=default(dct,0) # use dct=1 for clip with light flicker
fields=SeparateFields(source) # separate by fields
super = fields.MSuper(pel=2, sharp=1)
backward_vec2 = super.MAnalyse(isb = true, delta = 2, blksize=blksize, overlap=overlap, dct=dct)
forward_vec2 = super.MAnalyse(isb = false, delta = 2, blksize=blksize, overlap=overlap, dct=dct)
backward_vec4 = super.MAnalyse(isb = true, delta = 4, blksize=blksize, overlap=overlap, dct=dct)
forward_vec4 = super.MAnalyse(isb = false, delta = 4, blksize=blksize, overlap=overlap, dct=dct)
MDegrain2(fields,super, backward_vec2,forward_vec2,backward_vec4,forward_vec4,thSAD=400) #original setting
YtoUV( UtoY().selectevery(1,2), VtoY(), last )
#QTGMC( Preset="Very Fast", FPSDivisor=2, EdiThreads=0, ShowSettings=false )
mergechroma( awarpsharp2(depth=16,thresh=255,blur=3) )
#This line gets rid of vertical chroma halo
#MergeChroma(crop(Hshift,Vshift,0,0).addborders(0,0,Hshift,Vshift))
#This line will shift chroma down and to the right instead of up and to the left
MergeChroma(Crop(AddBorders(Hshift,Vshift,0,0),0,0,-Hshift,-Vshift))
#Attempt to de-halo the result (dulls halos slightly, but reduces detail -- bad tradoff, at least with these settings)
#DeHalo_alpha(rx=1.75,ry=2.8,darkstr=0.66)
Weave()
}
cherbette
4th December 2011, 16:15
I can upload a longer sample if it would help. I appreciate the tips you guys. Gonna tinker around a bit.
cherbette
4th December 2011, 16:56
@johnmeyer...the line: "import("C:\Program Files\AviSynth 2.5\plugins\Dehalo.avsi")"
...is that DeHalo_Alpha or....?
Also...thanks to you and Didée for your help thus far :)
I might also add a few details...I am using a Sony slv-n700 VCR with a Panasonic DMR-E55 as a TBC passthru and a Diamond VC500 USB capture device...capturing in VirtualDub. Screen shots of the current settings in my Panasonic DVDR TBC passthrough: http://forum.videohelp.com/threads/338999-Calibrating-luminance-levels-color-for-capture-from-VHS?p=2109252&viewfull=1#post2109252
johnmeyer
4th December 2011, 18:01
@johnmeyer...the line: "import("C:\Program Files\AviSynth 2.5\plugins\Dehalo.avsi")"
...is that DeHalo_Alpha or....Look at the actual function call in the script (next to last line).
cherbette
4th December 2011, 18:04
I forgot to add that I did see that...and corrected the "import" line for myself to "dehalo_alpha.avsi"
Didée noted that the Chroma resolution in my sample was very poor. Would increasing the saturation in my proc amp at capture improve this problem? The saturation is currently set at it's "default" level in my proc amp...4000 out of 10000 (40%)
cherbette
5th December 2011, 21:23
Didée or others do you have any suggestions as to removing some of the halo? it's especially noticeable around the "vh1" logo? The scripts from johnmeyer and Didée both have been so helpful. I adjusted a few things but otherwise it was magic. :)
http://img221.imageshack.us/img221/725/47368333.th.png (http://imageshack.us/photo/my-images/221/47368333.png/)
Uploaded with ImageShack.us (http://imageshack.us)
cherbette
14th December 2011, 15:15
*bump*
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.