View Full Version : Slow motion on progressive video
ITL
18th November 2006, 16:07
Hello! I'm new to the forum, and relatively new to Avisynth - so please bear with me and my n00bness! lol
Basically, I'd like to know how to achieve a smooth slow motion effect on a progressive video clip using a combination of Avisynth scripting and VirtualDubMod.
I create my source file this way:
1) Rip a file from a DVD - it's PAL, progressive.
2) Load the VOB into VirtualDubMod and save a short clip as AVI.
I'd prefer to run any Avisynth script that acts on the AVI clip though VirtualDubMod, if possible.
Thanks for any help.
:)
Blue_MiSfit
19th November 2006, 00:37
I've had great results with MVTools. It does real motion compensation, and can make a very cool slow motion effect.
http://avisynth.org.ru/fizick.html has the plugin you need - and many other cool plugins. Download it, and put mvtools.dll in your avisynth plugins folder.
Here is a sample script from the MVTools documentation - with one addition at the end
source = Avisource("c:\test.avi")
# Assume progressive PAL 25 fps source. Lets try convert it to 50.
backward_vec = source.MVAnalyse(isb = true, truemotion=true, pel=2, idx=1)
# we use explicit idx for more fast processing
forward_vec = source.MVAnalyse(isb = false, truemotion=true, pel=2, idx=1)
cropped = source.crop(4,4,-4,-4) # by half of block size 8
backward_vec2 = cropped.MVAnalyse(isb = true, truemotion=true, pel=2, idx=2)
forward_vec2 = cropped.MVAnalyse(isb = false, truemotion=true, pel=2, idx=2)
return source.MVFlowFps2(backward_vec,forward_vec,backward_vec2,forward_vec2,num=50,idx=1,idx2=2).assumefps(25)
This may look a bit intimidating, but its really just doing a few things. The ultimate goal is to produce a 50fps file and play it at 25fps. It loads source.avi - a hypothetical Progressive PAL AVI. The next several lines actually do the motion vector analysis. Notice that it is done 4 times - backward and forward, both on the original clip, and on an offset clip - for more accuracy.
The final call to return the results of MVFlowFps2 actually does the slow-motion effect - to 50fps. The final bit changes the frame rate back to 25. This may seem odd, but MVFlowFps2 acually adds frames, and assumefps just makes avisynth play 50fps at 25fps - which creates the slow motion effect.
This is a place to start. Tweaking will be necessary - especially if you have an NTSC source :) Also note that previewing this in real time won't give you an accurate representation of the result. This runs at ~ 15 fps on my system - so definitely encode to huffyuv to test clips :)
Keep in mind, I'm no expert, and this could be quite wrong! I'm a novice at this stuff too!
You would probably be better off directly accessing the VOB - instead of creating an intermediate AVI. This will improve quality and speed. Use DGIndex to make a d2v out of the VOBs, and load that D2V into AviSynth as your source using MPEG2Source(...) from the DGDecode.dll plugin that comes with DGIndex.
~MiSfit
ITL
19th November 2006, 01:13
Thanks! I'll give this a try and see what I can come up with - if I need to know more, I'll be back! lol
:)
ITL
19th November 2006, 12:53
OK, I just have to say that this method gives truly amazing results - smooth as silk and very professional-looking!
Thanks once again.
:)
Blue Devil
19th November 2006, 18:53
@Blue_MiSfit
Thanks for the very good down and dirty slo mo script. I was needing to just slow down a portion of a capture. I modified your script and implemented a couple of trims, then used AlignedSplice to rejoin them. Just to keep everyone happy, I added the .assumefps command to all my trims.
Here is what I used:
Avisource("c:\test.avi")
source=Trim(214,380)
# Assume progressive PAL 25 fps source. Lets try convert it to 50.
backward_vec = source.MVAnalyse(isb = true, truemotion=true, pel=2, idx=1)
# we use explicit idx for more fast processing
forward_vec = source.MVAnalyse(isb = false, truemotion=true, pel=2, idx=1)
cropped = source.crop(4,4,-4,-4) # by half of block size 8
backward_vec2 = cropped.MVAnalyse(isb = true, truemotion=true, pel=2, idx=2)
forward_vec2 = cropped.MVAnalyse(isb = false, truemotion=true, pel=2, idx=2)
c2=source.MVFlowFps2(backward_vec,forward_vec,backward_vec2,forward_vec2,num=50,idx=1,idx2=2).assumefps(25)
c1=Trim(0,213).assumefps(25)
c3=Trim(381,587).assumefps(25)
AlignedSplice(c1,c2,c3)
Thanks again
Blue_MiSfit
20th November 2006, 00:54
No problem. Thank Fizick - he wrote MVTools IIRC :)
Motion compensation is pretty sweet :D!
re: Didee's post
Thanks to Manao too!
Didée
20th November 2006, 01:13
Praises to Fizick for all the sweet developping-further of MVTools, definetly. :)
But don't forget Manao ... he did all the start-up work of MVTools, which was not little either.
Praises to Manao. :)
videoFred
23rd November 2006, 11:38
To make things more simple, I use 'assumeFPS' always at the beginning, like this:
For slow motion:
Avisource("c:\test.avi").assumeFPS(10) or whatever play speed you want.
Then I set 'num=25' this can always stay the same for PAL.
I wonder, does this make a difference in the end result?
Hey! The latest MVFlowfps() versions are very good!
Thank you for the hard work, Fizick :thanks:
Fred.
Fizick
23rd November 2006, 11:44
I read it, be sure.... :)
Edit: But I prefer more technichal reports :)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.