PDA

View Full Version : Evolving picture in picture


dplaton
17th February 2005, 13:53
It is possible to make an evolving PIP,
let's say that the small picture grow until replace the main clip?

Wilbert
17th February 2005, 14:11
Yup, using Animate, *Resize, Overlay and BlankClip. See documentation of Animate for examples.

dplaton
17th February 2005, 14:22
Before I asked I checked the animation documetation RFM :)

# Do a gradual zoom into the center of a 320x240 video, starting at
# 1:1 magnification in frame 100 and ending with 4:1 magnification
# in frame 200

#31-03-04 This wont work - Bicubic needs extra parameters!
#maybe try BilinearResize instead
Animate(100, 200, "BicubicResize",last, 0, 0, 320, 240, 320, 240, last, 120, 90, 80, 60, 320, 240)


I wonder how to grow a small sqare placed in a corner that eventualy replace the main picture.

E-Male
17th February 2005, 16:34
with an own function, controlled by animate, this should be possible

dplaton
18th February 2005, 08:39
In fact the problem is how to do a cicle like for() or do() in order to vary the arguments of Animate or other AviSynth functions.

E-Male
18th February 2005, 09:20
animate is the command to change the parameter(s) of something else

dplaton
18th February 2005, 09:24
The question is a generic one

FOR i=1 to n
AviSynthFunction(i)

i=i+1
LOOP

stickboy
18th February 2005, 12:10
The generic way to create loops in AviSynth is to write recursive functions, but such loops wouldn't do what you want anyway, which is to vary the parameters to a filter across a range of frames. For your case, you really do want to use Animate.

E-Male
18th February 2005, 12:39
http://www.avisynth.org/Animate

animate is what you need

Wilbert
18th February 2005, 22:58
You can use WarpEnterprises' Zoom plugin. But you can also try and adjust the following script to your needs


function res(clip clip, clip "LClip", int "width", int "height", int "centerX", int "centerY") {
LClip = BicubicResize(LClip, width, height)
Overlay(clip, LClip, centerX-LClip.width/2, centerY-LClip.height/2)
}

function resize(clip clip, clip "LClip", int "start_frame", int "start_width", int "start_height",
\ int "end_frame", int "end_width", int "end_height", int "centerX", int "centerY") {
return Animate(start_frame, end_frame, "res", clip, LClip, start_width, start_height, centerX, centerY,
\ clip, LClip, end_width, end_height, centerX, centerY)
}

clip = AviSource("D:\captures\jewel.avi").BicubicResize(640,480).ConvertToRGB()
black = BlankClip(clip)

resize(black, clip, 0, 120, 120*clip.height/clip.width, 500, 640, 480, clip.width/2, clip.height/2)

dplaton
21st February 2005, 11:22
Thanks Wilbert.

It will be helpfull for me if you can tell me how to pass the frame number to a variable.

I read the AviSynth documentation and I didn't find how to

var=actual_frame_number

I started a thread on this topic but until now I didn't receive any useful answer.

I want to build a user function and call this function in Animate.
Animate can play the role of a cicle, but I need to know the frame number at a given moment in order to construct the user function based on the frame evolution.

It must be something like frame_number that can be read.

stickboy
21st February 2005, 11:28
Originally posted by dplaton
It must be something like frame_number that can be read.That isn't how Animate works. It's not like FrameEvaluate or ScriptClip.

You don't need any such frame_numbervariable anyway. Animate varies its parameters for you!Animate(100, 200, "Foo", 100, 200)applies Foo(100) to frame 100, Foo(101) to frame 101, ..., Foo(200) to frame 200.

dplaton
21st February 2005, 11:36
I want to construct a user function like this
user_function strech
resize((720-frame_number),576)
addborder(0,0,frame_number,0)


Animate(frame1,frame10, strech...


So I need to know the actual_frame_number.

From where take ShowFrameNumber the value?

stickboy
21st February 2005, 11:45
Originally posted by dplaton
It must be something like frame_number that can be read.No.
So I need to know the actual_frame_number.Why? Why can't you determine the range of frames you need to use and have Animate vary the parameters appropriately as I showed in my example?
So I need to know the actual_frame_number.I don't know what "actual_frame_number" is supposed to mean.

dplaton
21st February 2005, 11:55
If the frame number is X I want to

resise((720-x),constant)
addborder(0,0,X,0)

the frame size remain unchanged the picture sesize

Animate gives the range

and everything is OK,

but I must to know the frame_number in order to pass to X
(of course it must to manipulate frame_number in order that the X value stays in the apropriate range 1-720, but this is an other thing)

stickboy
21st February 2005, 12:01
Originally posted by dplaton
If the frame number is X I want to

resise((720-x),constant)
addborder(0,0,X,0)

the frame size remain unchanged the picture sesizePlease reread all the example code that has been given to you so far. Your function does not need to determine the frame number, because as already mentioned, Animate will take care of it for you.

I guess I wasn't explicit enough in my previous example. Let me try again:function MyResizer(clip c, int x)
{
c = c.resize(720 - x, constant)
c = c.AddBorders(0, 0, x, 0)
return c
}

src = AviSource("foo.avi")
src.Animate(0, FrameCount(), "MyResizer", 0, FrameCount())And now MyResizer will be called for every single frame of src. For frame n, Animate will call src.MyResize(n).

dplaton
21st February 2005, 12:19
That's quite fine, but if my start frame is 888 and my end frame is 1999

I have 1 question and 1 problem

The question is the value passed by animate to the user_function wil be
1,2,3 and so on?

The problem is that the range 888-1999 surpass the acceptable size of a frame, in order to avoid that I must to manipulate the value passed by Animate. I want to use a formula in the resize like height=720-int(X/3.14)*2, where X is the frame number.

How knows ShowFrameNumber what number to display?

stickboy
21st February 2005, 12:25
Originally posted by dplaton
That's quite fine, but if my start frame is 888 and my end frame is 1999Animate(888, 1999, "MyResize", 888, 1999). This will call MyResize(888), MyResize(889), ..., MyResize(1999) on frames 888 through 1999 respectively.
The question is the value passed by animate to the user_function wil be
1,2,3 and so on?No, please read the Animate documentation.

If you use Animate in the way everyone has suggested, you will have exactly the same behavior as if you could read the frame number from the clip.How knows ShowFrameNumber what number to display?Please stop asking this. It is not how you should be thinking about this problem, and it's only distracting you from the proper method.

dplaton
21st February 2005, 12:48
I don't want distraction.

I understand that even ShowFrameNumber show the FrameNumber
such a thing like FrameNumber doesn't exist.

I understand that it is not possible to construct o user function where
the frame number can be multiplied, substracted, or everything else.
Frame number it self can't be pass as an argument to a mathematical equation.
Or, more properly, I'm not able to understand how I could do this.

The examples that you kindly provided haven't IMO do not answer to my humble question.

Please excuse me for my lack of understanding ability.

My posts were not made in to purpose to annoy somebody.

dplaton
21st February 2005, 13:31
Dear stickboy,

Please accept my appologies.
I was blind.
I was used with instruction like goto n, if n and so on.