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 > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 30th October 2009, 06:25   #1  |  Link
Redsandro
Unregistered User
 
Redsandro's Avatar
 
Join Date: Jul 2008
Location: Netherlands
Posts: 133
Apply motion data from a clip to something else - MVTools2

Hi,

I am pretty sure you've all seen this:
Some mpeg4 movie has a keyframe gone bad and you see something completely different distorting and moving by the motion estimation data from the animation that was supposed to start in that keyframe.

A few years ago, I think when codecs were more buggy, you could also see this effect right after fast forwarding.

I am looking for a way to deliberately do this. Move the contents of an image according to the motion detected in other footage.

I once saw a combination of filters for Avisynth that made objects look like they were growing or shrinking because of a motion vector filter reacting on luminance of the footage. That's probably the closest thing I saw in this direction, so my best bet would be that Avisynth is capable of something like that.

Can anyone point me in the right direction for realizing this, or tell me that it is not possible?
__________________
avi + m2t -> Vdub + DGIndex -> AE CS3 -> x264 -> Hell On Earth
Woop, woop! That's the sound of the police!

Last edited by Redsandro; 30th October 2009 at 23:32. Reason: topic title
Redsandro is offline   Reply With Quote
Old 30th October 2009, 09:34   #2  |  Link
videoFred
Registered User
 
videoFred's Avatar
 
Join Date: Dec 2004
Location: Terneuzen, Zeeland, the Netherlands, Europe, Earth, Milky Way,Universe
Posts: 689
Quote:
Originally Posted by Redsandro View Post
I once saw a combination of filters for Avisynth that made objects look like they were growing or shrinking because of a motion vector filter reacting on luminance of the footage. That's probably the closest thing I saw in this direction, so my best bet would be that Avisynth is capable of something like that.
Averaging multiple frames. You need MVTools for this..

Fred.
__________________
About 8mm film:
http://www.super-8.be
Film Transfer Tutorial and example clips:
https://www.youtube.com/watch?v=W4QBsWXKuV8
More Example clips:
http://www.vimeo.com/user678523/videos/sort:newest
videoFred is offline   Reply With Quote
Old 30th October 2009, 13:06   #3  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,488
You might be able to splice non-keyframe data (say, from Xvid) onto to a different key frame to achieve the same effect. I thought I could do this in Virtualdub in Direct Stream Copy mode, but somehow it seems to encode an extra keyframe!

David
wonkey_monkey is offline   Reply With Quote
Old 30th October 2009, 23:30   #4  |  Link
Redsandro
Unregistered User
 
Redsandro's Avatar
 
Join Date: Jul 2008
Location: Netherlands
Posts: 133
Hey that MVTools2.dll looks very promising!
The functionality definitely has it's origin in the same motion compensation tricks that mpeg does that would cause the stuff I mentioned in the OP.

I am going to toy around with it to see if it reaches the amount of precision I need. MFlow() looks very cool for that.

First question, why does the target(footage) (that is going to be distorted/compensated) require a superclip? It is just getting it's pixels moved.
So either I don't get it, or I am using this wrong. I read the documentation but I don't get what superclip is good for.

To illustrate:
Code:
LoadPlugin("D:\Program Files (x86)\AviSynth 2.5\plugins\mvtools\mvtools2.dll")
source = ImageSource("motion%04d.png", start=0, end=100, fps=25, pixel_type="RGB24").ConvertToYUY2()
mSuper = MSuper(source, pel=2, rfilter=2)
mVector = MAnalyse(mSuper, blksize=8)

target = ImageSource("test.jpg", end=100, fps=25).ConvertToYUY2()
tSuper = MSuper(target, pel=2, rfilter=2) # why?

MCompensate(target, tSuper, mVector)
Footages are RGB but converted because I read that MVTools cannot use RGB footage. Sounds weird for someone working in RGB most of the time but it's probably very logical.

And how can I update the target so the next frame is the previous compensated frame?
MCompensate(target, tSuper, mVector)
Here every next frame has one frame worth of compensation applied, but I want the compensation to be cumulative. So for example target frame 10 has not only the compensation for 9-10, but for 0-10.
Right now when I substitute MFlow() it looks really bad, like there's a cheap water effect on my target footage. Also with blksize=4, search=5. But maybe I cannot see the movement clearly because every new compensation doesn't use the previous compensation as a basis like it should to get closer to the effect I want.

PS - There's a typo in the latest mvtools2.dll:
MCompensate : wring source or super frame size

-edit-

While googling for help, I also stumbled across this, it illustrates my OP.
__________________
avi + m2t -> Vdub + DGIndex -> AE CS3 -> x264 -> Hell On Earth
Woop, woop! That's the sound of the police!

