Quantcast Avisynth: Filter to Clean up a Noisy Source with MA Script? - digitalFAQ.com Forums [Archives]
Go Back    digitalFAQ.com Forums [Archives] > Video Production Forums > Avisynth Scripting

Reply
 
LinkBack Thread Tools
  #1  
10-09-2003, 05:03 PM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
I'm trying to encode "Deliverance" and since it's an old movie (1972) it's quite noisy. Hence I'm having trouble with getting a high CQ value. What filter can I use to clean up the movie? Please, let me know what filter to use, settings and placement in the script.
__________________
AudioSlave
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
10-10-2003, 04:23 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
In the MA Script you can find a Line including STMedianFilter.
Just change it to Deen()
(download Deen() via Warpenterprises)

or change to
TemporalSoften(2, 10, 10, 15, 2)
(No Filter download necessary, included in MPEG2Dec3.dll)

Its heavy but you will kill noise. On the other Hand many details will be lost, for exampe killed structures in Hairs or flat surfaces in Skins.

TemporalSoften for me is the best compromise cause
- Its fast
- Its the Filter which keeps the most details when doing a "normal, not to heavy" denoise

But if set to heavy, the Picture in Surfaces will look like viewed through a Glass with "static" Dots. So watch out!

So use MA like this:
Code:
## Defined Variables and Constants ## 
# 
MaxTreshold = 1.50 
nf =* 0 # Current frame. 
# 
#### 

## Main section and static filters ### 
# 
Mpeg2Source("Your_D2V_Source_Here") 
#  
Limiter() 
asharp(1, 2) 
GripCrop(Your_GripCrop_Parameters_Here) 
GripSize(resizer="BicubicResize") 
TemporalSoften(2, 10, 10, 15, 2) 
undot()
MergeChroma(blur(MaxTreshold)) 
MergeLuma(blur(0.1)) 
# 
# 

## Linear Motion Adaptive Filtering ## 
# 
# ( Portions from AviSynth's manual ) - This will apply temporalsoften to 
# very static scenes, and apply variable blur on moving scenes. 
# We also assign a variable - and this is why a line break is inserted: 

SwitchThreshold = (Width<=352) ? 4 : (Width<=480) ? 3 : 2 
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= SwitchThreshold ? \ 
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \ 
TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) , 1, 1) ") 

# 
# 
# 

GripBorders() 
#LetterBox( Your_Values_Here ) # Depends on situation. Use MovieStacker! 
Limiter() 

# 
# 
## Functions ### 

function fmin( int f1, int f2) { 
* return ( f1<f2 ) ? f1 : f2 
} 
* 
# 
####
Well I tried a lot on "old" sources an even if TemporalSoften is already used in the MA Routine it gave me a very good quality Stream with more CQ an keeped Details when also placed in front of the MA routine too.

If you lost to much details just change to
TemporalSoften(1, 8, 8, 15, 2)

The undot() is put behind TemporalSoften to eliminate a little bit the mentioned "viewed through a Glass with static dots" effect.
The Threshold of Asharp is set to (1, 2) to avoid sharpen more the noisy surfaces in the movie.

BUT!

If someone can tell me how to configure TemporalSoften in the MA Routine that it handles the "static" Scenes more heavy with individual parameters ... let me know! Makes more sense.
Just to avoid the double filtering.

Like this?
Code:
TemporalSoften( fmin( round(3/nf), 6), round(2/nf) , round(3/nf) , 1, 2) ")
Can someone explain detailed how the mathematical calculation routine of the MA Part works.

Well I'll try some settings at Weekend.
Reply With Quote
  #3  
10-10-2003, 06:38 AM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
I would leave the "temporal" values out completely in STMedian and increase the "spatial" values
Use only the "spatial" values, and not "a-la-adaptive", but use it statically.
You want to kill noise spots, which are (ideally) different from frame to frame.
So what is really needed is strong "spatial" filtering. Not "temporal" filtering.

-kwag
Reply With Quote
  #4  
10-10-2003, 07:34 AM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks guys!

@kwag
Could you please point me int the right direction on the spatial filtering? Shall I keep the temporal values, and what are good starting values for the spatial filtering?
This movie (Deliverance) is in bad need of a clean up. It's very noisy/pixelated.
__________________
AudioSlave
Reply With Quote
  #5  
10-10-2003, 07:45 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Quote:
Originally Posted by kwag
I would leave the "temporal" values out completely in STMedian and increase the "spatial" values
You're exactly right, like mentioned above it's the way it has to be.
:banghead:
Reply With Quote
  #6  
10-10-2003, 08:20 AM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by audioslave
@kwag
Could you please point me int the right direction on the spatial filtering?
Look at the MA script. The line: STMedianFilter(8, 32, 0, 0 ) has the temporal values set to 0. So you can play with the "spatial" values ( 8, 32 ) by increasing them, and test your results.
Quote:
This movie (Deliverance) is in bad need of a clean up. It's very noisy/pixelated.
Noisy or pixelated
It's two completely different things

