Posts: 139
Threads: 8
Joined: 2015 Mar
Thanks: 37
Given 70 thank(s) in 34 post(s)
Country:
2017-02-12, 03:46 PM
(This post was last modified: 2017-02-12, 04:31 PM by althor1138.)
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 . 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)
}
Posts: 7,153
Threads: 601
Joined: 2015 Jan
Thanks: 1081
Given 1466 thank(s) in 963 post(s)
Country:
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?
Posts: 139
Threads: 8
Joined: 2015 Mar
Thanks: 37
Given 70 thank(s) in 34 post(s)
Country:
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.
Posts: 229
Threads: 20
Joined: 2015 Jan
Thanks: 100
Given 50 thank(s) in 26 post(s)
I can't get this to work. Script does not return a clip. What am I doing wrong?
Posts: 7,153
Threads: 601
Joined: 2015 Jan
Thanks: 1081
Given 1466 thank(s) in 963 post(s)
Country:
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)
Posts: 139
Threads: 8
Joined: 2015 Mar
Thanks: 37
Given 70 thank(s) in 34 post(s)
Country:
2017-02-17, 09:26 PM
(This post was last modified: 2017-02-17, 11:58 PM by althor1138.)
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 .
Posts: 7,153
Threads: 601
Joined: 2015 Jan
Thanks: 1081
Given 1466 thank(s) in 963 post(s)
Country:
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?
Posts: 229
Threads: 20
Joined: 2015 Jan
Thanks: 100
Given 50 thank(s) in 26 post(s)
(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?
Posts: 139
Threads: 8
Joined: 2015 Mar
Thanks: 37
Given 70 thank(s) in 34 post(s)
Country:
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)
}
Posts: 229
Threads: 20
Joined: 2015 Jan
Thanks: 100
Given 50 thank(s) in 26 post(s)
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.
|