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. |
11th September 2010, 20:01 | #1 | Link |
Registered User
Join Date: Sep 2010
Location: Arkansas U.S.A.
Posts: 1
|
Frame number variable
Am new to Avisynth but am enjoying it
I have looked through all of the documentation that I can find but cannot find a system variable that gives me the current frame number I am trying to adjust the "Size" parameter of "Subtitle" to make the text expand from nothing to full size based on the frame number These are the lines what I have tried without success: # size=GetFrameNumber() # scriptclip(" size=GetFrameNumber() ") # scriptclip(" size=current_frame ") # size=value(scriptclip(" (GetFrameNumber()) ")) Is this possible or is there another way to do this? Thank you Last edited by McDanGeo; 11th September 2010 at 20:35. Reason: added code attempts |
11th September 2010, 23:32 | #3 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
@McDanGeo,
Welcome to Avisynth. Like most new users you need to shift your paradigm. Avisynth scripts specify operations on entire clips not individual frames. It takes a little while to get used to this but once your mind clicks into gear you will never look back. Also it is more normal at Doom9 to open a new thread to ask questions like this. Using existing threads tends to get your issue ignored, as the existing title probably does not represent your issue. The function you are looking for is Animate. When using functions like Subtitle which have many arguments, it is normal to use argument naming so you do not have to fill in all the default argument positions. Using Animate is a bit of a pain in this regard because any named arguments belong to Animate not the filter being animated. To get around this issue you can define a user function to feed to Animate so that all the other argument naming etc is done in the user function. Thus to do what you want :- Code:
Function MyTitle(Clip clip, Int mysize) { Return clip.Subtitle("My Message", font="Arial", size=mysize, text_color=color_palegreen, first_frame=42, last_frame=1342) } ....Source(...) Animate(42, 342, "MyTitle", 0.125, 36.0) The above example will evaluate MyTitle from frame 0 to frame 42 with 0.125 and from frame 342 to the end with 36.0. From frame 42 to frame 342 it will smoothly interpolate the argument from 0.125 upto 36.0. Inside the MyTitle function titling will start at frame 42 and continue until frame 1342, so from frame 342 to 1342 the size will be 36.0. |
12th September 2010, 05:33 | #5 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
@ajp_anton,
Bad advice! Never use scriptclip() unless you have absolutely no other choice. If you are reaching for scriptclip() or it's relations then you are probably approaching the problem from the wrong direction. That said, sometimes scriptclip() is the only tool that will do the job, this fortunately is not one of them. |
16th September 2010, 20:54 | #8 | Link | |
Registered User
Join Date: Apr 2007
Posts: 240
|
Quote:
http://forum.doom9.org/showthread.php?t=141883 |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|