View Full Version : How would I apply the correct amount of motion blur?
shoopdabloop
7th June 2009, 00:09
source is moderately shaky 1/60 shutter NTSC DV footage (16:9 letterboxed to 720x480) from a PANASONIC PV-DV102 camcorder (consumer, circa 2002)
final avisynth output is 720x480 with letterboxing.
Here's my script:
loadcplugin("c:\program files\avisynth 2.5\plugins\yadif.dll")
AviSource("tape 5 - clip 007.avi").AssumeBFF()
MT("removegrain()",0,splitvertical=true)
MT("yadif()",0,splitvertical=true)
Trim(1,last.framecount)
Spline36Resize(748,496)
mdata = DePanEstimate(trust=1,pixaspect=0.9091)
DePanStabilize(data=mdata,dxmax=14,dymax=14,mirror=12,pixaspect=0.9091)
Crop2(720,356)
MT("fft3dfilter(sigma=3)",0,splitvertical=true,overlap=2)
MT("warpsharp(60)",0)
vectors = MVAnalyseMulti()
mvbw = vectors.MVMultiExtract(0)
mvfw = vectors.MVMultiExtract(1)
mvflowfps(last,mvbw,mvfw,24000,1001)
mvflowblur(last,mvbw,mvfw,blur=???)
AddBorders(0,62,0,62)
[output ~6 fps]
What number should I pass to mvflowblur's "blur" param if I want to make the 1/60 shutter speed look like 1/48? (standard film shutter speed)
All I need is a number but I'm not sure how to calculate it.
vampiredom
7th June 2009, 20:01
I'm not sure how that works either, but you can possibly try a different approach by first converting your 60i video -> 60p (bobbing, via Yadif mode=1), then using mvflowfps to convert it to 240p, then blending some of those frames to simulate the motion blur of 1/48 from a 1/60 source:
Here is some math to justify this approach:
(1/60) = 1.6666667
(1/48) = 0.0208333
(1/240) = 0.0041667
(1/60) + (1/240) = 0.0208333 = (1/48)
So, we'll convert it to 240p then blend frames 0 and 1 of every 10 frames:
MT("yadif(mode=1)",0,splitvertical=true)
vectors = MVAnalyseMulti()
mvbw = vectors.MVMultiExtract(0)
mvfw = vectors.MVMultiExtract(1)
mvflowfps(last,mvbw,mvfw,240000,1001)
a = selectevery(10, 0)
b = selectevery(10, 1)
Merge(a,b)
Does this make sense?
shoopdabloop
7th June 2009, 20:17
Thanks! This works very nice (and not much slower than the original script too):
loadcplugin("c:\program files\avisynth 2.5\plugins\yadif.dll")
AviSource("tape 5 - clip 007.avi").AssumeBFF()
MT("removegrain()",0,splitvertical=true)
MT("yadif(1)",0,splitvertical=true)
Trim(1,last.framecount)
vectors = MVAnalyseMulti()
mvbw = vectors.MVMultiExtract(0)
mvfw = vectors.MVMultiExtract(1)
mvflowfps(last,mvbw,mvfw,240000,1001)
b = selectevery(10, 1)
selectevery(10, 0)
Merge(b)
Spline36Resize(748,496)
mdata = DePanEstimate(trust=0,pixaspect=0.9091)
DePanStabilize(data=mdata,dxmax=14,dymax=14,mirror=12,pixaspect=0.9091)
Crop2(720,356)
MT("fft3dfilter(sigma=3)",0,splitvertical=true,overlap=2)
MT("warpsharp(58)",0)
AddBorders(0,62,0,62)
I wanted to be sure I was calling Merge the right way, so I made some (probably unnecessary) modifications.
vampiredom
7th June 2009, 20:29
Glad it worked out for you… I (at one point in time) devoted a bunch of time to 60i -> 24p conversions. Basically, a user at the Abobe Premiere users forum presented me a challenge and I took it! I am always glad to remind Adobe users of the power of freeware.
Although it may slow things down a bit, I think you'd be wiser to put your fft3dfilter and DePanStabilize immediately after the bobbing so that they are working on the best (temporal) quality source, which will hopefully enable MVFlowFps to generate better frames, like
Yadif(1)
fft3dfilter()
mdata = DePanEstimate()
DePanStabilize(data=mdata)
Also: have you tried FFT3dGPU()? If it works with your video card, you can probably speed things up quite a bit with this modification alone.
shoopdabloop
7th June 2009, 20:33
I was using fft3dgpu in my script before, but MT'd fft3dfilter is faster on my machine.
shoopdabloop
11th June 2009, 05:02
Anyway, I'd like to report that this is my favorite 60i-to-24p+enhancement script that I've made (thanks to vampiredom):
loadcplugin("c:\program files\avisynth 2.5\plugins\yadif.dll")
AviSource("tape 2 - clip 031.avi").AssumeBFF()
MT("removegrain()",0,splitvertical=true)
MT("yadif(1)",0,splitvertical=true)
Trim(2,last.framecount)
motionprotectedfps(239.76)
b = selectevery(10, 1)
selectevery(10, 0)
Merge(b)
Spline36Resize(752,500)
MT("fft3dfilter(sigma=3)",0,splitvertical=true,overlap=2)
mdata = DePanEstimate(trust=0)
DePanStabilize(data=mdata,dxmax=16,dymax=16,mirror=12)
Crop2(720,356)
MT("warpsharp(60)",0)
AddBorders(0,62,0,62)
and if I don't need to deshake it, I just take out the Spline36Resize and Depan lines.
i like it because of the relatively fast speed (~10 fps) and the low amount of framerate-conversion artifacts.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.