Log in

View Full Version : Frame-averaging motion blur?


PhrostByte
22nd February 2010, 11:48
Hello,

Is there any script that will let me turn a super high fps clip into a lower fps clip with motion blur? Like, say, 3000fps to 30fps.

zilog jones
22nd February 2010, 15:10
Try MFlowBlur from MVTools (http://avisynth.org.ru/mvtools/mvtools2.html), then afterwards to get the lower framerate try something like TemporalSoften and SelectEvery

2Bdecided
22nd February 2010, 15:37
If it's already a high frame rate, you don't need mvtools, just temporalsoften then selectevery

Cheers,
David.

scharfis_brain
22nd February 2010, 16:47
@2Bdecided: this only is true, if the shutter time equals the duration of one frame.

if the shutter is shorter than one frame, you need to interpolate new frames.

if you don't do this, you'll end up in strobed images.

2Bdecided
23rd February 2010, 11:11
True, but from 3000fps?

Depends on the content of course, but I doubt most people would even pick such a high intermediate frame rate.

Cheers,
David.

scharfis_brain
23rd February 2010, 13:42
nah.

for 1/60 sec shutter you'll just merge frames
for 1/120 sec shutter you'll interpolate up to 120 fps and merge then
for 1/1000 sec shutter you'll interpolate to 1000 fos and merge then.

Didée
23rd February 2010, 14:00
Not quite sure about the scenario, but ... if the source really is 3000fps, and destination is 30 fps, then you'll have one hundred input frames that (could) be merged into one output frame. Naively, I would just try to merge frames, rather than doing motion interpolation. The actual technical properties of the OP's source material are a bit vague anyway, so ...

OvejaNegra
26th February 2010, 02:52
To avoid create a new trhead similar to this one:

Lets say i have a video with 23.97 fps and i want to reduce it to 8fps. To avoid jumpy motion a want to merge the frames using motion blur (like it was a film camera filming at 8fps)

Sory if im not clear enough.

How can i do that?

edit: NO: i want to interpolate new frames from the old frames using motion blur. I think thats better.

PhrostByte
26th February 2010, 05:57
Didée, it is computer-generated video that I can render at any fps I want, but unfortunately the app doesn't have any good motion blur function.

I ended up doing this which worked rather well:

TemporalSoften(100,255,255,0,2)
SelectEvery(100, 0)
AssumeFPS(30)

Is there any sort of dshow filter proxy that would allow me to insert avisynth in between the app and lagarith? Would be pretty awesome to do it on the fly like this, because saving 720p @ 3000fps is pretty nasty space-wise!

Thanks everyone for your help.

@OvejaNegra, For that situation I would try mvtools as zilog suggested.

Didée
26th February 2010, 15:06
PhrostByte, you have been fooled. TemporalSoften has a maximum temporal distance of +-7.

(100,255,255,..) is the same as (50,255,255,..) is the same as (20,255,255,..) is the same as (7,255,255,..). Maximum distance is 7. You can't merge more than 15 frames in one go. For that you need to combine several TemporalSoften's, in one way or another - chaining them like TS().TS().TS() (the resulting merge weighting is not linear, though), or split the source with SelectEvery's, TS each sniplet, then merge the sniplets.


E.g. the following example will merge 5*15 = 75 frames together:
snip1 = selectevery(5,0) .temporalsoften(7,255,255,0,2)
snip2 = selectevery(5,1) .temporalsoften(7,255,255,0,2)
snip3 = selectevery(5,2) .temporalsoften(7,255,255,0,2)
snip4 = selectevery(5,3) .temporalsoften(7,255,255,0,2)
snip5 = selectevery(5,4) .temporalsoften(7,255,255,0,2)

interleave(snip1,snip2,snip3,snip4,snip5) .temporalsoften(2,255,255,0,2)


i.e. this is a working variant of the theoretical (but not-working) TemporalSoften( 37,255,255,0,2).


It could be that mg262 once had made a tool that does long-distance frame merging ... or maybe not, here I'm not sure about my memory.

PhrostByte
27th February 2010, 19:17
hahah :D

Well, I ended up coding my own avisynth plugin to do this. The results look fantastic.

OvejaNegra
1st March 2010, 17:17
........................ can we see that plugin? :D
thanks

PhrostByte
1st March 2010, 18:32
........................ can we see that plugin? :D
thanks

Sure, but at the moment it's hard-coded to do a 100:1 merge, in YV12 only (well, any planar I suspect, but only tested in YV12), with no error checking on input, and requires SSE2 support. If there's any interest I suppose I could change that.

Plugin DLL is here, probably won't work in anything but XP SP3 and up:
http://int64.org/mergeframes.dll

Usage is simple:
mergeframes(clip)

The code is here, it requires VC++2010 because it uses C++0x and the new concurrency runtime:
http://svn.int64.org/viewvc/int64/mergeframes/mergeframes/mergeframes.cpp?view=markup

http://i49.tinypic.com/2eewh7q.jpg
http://i46.tinypic.com/2rms0wl.jpg

osgZach
1st March 2010, 18:50
Wait.. if you can render it at any FPS you want..

Why not just render at 30fps ?


Or am I missing something here?

PhrostByte
1st March 2010, 18:56
Wait.. if you can render it at any FPS you want..

Why not just render at 30fps ?


Or am I missing something here?

I can't render it with motion blur.

EuropeanMan
1st March 2010, 23:10
@2Bdecided: this only is true, if the shutter time equals the duration of one frame.

if the shutter is shorter than one frame, you need to interpolate new frames.

if you don't do this, you'll end up in strobed images.

can you give an example of a STROBED image please? thanks...trying to understand what you've said here and this thread in general.

osgZach
2nd March 2010, 01:15
I imagine its the same effect a strobe light would have on you if you were in a room with one, or watching a scene with one. Weird slow motion / stuttering effect or something like that.

Terka
2nd March 2010, 12:11
from mvtools doc:
To generate nice motion blur with MFlowBlur:
AVISource("c:\test.avi") # or MPEG2Source, DirectShowSource, some previous filter, etc
super = MSuper()
backward_vectors = MAnalyse(super, isb = true)
forward_vectors = MAnalyse(super, isb = false)
MFlowBlur(super, backward_vectors, forward_vectors, blur=15)

10L23r
4th March 2010, 08:12
can't you just use convertfps() rather than the temporalsoften?:confused::confused:
or am i missing something

Didée
4th March 2010, 11:21
can't you just use convertfps() rather than the temporalsoften?:confused::confused:
or am i missing something

Ding-Dang-Dong!!

Yes you are missing something. ConvertFPS doesn't allow more than a reduction to 2/3 of the input framerate. In this case, 3000fps->2000fps, more it won't do. It's more suited for framerate upconversion, rather than for (big) downconversions.

But *now* I remember why mg262 got on my mind ... he wrote the motion.dll plugin, which contains the filter "BlendFPS", which allows even for very big framerate conversions. :)

LoadPlugin("motion_12Dec05.dll") # small but invaluable plug by mg262 aka Clouded (hope you are well)
XYZSource("3000.fps") # whater format the source is
BlendFPS(59.94, aperture=1.0) # just do it. Aperture controls amount of blending, range 0.0-1.0