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. |
16th June 2010, 21:32 | #1 | Link |
Registered User
Join Date: Feb 2010
Posts: 41
|
Avisynth: frame interpolate + stitch clips together
Hello all,
I just recently started learning how to use Avisynth, and here's something I'm currently trying to figure out: If the code (not written by me, by the way) for motion smoothing / frame interpolation is this... Code:
LoadPlugin("C:\Program Files\AVISynth\Plugins\mvtools.dll") source = DirectShowSource ("1.mov") oSource = source source = AssumeFPS (source,20) backward_vec = source.MVAnalyse (isb = true, truemotion=true, pel=2, idx=1) 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) fSource = source.MVFlowFps2 (backward_vec,forward_vec,backward_vec2,forward_vec2,num=60,idx=1,idx2=2) fSource = AssumeFPS (fSource,60) return fSource ... and the code for stitching multiple video clips together is something like this (if I'm not mistaken)... Code:
DirectShowSource("1.mov") d1=last DirectShowSource("2.mov") d2=last DirectShowSource("3.mov") d3=last d1++d2++d3 ... then how would I combine the two? In other words, I'm trying to make Avisynth first motion smooth / frame interpolate all video clips, and then stitch them together into a single, long clip. I already tried something with my (very) limited knowledge, but the results are not really worth mentioning. But I assume I might have to change things like "source" and "fsource" (and "cropped"?) into "source1 and "fsource1" for each clip, so that they don't interfere with each other, when processing the next clips, right? Or maybe not, you tell me. It's the block of code required by the frame interpolation process that is confusing me, but this is probably a cakewalk for the Avisynth veterans. |
17th June 2010, 18:38 | #5 | Link |
Registered User
Join Date: Feb 2010
Posts: 41
|
The source is 20 fps, yes, but the 60 fps was just a value I made up for the code. Instead, I'm thinking of doing a 20 fps -> 30 fps interpolation, because I don't really like the apparent choppiness of 20 fps.
It's not a drastic increase in smoothness, but then again, the potential visual artifacts from the interpolation shouldn't be too noticeable either. EDIT: Now I started wondering something. Since I'm basically multiplying the frame rate by a non-integer number (20 -> 30 = 1.5x), won't the movement in the clips look kind of unsmooth, or unconsistent, every 2nd (or 3rd?) frame? Would it be a better option to actually interpolate the frame rate into the 60 fps instead (since 20 -> 60 = 3x), and then just skip every 2nd frame, resulting in a presumably smoother looking 30 fps clips compared to how I'm currently thinking of doing this? Just a thought. Last edited by D9JK; 17th June 2010 at 18:51. |
17th June 2010, 18:57 | #6 | Link |
Registered User
Join Date: Jul 2007
Posts: 137
|
Nah, you're thinking too much.
I'm assuming the whole cropping part was to overcome some limitation of the old MVTools... Start by getting MVTools2 and then use this script: Code:
DirectShowSource("1.mov") ++ DirectShowSource("2.mov") ++ DirectShowSource("3.mov") super = MSuper() backward_vec = MAnalyse(super, isb = true) forward_vec = MAnalyse(super, isb = false) MFlowFps(super, backward_vec, forward_vec, num=30, den=1) |
17th June 2010, 19:13 | #7 | Link |
Registered User
Join Date: Feb 2010
Posts: 41
|
Ah, right... I was on the author's site just two days ago, but didn't notice the more recent version.
Thank you very much for the code, I thought it would be much longer! But then, what do I know. I'll go and give it a try. |
19th June 2010, 03:28 | #8 | Link |
ангел смерти
Join Date: Nov 2004
Location: Lost
Posts: 9,558
|
The original script simulates overlap, from before MVTools had it built in. Now you can use MAnalyse(super, overlap=4, isb = true) to get the exact same effect, and it'll probably look a bit better than without - but take almost twice as long, like the original script.
|
Thread Tools | Search this Thread |
Display Modes | |
|
|