View Full Version : Scene changes grainy
Overdrive80
11th July 2014, 17:08
Hi, I have a problem filtering a video and I dont know how to fix it. I use mdegrain3 for filtering temporal grain, but I notice that in each sceneīs change, two first frames are grainy and this occur in each sceneīs change.
If I use mdegrainN, with tr=12... this effect is minor but not disappear fully.
How I can avoid this?
Thanks in advance.
Code example:
original=last
aa=spline64Resize(width(original)*2,height(original)*2).SangNom2(aa=29).spline64Resize(width(original),height(original)).mergechroma(original)
prefiltrado= dfttest(sigma=8,tbsize=1,tmode=0,lsb=true).ditherpost(mode=2)
super=Msuper(prefiltrado)
backward_vec3 = MAnalyse(super, isb = true, delta = 3, overlap=4,search=4)
backward_vec2 = MAnalyse(super, isb = true, delta = 2, overlap=4,search=4)
backward_vec1 = MAnalyse(super, isb = true, delta = 1, overlap=4,search=4)
forward_vec1 = MAnalyse(super, isb = false, delta = 1, overlap=4,search=4)
forward_vec2 = MAnalyse(super, isb = false, delta = 2, overlap=4,search=4)
forward_vec3 = MAnalyse(super, isb = false, delta = 3, overlap=4,search=4)
prefiltrado.MDegrain3(super,backward_vec1,forward_vec1,backward_vec2,forward_vec2,backward_vec3,forward_vec3,
\thSAD=370,plane=4,lsb=true).ditherpost(mode=2)
hello_hello
11th July 2014, 19:08
I don't have an answer as such but I've noticed the same thing myself. Lots of times. I've always assumed some sort of de-noising was used when producing the Bluray/DVD disc, and whatever de-noising tends to be used, it doesn't de-noise the first frame in a scene change as well, or maybe not at all. Or maybe the denoising is applied while editing and it doesn't denoise the first frame it's given to process very well, which would tend to be the first frame of a scene change.
Then when you run an additional noise filter, even if it removes an equal amount of noise from each frame, you're left with an initial frame which still has more noise than the rest. Have a close look at the source video.
Some of the standard avisynth noise removal filters don't seem to denoise the first frame in a scene change so maybe even denoisers which can, aren't able to remove the same amount of noise from them and the problem compounds a bit.
Edit: Thinking about it, the problem may have been they don't denoise the first frame in an encoding job, and not that they don't denoise the first frame in each scene.
I ran a bunch of encodes to compare noise filter plugins a while back and I recall degrainmedian and FluxSmooth either didn't denoise the first frame or didn't remove much, but I don't recall noticing the same thing with any of the script based denoising I tried at the time, such as TemporalDegrain, FastDegrain and QTGMC (progressive mode, noise filter enabled). I've denoised lots of video since with QTGMC's EzDenoise and sometimes it's nice and even, while sometimes many of the initial frames in a scene are obviously different. After checking the source video a few times I've concluded the main culrpit is the original de-noising. Or maybe I'm wrong.... ;)
Overdrive80
11th July 2014, 19:24
You can try this, is slow but the result is good, but not fix the trouble.
/*Prefiltrado*/#
pre=original.dfttestMC(sigma=1.6,tbsize=1,lsb=true).ditherpost(mode=2)
mascara=pre.mt_edge("sobel",thY1=0, thY2=0,thc1=5,thc2=10).mt_invert()
prefiltrado=mt_merge(original, pre, mascara)
#/*Filtrado temporal*/#
tr = 12
super= MSuper(prefiltrado,mt=true)
multi_vec = MAnalyse (super, multi=true, delta=tr, overlap=4,search=4)
MDegrainN (super, multi_vec, tr, thSAD=xxx, thSAD2=yyy,plane=4,lsb=true).ditherpost(mode=2)
fvisagie
12th July 2014, 10:15
Isn't this to be expected with any temporal filter - the first frame has no isb=true frames to work with in this case, the next still lacks isb=true delta=2 etc.? In other words, if this is correct the effect would be more noticeable with noisier source, and the first frames should look closer to your source than the others.
You could try replacing the first frames with more-heavily denoised ones, and/or adding copies of the first frame before it(*), and/or replacing the first frames with spatially denoised ones etc. Best approach will vary with source material.
Edit: looking at that * again, I think it's of limited use ;). You might want to experiment with adding noise-injected copies of the first frame (to slightly randomise content) before it when you need heavy denoising - at least you'll end up with a similar-looking amount of detail removed.
hello_hello
15th July 2014, 14:13
Out of curiosity, did you look at the source to see if the frames in question are more noisy to begin with?
Overdrive80
15th July 2014, 22:40
Out of curiosity, did you look at the source to see if the frames in question are more noisy to begin with?
Yes, I did look but frames wasnt more noisy than others frames.
joka
19th July 2014, 15:08
For temporal radius up to 3 (MDeGrain3) you can try this http://forum.doom9.org/showthread.php?t=168081
Overdrive80
19th July 2014, 15:40
How could implement it to my script?? Thanks
fvisagie
19th July 2014, 15:48
That looks like the right thing to do under these circumstances, very interesting indeed. I'm just having a bit of trouble understanding the algorithm of the re-ordering approach. For example, it's unclear to me what you mean by "other before scene change"? Would you mind explaining the algorithm in a bit more detail? Feel free to do so in the original thread; I'm just cautious of being accused of resurrecting old threads :).
joka
20th July 2014, 15:51
short description:
SC_Analyse() ... detects the scene change and provides a small clip with different values for each of the three frames before and each of the three frames after a scene change and one value for all other frames ("other before scene change" and "other after scene change").
Scene change detection can be influenced with the parameter dfactor. This is the one and only critical parameter. SCSelect from RemoveDirt package is used to detect scene changes. The default should be sensefull. To be realistic - scene change detection takes time and is never perfect.
SC_Interleave() ... provides for each original frame 7 frames (3 may be reordered "previouse frames", the original frame and 3 may be reordered "next frames"). The provided frames depend on the scene change analysis.
SC_Select() ... Selects the middle frame out of the 7 frames after processing. AviSynth will only calculate this frame (never the 6 other ones).
To include it in your first script:
-----
last
sc_clip=SC_Analyse()
SC_Interleave(sc_clip)
original=last
#### place your script here
SC_Select()
-----
Loocking on your 2. script - you should use the pre-filtered clip for MDeGrainN (prefiltrado.MDegrainN....) like in the first script. May be the result is acceptable. I would expect, that a tr=6 on scene changes is compareable to a MDeGrain3 in the middle of a scene (both have original+6 frames to work with), but I have never used MDeGrainN.
Overdrive80
21st July 2014, 00:06
short description:
To include it in your first script:
-----
last
sc_clip=SC_Analyse()
SC_Interleave(sc_clip)
original=last
#### place your script here
SC_Select()
-----
Thanks so much.
Loocking on your 2. script - you should use the pre-filtered clip for MDeGrainN (prefiltrado.MDegrainN....) like in the first script.
Upsss, my error. :stupid:
EDIT: Thanks to your correction, my script works fine for me (prefiltrado.MDegrainN....). I would try your script, but already isnīt necessary. Thanks.
fvisagie
21st July 2014, 07:53
short description:
Thanks.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.