Hello guest, if you like this forum, why don't you register? https://fanrestore.com/member.php?action=register (December 14, 2021) x


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AviSynth 5 pass average (motion compensated)
#1
2 scripts here. 1 for 5 pass average. 1 for 3 pass average. I saw no need for two threads about this.

This should allow for averaging captures from the same source or even different sources that are similar in size and alignment. Mileage might vary Smile. I personally use it for making 3 or 5 captures of a laserdisc and averaging it to remove as much noise as possible before moving on to IVTC and DNR. It's up to you to make sure the clips are aligned before feeding them into this function. So make sure to trim beforehand.

What you'll need:

avisynth 2.6
interleave (internal filter)
MVTOOLS2 (2.6.0.5 or similar)
temporalsoften (internal filter)

Code:
Function FivePassAverage(clip pass1,clip pass2,clip pass3, clip pass4, clip pass5)
{
interleave=interleave(pass1,pass2,pass3,pass4,pass5)
super=msuper(interleave,pel=2,mt=true)
multivectors=manalyse(super,multi=true,delta=2,mt=true)
multiclip=mcompensate(interleave,super,multivectors,mt=true,tr=2,center=true)
average=temporalsoften(multiclip,2,255,255,50,2).selectevery(25,12)
return(average)
}

Code:
Function ThreePassAverage(clip pass1,clip pass2,clip pass3)
{
interleave=interleave(pass1,pass2,pass3)
super=msuper(interleave,pel=2,mt=true)
multivectors=manalyse(super,multi=true,delta=1,mt=true)
multiclip=mcompensate(interleave,super,multivectors,mt=true,tr=1,center=true)
average=temporalsoften(multiclip,1,255,255,50,2).selectevery(9,4)
return(average)
}
Reply
Thanks given by: PDB , spoRv
#2
Interesting! I always used a simple median, and it worked well - sometimes even TOOT.

Can you say how much better would be your solution, just out of curiosity?
Reply
Thanks given by:
#3
The chances of 5 captures being perfectly aligned are not very good due to the analog nature of the laserdisc. If I understand right, the tbc can and will shift the picture up or down/left or right a pixel or 2 randomly each time you play it depending upon how it picks up the incoming signal for that specific capture. A normal median or toot cannot account for this and you end up with a blurry picture afterwards. The 5pass average or 3pass average, being motion compensated, will adjust accordingly and prevent misalignment. In this regard I'd say it's 100 percent better than using toot or median. As far as speed goes, it's probably quite a bit slower.
Reply
Thanks given by:
#4
I can't get this to work. Script does not return a clip. What am I doing wrong?
Reply
Thanks given by:
#5
You should make something like this (of course, the function should be into your avisynth script, or saved as .avsi file and placed into your avisynth plugin folder):

Code:
a=avisource(clip_a.avi)
b=avisource(clip_b.avi)
c=avisource(clip_c.avi)
d=avisource(clip_d.avi)
e=avisource(clip_e.avi)

FivePassAverage(a,b,c,d,e)
Reply
Thanks given by:
#6
I've been thinking a bit and I think using toot for the 3passaverage instead of temporalsoften might be beneficial because it selectively chooses the 2 most similar pixels of the 3 sources. Temporalsoften just blends all 3 together. Does anybody have a link for the toot filter?  I used to have it but can't seem to find it in my plugins folder. Is there a toot variation that would work with 5 captures? The script above could easily be rewritten to have the choice of which averaging filter you want to use with it.

EDIT: temporalsoften doesn't just blend all 3 together if you adjust the thresholding, however, it is based off the center clip which, let's say, is the clip with a "noise" pixel.  This pixel will then be kept while throwing away the 2 good pixels from the other sources. This is why I opted for the complete blending of all clips.

EDIT2: Even better would be to script the selectiveness without using toot but I'm not sure how to go about that. Perhaps something like the showpixelvalues filter could be reworked to do this?  I dunno, I'll have to think about it and do some testing.

EDIT3: After some reading it seems Median will do this with a variable number of clips. I will do some testing and if it helps I'll update the 5 and 3 pass average in the first post to use median instead of temporalsoften or perhaps make it a choice to use either.

EDIT4: I've written in AJK's (the author of median) thread over on doom9 to see if he'd be interesting in tweaking the filter to allow for easier motion compensation of separate sources. If he is willing to do that, things would be great. If not, I can still probably rig up a function to do it using his filter but it'll be quite slow as it'll have to make several calls to the same motion compensated clip. Hopefully he'll respond Smile.
Reply
Thanks given by:
#7
A choice of several option will be great - for example, median, toot, temporalsoften.

Dunno if toot can work with five captures; I have toot filter, so just send me a PM to remind me to send it to you; if not, I'll forget in, what? 5 minutes? Big Grin
Reply
Thanks given by:
#8
(2017-02-17, 09:02 PM)spoRv Wrote: You should make something like this (of course, the function should be into your avisynth script, or saved as .avsi file and placed into your avisynth plugin folder):

Code:
a=avisource(clip_a.avi)
b=avisource(clip_b.avi)
c=avisource(clip_c.avi)
d=avisource(clip_d.avi)
e=avisource(clip_e.avi)

FivePassAverage(a,b,c,d,e)

That doesn't seem to be the issue. Here's the script I'm using:
Code:
pass1 = AviSource("clip1.avi")
pass2 = AviSource("clip2.avi")
pass3 = AviSource("clip3.avi")

Function ThreePassAverage(clip pass1,clip pass2,clip pass3)
{
interleave=interleave(pass1,pass2,pass3)
super=msuper(interleave,pel=2,mt=true)
multivectors=manalyse(super,multi=true,delta=1,mt=true)
multiclip=mcompensate(interleave,super,multivectors,mt=true,tr=1,center=true)
average=temporalsoften(multiclip,1,255,255,50,2).selectevery(9,4)
return(average)
}

I've tried some variations and different versions of MVTools2, but nothing works. Any ideas?
Reply
Thanks given by:
#9
Try this:

Code:
a = AviSource("clip1.avi")
b = AviSource("clip2.avi")
c = AviSource("clip3.avi")

return(ThreePassAverage(a,b,c))

Function ThreePassAverage(clip pass1,clip pass2,clip pass3)
{
interleave=interleave(pass1,pass2,pass3)
super=msuper(interleave,pel=2,mt=true)
multivectors=manalyse(super,multi=true,delta=1,mt=true)
multiclip=mcompensate(interleave,super,multivectors,mt=true,tr=1,center=true)
average=temporalsoften(multiclip,1,255,255,50,2).selectevery(9,4)
return(average)
}
Reply
Thanks given by:
#10
It actually turned out to be a completely different problem. Some files were wrongly extracted in Avisynth plugin folder, and it was causing conflicts. Figures it was something stupid like that. Anyway, thanks for the script. Smile
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
  AviSynth TSMC (Temporal Soften Motion Compensated)(Denoiser) althor1138 28 27,726 2018-08-06, 12:38 PM
Last Post: althor1138
  Mode Average in Avisynth nightstalkerpoet 1 3,335 2018-03-09, 10:50 AM
Last Post: CSchmidlapp

Forum Jump:


Users browsing this thread: 1 Guest(s)