View Full Version : Is there a deflickering/destrobing plugin that works like this?
Katie Boundary
21st February 2023, 05:46
Average luma of previous frame = p
Average luma of current frame = c
Average luma of next frame = n
p/4 + c/2 + n/4 = x
(basically a sort of temporal gaussian luma blurring, but calculated on a per-frame rather than a per-pixel basis)
Now multiply the luma value of every pixel in the current frame by x/c
And I guess it would need scene-change detection, but otherwise there would be no parameters to adjust.
joka
21st February 2023, 07:45
This is a temporal Gauss and the basic idea of QTGMC.
joka
21st February 2023, 08:07
To get the average luma you can try
Function average_mask (clip c) {
cm = c.BiLinearResize(4, 4).Crop( 2, 2, 0, 0)
cm = Expr(cm, cm.FlipHorizontal(), cm.FlipVertical(), cm.FlipHorizontal().FlipVertical(), " x y + z + a + 4 / ")
Return cm.PointResize(c.width(), c.height())
}
The other part you can do in an Expr.
Arx1meD
21st February 2023, 11:09
Perhaps a script like this would work.
LoadPlugin("GRunT.dll")
c = dss2("C:\test\example.mkv")
br = 10
threshold = 15
debug = false
pre = c.Crop(br, br, -br, -br).Blur(1.58).Blur(1.58).Blur(1.58)
gScriptClip(c, """
Y_c = AverageLuma(pre)
Y_p = YDifferenceFromPrevious(pre) > threshold ? Y_c : AverageLuma(pre, offset=-1)
Y_n = YDifferenceToNext(pre) > threshold ? Y_c : AverageLuma(pre, offset=1)
x = Y_p/4.0 + Y_c/2.0 + Y_n/4.0
delta = x - Y_c
gain = x/Y_c
ColorYUV(gain_y=gain, off_y=delta)
Y_corr = AverageLuma(last)
debug == true ? \
LetterBox(br, br, br, br, color=$ff3333)\
.Subtitle("\n" + \
"Luma\n" + \
"Average\n" + \
"Delta\n", \
lsp=0, font="Courier New", text_color=$ffffff, x=br+10, y=br+5)\
.Subtitle("Previous\n" + \
""+string(Y_p)+"\n" + \
""+string(x)+"\n" + \
""+string(delta)+"\n", \
lsp=0, font="Courier New", text_color=$ff3333, x=br+95, y=br+5)\
.Subtitle("Current\n" + \
""+string(Y_c)+"\n" + \
"\n" + \
""+string(Y_corr)+"\n", \
lsp=0, font="Courier New", text_color=$33ff33, x=br+215, y=br+5)\
.Subtitle("Next\n" + \
""+string(Y_n)+"\n", \
lsp=0, font="Courier New", text_color=$00aaff, x=br+335, y=br+5) : \
last
""", args="pre, br, threshold, debug")
johnmeyer
21st February 2023, 17:27
If you use MDegrain (from MVTools2) and set DCT=1 in the MAnalyze call which precedes MDegrain, I think you will get what you want.
wonkey_monkey
21st February 2023, 21:09
If you use MDegrain (from MVTools2) and set DCT=1 in the MAnalyze call which precedes MDegrain, I think you will get what you want.
Huh? I'm confused as to what a motion plugin has to do with an algorithm description that has nothing to do with motion...
johnmeyer
22nd February 2023, 07:03
Huh? I'm confused as to what a motion plugin has to do with an algorithm description that has nothing to do with motion...Because it is a great way to reduce flicker! While Katie did ask about a specific algorithm, and I'll admit that I did not bother to pull the source code and see how DCT=1 computes the interaction with adjacent frames, if the goal is to actually fix a video, rather than just run some academic exercise, then I can tell you from hundreds of hours of deflickering movie film that DCT=1 can perform miracle.
From the MVTools2 documentation:use dct=1 for clip with light flicker
Finally, as I'm sure you know, the MVTools2 package includes a lot more than estimating pixel positions at intermediate points in time.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.