View Full Version : Stabilize Chroma
Blue_MiSfit
24th May 2008, 02:02
Hey folks,
Well, I've got a curious problem today. I'm working on Arabian Nights from Universal Studios. It's an older movie, and I'm trying to back it up. The source I was given is a 24p 4:2:0 15mbps MPEG-2 PS with MP2 audio. It's decent quality, but there are definitely some issues. Unfortunately, I can't post samples due to licensing restrictions :(
The main issue is chroma instability. This source isn't too noisy, but there is a lot of flickering in both chroma planes. This makes the white balance move around a lot, which x264 doesn't like very much. I've tried stabilizing it with ColorYUV(autowhite=true), and this does a fantastic job of stabilizing. However, it leaves the white balance much too cool. I need to warm things up!
Is there a method out there for stabilizing chroma, while allowing me to "lean" towards warm or cool? I'm sure I could do this nicely in After Effects, Shake, or some other compositor, but I need to use AviSynth, mostly because it's free and it's all I know :D
I had the idea of using the VirtualDub filter DeShake from Donald Graft, or the MSU attempt. I don't really know how to use VirtualDub filters in AviSynth though... Also, these seem to be designed to remove luma flicker. I guess I could just apply the filter to the chroma planes manually?
Maybe something simpler.
Ideas?
Thanks :D!
~MiSfit
Guest
24th May 2008, 02:48
The source I was given is a 24p 4:2:0 15mbps MPEG-2 PS with MP2 audio. Please dispel the rule 6 concern this raises.
Deshaker is by Gunnar Thalin (not me). It is for camera shake, not flicker correction.
Dark Shikari
24th May 2008, 03:00
Ttempsmooth set for chroma only?
fft3dfilter on plane=3?
thetoof
24th May 2008, 07:49
ColorYUV(autowhite=true), and this does a fantastic job of stabilizing. However, it leaves the white balance much too cool. I need to warm things up!
If it works, use that + YLevels set to a "warm" preset.
Blue_MiSfit
24th May 2008, 20:56
I didn't realize the YLevels parameter could do such a thing. I will try that when I get back to work on Tuesday (or maybe if I get guilt ridden this weekend I will remote in :D)
@neuron2:
Addressed in PM
Sorry guys I think I meant to say DeFlick, not DeShake. Damned nomenclature...
I tried fft3dfilter on the chroma planes, and it did stabilize a little bit - but not much. There's a fair amount of chroma detail (and noise) since this is a relatively good source, and I don't want to brutalize it at sigma 5 or anything like that.
I will have to try ttempsmooth.
Thanks!
~MiSfit
Dark Shikari
24th May 2008, 21:21
If the problem is flicker, you can try fft3dfilter with a very very large sigma4, and much lower values for the other sigmas. This keeps detail while reducing flicker.
*.mp4 guy
24th May 2008, 22:50
fft3dfilter will soften the look of the picture, though, by reducing the contrast between large areas, atleast thats the best way i can explain it. Your best bet is to use autolevels, then use something like GiCoCu or ylevels to warm it back up.
actually, this should get rid of any residual bluring from fft3d:
source = last
source = last
w = width
h = height
fft3d = source.fft3dfilter(bw=w, bh=h, ow=(round((w-5)/4)*2), oh=(round((h-5)/4)*2), sigma=0.1, sigma2=0.1, sigma3=0.5, sigma4=128, plane=3, bt=4)
diff = mt_makediff(fft3d, source)
blurdiff = diff.bilinearresize(8, 8).blur(1.42).blur(1.42).blur(1.42).blur(1.42).blur(1.42).blur(1.42).blur(1.42).blur(1.42).bilinearresize(w, h)
mt_adddiff(source, blurdiff)
completely untested, but it should work, in theory.
Didée
25th May 2008, 01:17
diff = mt_makediff(fft3d, source)
blurdiff = diff.bilinearresize(8, 8) .many_many_times_blur(1.42).bilinearresize(w, h)
mt_adddiff(source, blurdiff)
That's pretty inprecise, no? Bilinearresize is sampling only a small fraction of all available pixels, and the blur-chain will accumulate rounding errors.
Oh, and setting mt_filters to actually operate on the planes of interest might be beneficial, too. ;)
diff = mt_makediff(fft3d, source, Y=1,U=3,V=3)
blurdiff = mt_lutf(diff,diff,mode="average",expr="x",U=3,V=3)
mt_adddiff(source, blurdiff, Y=2,U=3,V=3)
But I think this kind of "global" adjustment isn't quite the right thing either ... it's hard to judge without having seen how the problem actually looks like.
*.mp4 guy
25th May 2008, 16:54
Hmm, well it was just a quick fix I thoght of,though, you are of course quite right about the problems with the way i implemented it. Though, if autolevels fixes the problem, I'm sure that the problem has to be global.
Blue_MiSfit
27th May 2008, 18:32
Hmmm... I see that the YLevels function operates on luma, according to the AviSynth Wiki. How can this affect the color of the image??
Clearly I'm missing something :)
~MiSfit
Didée
27th May 2008, 18:57
Whatever your're missing, you're not alone. Presets in Ylevels? :confused:
Perhaps one morning we woke up in a parallel universe ...
... or thetoof had another filter in mind and typed 'Ylevels' only by mistake. ;)
Blue_MiSfit
27th May 2008, 19:21
Straight from the horse's mouth - so to speak :D
I gave up on that idea, and went back to fft3d. I had good luck with this:
fft3dfilter(sigma=.1, sigma2=.3, sigma3=.5, sigma4=50, plane=3)
DeGrainMedian(limitY=3, limitUV=4, mode=4)
hqdn3d(1.5)
gradfun2db(2)
I wasn't able to get the nifty MaskTools script working. I suspect it's due to plugin version issues (damned masktools and mt-masktools etc etc), but things look good now. Less chroma instability, and I cleaned the picture pretty nicely too. The source actually has a lot of banding hidden by its noise / grain. Dithering was _essential_!
~MiSfit
thetoof
28th May 2008, 01:59
Hmmm, how about I invite you in my parallel world?
Here's the key: unedited typo and confused memory :p
I wanted to type Ulevels because I had a function in mind (automatically ajusts YUV with some presets) and I thought it was the right one (obviously, it's not). It's something that does good 'n easy color corrections...
Anyways, the function I prefer to ajust sources when the white balance is off is ColorYUV(off_u=x,off_v=y). To get warmer colors (i.e. add yellow & red), use a negative value for U and a positive value for V.
About that, I have a somewhat noobish question: I had been using gain_u/v for a while because I saw it being used here (http://www.animemusicvideos.org/guides/avtech/avspostqual.html)... but I've been using off_u/v since I read in the documentation that it doesn't make sense to apply "gain" on the chroma channel. What are the pros & cons of using either of them??
Wilbert
28th May 2008, 10:11
About that, I have a somewhat noobish question: I had been using gain_u/v for a while because I saw it being used here... but I've been using off_u/v since I read in the documentation that it doesn't make sense to apply "gain" on the chroma channel. What are the pros & cons of using either of them??
Chroma is centered around 128. So, if you want to stretch chroma (similar as using gain_y for luma) you need to use cont_u/cont_v, since that stretches from the center.
cobo
18th October 2008, 17:05
I'd like to get rid of chroma fluctuations in a PAL to NTSC conversion.
Hetre's a 6MB sample: http://www.sendspace.com/file/ybqpmo
I tried using FFTDfilter as suggested in this thread but it seems to accentuate the color fluctuations if anything. Using ColorYUV(Autowhite=true) doesn't help much and the color but turns it too blue, which I haven't been able to rectify satisfactorily using ColorYUV or Tweak. Half a dozen or more iterations of LUTDeRainbow seems to help a little.
Does anyone have any other ideas?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.