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.

 

Go Back   Doom9's Forum > General > Newbies
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th July 2014, 17:08   #1  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
Scene changes grainy

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:

Code:
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)
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite
Overdrive80 is offline   Reply With Quote
Old 11th July 2014, 19:08   #2  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
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....

Last edited by hello_hello; 11th July 2014 at 19:22.
hello_hello is offline   Reply With Quote
Old 11th July 2014, 19:24   #3  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
You can try this, is slow but the result is good, but not fix the trouble.

Code:
/*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)
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite
Overdrive80 is offline   Reply With Quote
Old 12th July 2014, 10:15   #4  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
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.

Last edited by fvisagie; 12th July 2014 at 10:20.
fvisagie is offline   Reply With Quote
Old 15th July 2014, 14:13   #5  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Out of curiosity, did you look at the source to see if the frames in question are more noisy to begin with?
hello_hello is offline   Reply With Quote
Old 15th July 2014, 22:40   #6  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
Quote:
Originally Posted by hello_hello View Post
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.
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite
Overdrive80 is offline   Reply With Quote
Old 19th July 2014, 15:08   #7  |  Link
joka
Registered User
 
Join Date: May 2010
Posts: 28
For temporal radius up to 3 (MDeGrain3) you can try this http://forum.doom9.org/showthread.php?t=168081
joka is offline   Reply With Quote
Old 19th July 2014, 15:40   #8  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
How could implement it to my script?? Thanks
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite
Overdrive80 is offline   Reply With Quote
Old 19th July 2014, 15:48   #9  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
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 .

Last edited by fvisagie; 19th July 2014 at 15:52.
fvisagie is offline   Reply With Quote
Old 20th July 2014, 15:51   #10  |  Link
joka
Registered User
 
Join Date: May 2010
Posts: 28
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.
joka is offline   Reply With Quote
Old 21st July 2014, 00:06   #11  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
Quote:
Originally Posted by joka View Post
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.

Quote:
Loocking on your 2. script - you should use the pre-filtered clip for MDeGrainN (prefiltrado.MDegrainN....) like in the first script.
Upsss, my error.

EDIT: Thanks to your correction, my script works fine for me (prefiltrado.MDegrainN....). I would try your script, but already isnīt necessary. Thanks.
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite

Last edited by Overdrive80; 21st July 2014 at 00:33.
Overdrive80 is offline   Reply With Quote
Old 21st July 2014, 07:53   #12  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
Quote:
Originally Posted by joka View Post
short description:
Thanks.
fvisagie is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:25.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.