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

Reply
 
Thread Tools Search this Thread Display Modes
Old 31st July 2005, 14:17   #21  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
Join Date: Apr 2002
Location: Austria
Posts: 830
Indeed, you missed that you have to tell Zoom the variation with the frame number.
Try this:
Code:
imagereader("kill_bill.bmp",0,500,fps=25) 
converttorgb32()

#srcx/y is the CENTER of the source picture which is then mapped to a destination picture at dstx/dsty.
#zoom(srcx="640", srcy="480", factor="1")	#this gives the start picture
#zoom(srcx="734", srcy="320", factor="4")	#this gives the final picture
#but you want to zoom so use variable "n" to vary the arguments (n is the same as "current_frame" in scriptClip)
#best you use Spline as your function

sf=10	#startframe
ef=30 #endframe

srcx = "spline(n, sf-1,640, sf,640, ef,734, ef+1,734, false)"
srcy = "spline(n, sf-1,480, sf,480, ef,320, ef+1,320, false)"
factor="spline(n, sf-1,1,   sf,1,   ef,4,   ef+1,4,   false)"

zoom(srcx=srcx, srcy=srcy, factor=factor)	#this varies factor, dstx, dsty from frame 10 to frame 20.

ReduceBy2() # now...: downsize afterwards gives better antialiasing but is slower
All variables are strings which are evaluated when the frame is rendered (quite similar to ScriptClip). So you can put into those strings a constant or a function which depends on "n" (the frame number).
It's that complicated to allow any "path" functions (e.g. you can spiral or sine your picture by using srcx/y=sin/cos)

Last edited by WarpEnterprises; 31st July 2005 at 14:20.
WarpEnterprises is offline   Reply With Quote
Old 31st July 2005, 15:11   #22  |  Link
AsTimeGoesBy
Registered User
 
AsTimeGoesBy's Avatar
 
Join Date: Oct 2004
Location: 'neutral' zone
Posts: 110
Thanks for re-writing that script! - It works fine although i don't know exaclty how and why...

It's great the zoom length can be easily defined now, initially i had no idea where to do this...



At first sight i have the impression the zoom is flying a 'skyward bow' onto the eyes!?
But before i post more thoughts i guess i have to learn more about these internal Avisynth functions like spline()...

Last edited by AsTimeGoesBy; 31st July 2005 at 15:35.
AsTimeGoesBy is offline   Reply With Quote
Old 25th September 2005, 03:21   #23  |  Link
ll4ever
Registered User
 
Join Date: Jun 2005
Posts: 1
I've been trying to make this work...but it's not doing what I want.

I have a 640X480 video made from a bmp using imagereader. I want it to zoom out instead of in. If I play it backwards, it does what I want but how do you make it work the other way?

Code:
imagereader("E:\LM\IMG00022.bmp",0,100,fps=20) 
converttorgb32()
sf=0	#startframe
ef=100      #endframe
srcx = "spline(n, sf-1,320, sf,320, ef,320, ef+1,240, false)"
srcy = "spline(n, sf-1,240, sf,240, ef,240, ef+1,240, false)"
factor="spline(n, sf-1,1,   sf,1,   ef,8,   ef+1,8,   false)"
zoom(srcx=srcx, srcy=srcy, factor=factor)
ll4ever is offline   Reply With Quote
Old 26th September 2005, 07:09   #24  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
Join Date: Apr 2002
Location: Austria
Posts: 830
exchange the values from the number pairs with "sf" with those "ef":

Code:
srcx = "spline(n, sf-1,240, sf,320, ef,320, ef+1,320, false)"
srcy = "spline(n, sf-1,240, sf,240, ef,240, ef+1,240, false)"
factor="spline(n, sf-1,8,   sf,8,   ef,1,   ef+1,1,   false)"
should work.
I think the srcx, srcy lines are not necessary as it centers the picture as default.
WarpEnterprises is offline   Reply With Quote
Old 8th June 2008, 10:29   #25  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
Sorry to dig this up.
I'm trying to make a clip move in a arc/circle (orbit), how could this be done?
Math-wise to draw a circle: x^2+y^2= r^2

