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.


Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 29th April 2017, 00:35   #1  |  Link
Joachim Buambeki
Registered User
Join Date: May 2010
Location: Germany, Munich
Posts: 49
Looking for help with script for weighted averaging of frames for smooth motion blur


It's been almost ten years since I last used Avisynth and so far I am still trying to figure out how to run Vapoursynth(VS) on OSX, so please excuse my beginner level questions.

I would like to process 360 shutter high frame rate sources into standard frame rate clips by averaging multiple frames to get smooth motion blur. The attached image represents what I would like to do in VS:
  • each blue column represents one frame
  • height of column represents weight
  • negative height means the image gets subtracted with the weight of its height
  • the number of blue bars in the yellow, dotted lines represents the speedup or timebase conversion factor (5 by default but can be everything)
By counting pixels I came up with the (approximated) weights for each of the 19 example frames in the attachment:
-.01, -.03, -.03, -.06, 0, .17, .42, .69, .91, 1.0, .91., .69, .42, .17, 0, -.06, -.03, -.03, -.01

I understand averaging the five frames within the yellow, dotted verticals can be done like this with Avisynth (AS) but that is as far as I've just gotten.
c1=selectevery(last, 4, 0)
c2=selectevery(last, 4, 1)
c3=selectevery(last, 4, 2)
c4=selectevery(last, 4, 3)
c5=selectevery(last, 4, 4)

Average (c1, .69, c2, .91, c3, 1, c4, .91, c5, .69)
I assume that something like:
SelectRangeEvery(clip, 5, 19, x) #19 calls of SelectRangeEvery where x=0 to 19
Average(c1, -.01,c2, -.03, c3, -.03, c4, -.06, c10, 1.0, ... c18, -.03, c19, -.01)
would do the trick in Avisynth but I can't wrap my head around how do this in VS (nor how to do exactly in AS).

To take this concept one step further - how to describe the frame weighting as a function, so faster speedup factors, different kinds of artificial motion blur (like asymmetrical functions or simulated shutter speeds of >360) and keyframes are possible?
Unfortunately on top of my lack of advanced scripting skills, the math (I guess AV's "Apply()" would be appropriate for this?) needed for functions is not my strong suit. :-(

Additionally, since sometimes it is technically not possible to shoot 360 shutter but only around 180-270, is there an elegant way to pad this to 360 motion blur with MVtools, then apply the frame averaging (which should eliminate most if not all artefacts introduced by the fake 360 shutter motion blur)?

I hope it became apparent what I am trying to achieve, if not - feel free to ask questions and I will do my best to answer them.
Looking forward to what you guys can come up with and thanks in advance for looking into this. :-)


Last edited by Joachim Buambeki; 30th April 2017 at 21:10.
Joachim Buambeki is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 15:27.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.