Last edited by Redsandro; 31st October 2009 at 01:15.
Redsandro is offline   Reply With Quote
Old 8th December 2009, 04:29   #5  |  Link
Redsandro
Unregistered User
 
Redsandro's Avatar
 
Join Date: Jul 2008
Location: Netherlands
Posts: 133
Dammit they stole my idea but didn't bother to tell me how to do it.

Chairlift - Evident Utensil
http://www.youtube.com/watch?v=3pU9oAIFLcY

I am still looking for a way to do something like that without going into the decoder source code to mess up I-frames or something. I think it is possible with MVtools if I can calculate the integral from the motion vectors so that for example on frame 10 you have the vectors relative to frame 1 in stead of to the previous frame.
__________________
avi + m2t -> Vdub + DGIndex -> AE CS3 -> x264 -> Hell On Earth
Woop, woop! That's the sound of the police!
Redsandro is offline   Reply With Quote
Old 8th December 2009, 05:10   #6  |  Link
Stephen R. Savage
Registered User
 
Stephen R. Savage's Avatar
 
Join Date: Nov 2009
Posts: 327
  1. The difference between MCompensate and MFlow is that MCompensate moves blocks and MFlow moves individual pixels. That is what causes the wavy effect. MFlow is more for when you want to convert the framerate or something similar, as it produces a smoother result.
  2. The target needs a super clip because the motion vector can have subpixel precision (e.g. MOVE {23 36} BY {30.5 20.25}). Basically, MSuper is a speed optimisation, because if it weren't there, each time you called MVTools, it would have to generate the supersampled data again.
  3. I think what you want is the recursion parameter to MCompensate.

Last edited by Stephen R. Savage; 8th December 2009 at 05:18.
Stephen R. Savage is offline   Reply With Quote
Old 8th December 2009, 08:02   #7  |  Link
Redsandro
Unregistered User
 
Redsandro's Avatar
 
Join Date: Jul 2008
Location: Netherlands
Posts: 133
Quote:
Originally Posted by Stephen R. Savage View Post
I think what you want is the recursion parameter to MCompensate.
Yes, yes that is it. Too bad it doesn't work for mflow. The mcompensate results are very blocky and noisy. I cannot fake a movement this way because after a few frames the target image looks like it was painted with the spraycan from the classic ms-paint. Remember that?
__________________
avi + m2t -> Vdub + DGIndex -> AE CS3 -> x264 -> Hell On Earth
Woop, woop! That's the sound of the police!
Redsandro is offline   Reply With Quote
Old 8th December 2009, 16:01   #8  |  Link
Leak
ffdshow/AviSynth wrangler
 
Leak's Avatar
 
Join Date: Feb 2003
Location: Austria
Posts: 2,441
Quote:
Originally Posted by Redsandro View Post
Dammit they stole my idea but didn't bother to tell me how to do it.

Chairlift - Evident Utensil
http://www.youtube.com/watch?v=3pU9oAIFLcY
Can't watch this video (thanks, YouTube) but here's another one:

Triptych Part 3 by Blockhead...
__________________
now playing: [artist] - [track] ([album])
Leak is offline   Reply With Quote
Old 8th December 2009, 16:49   #9  |  Link
Redsandro
Unregistered User
 
Redsandro's Avatar
 
Join Date: Jul 2008
Location: Netherlands
Posts: 133
Yes, good one, the effect in that one is a LOT better than what I manage to simulate using these simple lines:
Code:
LoadPlugin("D:\Program Files (x86)\AviSynth 2.5\plugins\mvtools\mvtools2.dll")

#Load sequence
source = ImageSource("PC03_%04d.png", start=0, end=80, fps=25, pixel_type="RGB24")
source = source.ConvertToYUY2().Reverse()

mSuper = MSuper(source, pel=1, rfilter=2) # pel=2 not supported for recursion
mVector = MAnalyse(mSuper, blksize=4, search=5)

target = ImageSource("test2.png", end=80, fps=25)
target = target.ConvertToYUY2()

tSuper = MSuper(target, pel=1, rfilter=2) # pel=2 not supported for recursion

# Debug 
#MShow(mSuper, mVector)

#MVFlow()

# Motion Compensation output
MCompensate(target, tSuper, mVector, recursion=100)
Can anyone help with a more descent approach using AviSynth filters?
__________________
avi + m2t -> Vdub + DGIndex -> AE CS3 -> x264 -> Hell On Earth
Woop, woop! That's the sound of the police!
Redsandro is offline   Reply With Quote
Reply


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 22:46.


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