in zoom: +-Sq(#frames^2-n^2) ???

the last line is wrong, but i believe the top 2 are good. This is of course missing startF and endF which are the desired start and end points.
Code:
String((endFrame-startFrame)/2.0) + ">n?" 
\+ " pow(" + String(pow((endFrame-startFrame)/2.0,2)) + "-pow(n,2),0.5)" + 
\" : pow(" + String(pow((endFrame-startFrame)/2.0,2)) + "-pow(" + String(endFrame-startFrame) + "-n,2),0.5)" + ""

This will draw a straight line
Code:
"spline(n, "
\ + String(startFrame) + "," + String(startF) + ", "
\ + String(endFrame) + "," + String(endF) + ", true)"


Using this for my KenBurnsEffect Function


Here is a function that i am currently developing
Code:
Function SplineCalc(clip c, int mode, int startFrame, float startF, int endFrame, float endF)
{
	splineString = mode==1 ?
	\ "spline(n, "
	\ + String(startFrame-1) + "," + String(startF) + ", "
	\ + String(startFrame) + "," + String(startF) + ", "
	\ + String(endFrame) + "," + String(endF) + ", "
	\ + String(endFrame+1) + "," + String(endF) + ", true)"
	
	\ : mode==2 ? "spline(n, "
	\ + String(startFrame) + "," + String(startF) + ", "
	\ + String(startFrame+(endFrame-startFrame)/3.0) + "," + String(startF) + ", "
	\ + String(endFrame-(endFrame-startFrame)/3.0) + "," + String(endF) + ", "
	\ + String(endFrame) + "," + String(endF) + ", true)"
	
	\ : mode==3 ? "spline(n, "
	\ + String(startFrame) + "," + String(startF) + ", "
	\ + String(startFrame+(endFrame-startFrame)/3.0) + "," + String(endF) + ", "
	\ + String(endFrame-(endFrame-startFrame)/3.0) + "," + String(startF) + ", "
	\ + String(endFrame) + "," + String(endF) + ", true)"
	
	\ : mode==4 ? "spline(n, "
	\ + String(startFrame) + "," + String(startF) + ", "
	\ + String((endFrame-startFrame)/2.0) + "," + String(startF) + ", "
	\ + String(endFrame) + "," + String(endF) + ", true)"
	
	\ : mode==5 ? "spline(n, "
	\ + String(startFrame) + "," + String(startF) + ", "
	\ + String((endFrame-startFrame)/2.0) + "," + String(endF) + ", "
	\ + String(endFrame) + "," + String(endF) + ", true)"	
	
	\ : "spline(n, "
	\ + String(startFrame) + "," + String(startF) + ", "
	\ + String(endFrame) + "," + String(endF) + ", true)"
	Return splineString
}
By setting srcx to mode 4 and srcy to mode 5 it will sorta draw a arc.


Any example would be helpful, demonstrating a circle/arc. The example doesn't have to use my syntax, i just need anything. Doing a search got me this




EDIT:
Found an old script that uses layer to do this
Here is my take on that code
Code:
a = Colorbars().Trim(0,199)
b =  a.Invert().BilinearResize(320,240)

Animate(0,199, "circlee", a,b,320,240,60.0,0.0 , a,b,320,240,0.0,50.0 )

# circle: gives a clip which is moved along (by varying "t") a circle with center (centerX,centerY)
# with radius "axis" the resulting clip on a black background.
function circlee(clip clip, clip "LClip", int "centerX", int "centerY", float "axis", float "t") 
{
	x = round((centerX-LClip.width/2)+axis*cos(Pi*t*0.5))
	y = round((centerY-LClip.height/2)+axis*sin(Pi*t*0.5)-axis)
	return clip.Layer(LClip, "Add", 255, x,y)
}

Last edited by mikeytown2; 8th June 2008 at 19:28.
mikeytown2 is offline   Reply With Quote
Old 8th June 2008, 20:13   #26  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,433
Quote:
Originally Posted by mikeytown2 View Post
Sorry to dig this up.
I'm trying to make a clip move in a arc/circle (orbit), how could this be done?
Here's the basic idea to get you started:
A point (x, y) on the circle of radius r centred at (x0, y0) satisfies the equation (x-x0)^2 + (y-y0)^2 = r^2.
This can be recast as x= x0 + r*cos(theta), y= x0+ r*sin(theta) for some angle theta.
To trace out a circle, vary theta from 0 to 2*Pi.
To trace out an arc, vary theta over some continuous range.

The variation (of theta) can be done linearly with Animate, or in some arbitrary way with the Zoom plugin by deciding how you want theta to vary in terms of 'n' (the frame number); for linear variation (constant rotation speed) you would use theta = k*(n-startFrame) for some constant k. Then use the earlier equations to derive x and y from theta.

Last edited by Gavino; 8th June 2008 at 23:17. Reason: Clarification + removed reference to Spline
Gavino is offline   Reply With Quote
Old 16th February 2014, 19:13   #27  |  Link
Paser
Registered User
 
Join Date: Jan 2014
Posts: 15
Here's a version I've compiled to work with 64-bit AviSynth.
Attached Files
File Type: 7z Zoom.7z (8.8 KB, 803 views)
Paser is offline   Reply With Quote
Old 9th May 2015, 19:24   #28  |  Link
l33tmeatwad
Registered User
 
l33tmeatwad's Avatar
 
Join Date: Jun 2007
Posts: 417
Link in the first post is broken so here is the current location for the original x86 download:
http://www.avisynth.nl/users/warpenterprises/

Last edited by l33tmeatwad; 31st March 2017 at 15:17.
l33tmeatwad is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 12:40.


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