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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Today's Posts Search

Reply
 
Thread Tools Search this Thread
Old 20th June 2003, 19:57   #1  |  Link
LaVacheQuiRi
Registered User
 
Join Date: May 2003
Location: Seattle WA
Posts: 2
Can't use variable as function argument in AviSynth

Hi everybody,

This is my first post so please go easy on me. I am using the "BlankClip" and "Subtitle" functions to create opening titles for my movie. I am using AviSynth 2.5.2. My intention is to replace the numerical values of the "first_frame" and "last_frame" arguments of the "Subtitle" function with variables, so I may re-assign variables at the top of my scrips rather than change the hard-coded frame numbers throughout my script. Here is an example:

Quote:
content=AviSource("content.avs")
FR=content.framerate

T1D = 3 # Title 1 Duration (in seconds)
T2D = 3 # Title 2 Duration
T3D = 3 # Title 3 Duration
T4D = 3 # Title 4 Duration

T1B = 0 # Title 1 beginning frame
T1E = (T1D * FR) - 1 # Title 1 ending frame
T2B = T1E + 1 # Title 2 beginning frame
T2E = T2B + (T2D * FR) - 1 # Title 2 ending frame
T3B = T2E + 1
T3E = T3B + (T3D * FR) - 1
T4B = T3E + 1
T4E = T4B + (T4D * FR) - 1

TDAll = (T1D + T2D + T3D + T4D) * FR

BlankClip(content, 360, color=$FFFFFF) # This line works

#BlankClip(content, TDAll, color=$FFFFFF) # This line doesn't

Subtitle("test", -1, 64, 0, 89, "Times New Roman", 44, 0, $FFFFFF, 8, 0) # This line works

#Subtitle("test", -1, 64, T1B, T1E, "Times New Roman", 44, 0, $FFFFFF, 8, 0) # This line doesn't
I have assigned the variables "T1B" and "T1E" with numerical values, yet when I try to open the script with the second Subtitle line above activated, I get the following error:

Quote:
Script error: Invalid arguments to function "Subtitle"
The Avisynth site is quite excellent, but it does not contain much sample code demonstrating the use of variables as function arguments. Am I doing something wrong? Any help would be greatly appreciated.
__________________
LaVacheQuiRi
LaVacheQuiRi is offline   Reply With Quote
Old 20th June 2003, 20:10   #2  |  Link
killingspree
Newbie Forum Mod
 
killingspree's Avatar
 
Join Date: Aug 2002
Location: way too deep in (cyber)space
Posts: 2,436
hi and welcome to the forum

not all first questions are newbie questions ... moving your thread to the avisynth forum!

steVe
__________________
Search the forum, read the forum rules once more and use the search function on doom9.org before posting!
oh btw my amazon.de wishlist
killingspree is offline   Reply With Quote
Old 20th June 2003, 21:21   #3  |  Link
Dark-Cracker
Registered User
 
Dark-Cracker's Avatar
 
Join Date: Feb 2002
Posts: 1,195
hi,

replace :

FR=content.framerate

by :

FR=round(content.framerate)

i think framerate return a float (or perhaps even a string) and this is not very well supported .
here is how to cast value for avisynth.
http://www.avisynth.org/index.php?page=ScriptFunctions


Ps: welcome

Bye.
__________________

AutoDub v1.8 : Divx3/4/5 & Xvid Video codec and .OGG/.MP3/.AC3/.WMA audio codec.
AutoRV10 v1.0 : Use RealVideo 10 Codec and support 2 Audio Streams and Subtitles.

Dark-Cracker is offline   Reply With Quote
Old 20th June 2003, 23:16   #4  |  Link
LaVacheQuiRi
Registered User
 
Join Date: May 2003
Location: Seattle WA
Posts: 2
Thank you Dark-Cracker, that works marvelously. I should be back next week with some new questions.
__________________
LaVacheQuiRi
LaVacheQuiRi 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 21:25.


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