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. |
30th November 2014, 18:02 | #1 | Link |
Registered User
Join Date: Feb 2010
Posts: 41
|
Filter to average every N frames?
Hello,
Is anyone aware of a filter that averages (the entire contents of) every N frames in a clip? For example: "AverageFrames(30)" would take the first 30 frames and create a single, averaged frame out of them, and then move on to the next 30 frames. And so on. In this case, the total clip length is of course reduced to 1/30. To further clarify, "AverageFrames(2)" would be similar to: Code:
A = Clip.SelectEven() B = Clip.SelectOdd() Merge(A,B) |
30th November 2014, 20:42 | #3 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Dont think ClipBlend would suit, ClipBlend can output average of previous 30 frames with same o/p as i/p frame count.
If you jump about in the stream [eg SelectEvery(30,29)] then it will 'reset' itself (throw away accumulated ave data) and start accumulating again, so for every output frame it would reset accumulator and would be no different to a simple SelectEvery(30,29). You could however do it in two passes Code:
AviSource("d:\1.avi") ClipBlend(Delay=30-1) Code:
AviSource("d:\2.avi") SelectEvery(30,29) EDIT: "average of previous 30 frames" should read "average of previous 29 + current frames".
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 30th November 2014 at 20:53. |
30th November 2014, 21:08 | #4 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
This seems to (EDIT: does) work but conversion to RGB, EDIT: but ODD number of averaged frames only
Code:
# Temporal Average of 29 frames avisource("D:\avs\test.avi") ConvertToRGB24() RgbAmplifier(Radius=15,Multiplier=0.0) # Radius * 2 - 1 frames averaged (14 before, 14 after + current) SelectEvery(29,14) http://forum.doom9.org/showthread.ph...t=RGBAmplifier
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 30th November 2014 at 21:34. |
3rd December 2014, 17:13 | #6 | Link |
Registered User
Join Date: Mar 2014
Posts: 308
|
Why not just use TemporalSoften?
It'll have the same limitation of only working when N is odd, but works on YUV too. Or actually, requiring that N is odd isn't too hard to work around… Code:
function blend(clip c,int n) { if (n%2 == 0) { blended = c.temporalsoften(n/2-1,255,255,255,2).selectevery(n,n/2) return merge(blended,c.selectevery(n,0),1.0/n) } if (n == 1) {return c} return c.temporalsoften((n-1)/2,255,255,255,2).selectevery(n,(n-1)/2) }
__________________
Say no to AviSynth 2.5.8 and DirectShowSource! |
|
|