Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AviSynth TSMC (Temporal Soften Motion Compensated)(Denoiser)
#1
This is perhaps better than LDDENOISE and it's much faster. This is what I use on laserdiscs nowadays as it seems to be better at removing the analog noise of laserdiscs.

It's quite simple actually and the dependencies are only:

Avisynth 2.6
Temporal Soften (this is an internal filter)
MVTOOLS2 (version 2.6.0.5 or similar)
NOTE: starting with mvtools2 2.7.35 and higher, yuy2 clips will need to be converted to a planar colorspace such as yv16 instead.

The only things you really need to tinker with are tradius(temporal radius) and mthresh(motion threshold). Everything else I never change but I put them in as options in case you want to change the blocksize, for example. The only thing I ever adjust actually is mthresh.

mthresh=70 will denoise basically only stationary stuff.
mthresh=120 will denoise slightly moving stuff.
mthresh=180 will denoise moving stuff but not extremely high motion.

Anything over 180(depending on the source) can start to risk loss of detail that, imo, is unacceptable. However, 70-120 denoises A LOT but still looks good.

Code:
function TSMC(clip input, int "tradius", int "mthresh", int "lumathresh", int "blocksize", bool "MT")
{
tradius=default(tradius,5)
# temporal radius-number of frames analyzed before/after current frame.

mthresh=default(mthresh,70)
# motion threshold-higher numbers denoise areas with higher motion.
#Anything above this number does not get denoised.

lumathresh=default(lumathresh,255)
# luma threshold- Denoise pixels that match in surrounding frames.
#255 is the maximum and default. 0-255 are valid numbers.
#Also adjusts chroma threshold.

blocksize=default(blocksize,4)
#larger numbers = faster processing times. Must be 4,8,16, or 32.

MT=default(MT,true)
#turn multi-threading on or off. If you are using single threaded avisynth this should be true.
#If you are using multi-threaded avisynth this should be false.

    prefilt=input.blur(1.58)
    super=MSuper(input, pel=2,mt=MT)
    superfilt=MSuper(prefilt,pel=2,mt=MT)
   
    multivectors=Manalyse(superfilt,multi=true,delta=tradius,mt=MT)
    multivectors2=Mrecalculate(superfilt,multivectors,thsad=mthresh,tr=tradius,mt=MT,blksize=blocksize,overlap=2)
    mc=Mcompensate(input,super,multivectors2,thsad=mthresh,mt=MT,tr=tradius,center=true)
    dnmc=mc.temporalsoften(tradius,lumathresh,lumathresh,15,2)
    decimate=selectevery(dnmc,tradius * 2 + 1,tradius)
    return(decimate)
}

EDIT: I also wanted to add that if anybody has any ideas to make this better feel free to chime in. I'm by no means an avisynth guru and am open to improvement!

A quick how to use avisynth and this denoiser:

1) Go download avisynth 2.6 or avs+ and install it:
https://sourceforge.net/projects/avisynth2/
https://github.com/pinterf/AviSynthPlus/releases
I recommend going with avs+ as it's regularly maintained by Pinterf and has many newer features.

2) Download mvtools2. Navigate to the avisynth folder in Program Files and extract the mvtools2.dll file into the plugins folder inside the avisynth folder.
http://ldesoras.free.fr/src/avs/mvtools-2.6.0.5.zip
https://github.com/pinterf/mvtools/releases
Again, I recommend Pinterf's version as it is more up to date with more features.

3) Open notepad and copy the code from the first post into it and save it as TSMC.avsi. Place this also into your avisynth plugins folder.

4) open notepad and write a script to load the video file and denoise it. Here's an example:

Code:
avisource("c:\temp\starwars.avi")
TSMC(5,120,255,4,true)

Save this wherever you want it as starwars.avs or whatever you want to name it. Just make sure you have .avs as the extension.

5) Open Virtualdub. Navigate to your starwars.avs file and open it in virtualdub. It should pop up in virtualdub already denoised via avisynth.
Reply
Thanks given by: PDB , jerryshadoe , spoRv
#2
Very nice results obtained using this script, thanks a lot! Ok
Reply
Thanks given by:
#3
I just ran this through a sample VHS clip from my personal collection and I must say that this also does a nice job there.

Thanx for sharing this Ok
Reply
Thanks given by:
#4
Is there a virtualdub filter version available for this?
Reply
Thanks given by:
#5
I'm not sure that's possible. This is something I just threw together myself. It's always possible to install avisynth and mvtools2 and open it up in virtualdub via an avs file though.
Reply
Thanks given by:
#6
(2017-02-13, 09:45 PM)althor1138 Wrote: I'm not sure that's possible. This is something I just threw together myself. It's always possible to install avisynth and mvtools2 and open it up in virtualdub via an avs file though.

It would help immensely if you could maybe tell me how to do that so I understand what I'm doing, LOL.

Thanks althor
Reply
Thanks given by:
#7
I will do a little tutorial a bit later in the next few days here in this thread.
Reply
Thanks given by:
#8
Jetrell, I'm using Avisynth since 4 or 5 years, still learning some new things every day!

So, patience, willing to learn, and time to test... a lot!
Reply
Thanks given by:
#9
Very cool. Thank you.
Reply
Thanks given by:
#10
A quick how to use avisynth and this denoiser:

1) Go download avisynth 2.6 and install it:
https://sourceforge.net/projects/avisynth2/

2) Download mvtools2. Navigate to the avisynth folder in Program Files and extract the mvtools2.dll file into the plugins folder inside the avisynth folder.
http://ldesoras.free.fr/src/avs/mvtools-2.6.0.5.zip

3) Open notepad and copy the code from the first post into it and save it as TSMC.avsi. Place this also into your avisynth plugins folder.

4) open notepad and write a script to load the video file and denoise it. Here's an example:

Code:
avisource("c:\temp\starwars.avi")
TSMC(5,120,255,4,2)

Save this wherever you want it as starwars.avs or whatever you want to name it. Just make sure you have .avs as the extension.

5) Open Virtualdub. Navigate to your starwars.avs file and open it in virtualdub. It should pop up in virtualdub already denoised via avisynth.
Reply
Thanks given by: nightstalkerpoet


Possibly Related Threads…
Thread Author Replies Views Last Post
  AviSynth 5 pass average (motion compensated) althor1138 9 3,697 2017-02-18, 07:33 PM
Last Post: IcePrick
  AviSynth LD Denoiser spoRv 0 931 2017-01-15, 05:16 AM
Last Post: spoRv

Forum Jump:


Users browsing this thread: 1 Guest(s)