-kwag
Reply With Quote
  #7  
10-10-2003, 08:22 AM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by incredible

You're exactly right, like mentioned above it's the way it has to be.
:banghead:
Reply With Quote
  #8  
10-10-2003, 09:44 AM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
Oh, sorry. I ment to say noisy.
__________________
AudioSlave
Reply With Quote
  #9  
10-10-2003, 09:46 AM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
What are my options on STMedian filter? I mean what's the range of values for parameter 3 and 4, and what do they do?
__________________
AudioSlave
Reply With Quote
  #10  
10-10-2003, 10:07 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
STMedianFilter(S_FilterThreshHold, S_EdgeThreshHold, T_FilterThreshHold, T_MotionThreshHold)

Tom Barry:
Quote:
Larger values cause more filtering but more artifacts. Parm descriptions:

S_FilterThreshHold - don't spatial filter pixel if it would change it more than this
Larger values may cause loss of fine line detail but it's not extremely sensitive.

S_EdgeThreshHold - don't spatial filter pixel if on an edge where vals change more
than this. It seems fairly forgiving, so it can be raised a lot if desired.

T_FilterThreshHold -don't Temporal filter pixel if it would change it more than this
Large values will cause ghosting. Don't set over 5-10 to avoid ghosting.

T_MotionThreshHold don't Temporal filter pixel if uncompensated motion vals change more
than this. Don't set over about 10 to avoid ghosting.
Reply With Quote
  #11  
10-11-2003, 03:13 PM
muhali3 muhali3 is offline
Free Member
 
Join Date: Sep 2003
Posts: 134
Thanks: 0
Thanked 0 Times in 0 Posts
does deen act as a spatial-temporal smoother. or just spatial?
what exactly does it do?

i've read the documentation that came along with it, but it doesn't exactly say what it does.

Thanks
Reply With Quote
  #12  
10-11-2003, 04:04 PM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Deen is a Spatial only filter.
Reply With Quote
  #13  
10-13-2003, 11:11 AM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
Well, now I've tried encoding with Deen() but I only gain 2-3 in CQ. "Deliverance" is about 1:45 long and I usually get a CQ around 70 for this kind of movies. In this case the CQ stops at around 56
Can someone please post good settings for STMedian (spatial values) to use for low, medium, and high noise sources?
__________________
AudioSlave
Reply With Quote
  #14  
10-13-2003, 11:17 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Are you sure your problem doesn't come from a source too sharpen ?

It's strange that you gain so little CQ on the video. Deen is quite heavy in noise removing. Try this : deen("a2d",2,10,12)
(note: oops, I said an error last time, by default deen is a Spatio-Temporal filter using a 3d matrix. For Spatial only filtering you have to use the line suggested above).

Finally, I can suggest you eDeen that is heavier than deen.

Ps:For the values of StMEdian, why don't you do some test and give results there ?
Reply With Quote
  #15  
10-13-2003, 11:22 AM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
@Dialhot
I don't know. I'm using the MAscript and it has always worked before, on other movies. Maybe I could try increasing the LumaBlur? Or do you have any other suggestions?
__________________
AudioSlave
Reply With Quote
  #16  
10-13-2003, 11:24 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
I edited my post while you were answering. See the suggestion I do in it
Reply With Quote
  #17  
10-13-2003, 11:26 AM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
Where can I find eDeen?

EDIT: Now that I think of it the DVD seems like it is over sharpened. Almost like when you apply too much sharpen filter in Photoshop, if you know what I mean?
__________________
AudioSlave
Reply With Quote
  #18  
10-13-2003, 11:29 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
http://ziquash.chez.tiscali.fr/
Reply With Quote
  #19  
10-13-2003, 11:33 AM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
Thanx
__________________
AudioSlave
Reply With Quote
  #20  
10-13-2003, 11:34 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
You can soften it with unfilter (that is its original purpose). Or as you suggested raise a little the blur on the luma.
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Avisynth: Good filter to clean up old cartoons? audioslave Avisynth Scripting 8 11-04-2003 12:21 PM
Simple script for very noisy source? rendalunit Video Encoding and Conversion 23 11-01-2003 05:58 PM
SansGrip Filters: Clean the source CaLaFaT Avisynth Scripting 2 07-03-2003 07:45 AM
Avisynth: Filter Use, encoding without filters if the source is clean? Yoda Avisynth Scripting 3 04-21-2003 06:33 PM
Avisynth: Excellent script for noisy VHS caps in EP mode? rendalunit Avisynth Scripting 2 01-20-2003 06:27 PM




 
All times are GMT -5. The time now is 12:04 PM  —  vBulletin © Jelsoft Enterprises Ltd