View Full Version : What's wrong with this script?
Industrial_One
11th November 2008, 18:36
AVISource("C:\clip1.avi").LanczosResize(720,480).Trim(0,414)+Trim(5601,6287)+AVISource("C:\clip2.avi").Trim(3022,0)
It says "invalid arguments to function Trim." How?
Gavino
11th November 2008, 18:42
Trim(5601,6287) has no clip to act on.
Edit: More often than not, "Invalid arguments to function xxx" happens because a filter has not been given an explicit clip and there is no implicit 'last' clip to use instead. After a while, it becomes automatic to make that the first thing to look for to resolve the problem.
mgh
11th November 2008, 18:43
try
avisource("C:\clip1.avi").Lanczosresize(720,480)
Trim(0,414) ++ Trim(5601,6287)
vid1=last
vid2=avisource(C:\clip2.avi").trim(3022,0)
vid1 ++ vid2
Industrial_One
11th November 2008, 20:56
Gavino, whaddya mean no clip to act on? It's pertaining to the first clip just like Trim(0,414), only I wanna do 2 trims hence I added the +. Is there an alternative?
mgh, that worked, thx. But it takes more typing than if Avisynth would accept my shorter script with the 2 trims. What is the function of vid1=last?
Gavino
11th November 2008, 21:20
Trim(5601,6287), without any prefix like "SomeFilter().", is taken by Avisynth to mean last.Trim(5601, 6287).
'last' is a special variable used by the Avisynth interpreter and is set on each statement that does not have an explicit assignment. In your example, there was no previous statement and 'last' was not set.
mgh's solution is correct, as the first line (implicitly) sets 'last', but if you want to make it shorter you could use:
avisource("C:\clip1.avi").Lanczosresize(720,480) # set last for following 2 trims
Trim(0,414) ++ Trim(5601,6287) ++ avisource(C:\clip2.avi").trim(3022,0)
Industrial_One
11th November 2008, 21:41
What if I wanna use 3 clips?
I tried your example, but it ain't working.
a=AVISource("C:\clip1.avi").LanczosResize(720,480)
Trim(0,414)+Trim(5601,6287)
a=last
b=AVISource("C:\clip2.avi").Trim(3022,0)
b=last
c=AVISource("C:\clip3.avi").LanczosResize(720,480)
a+b+c
What am I doing wrong?
Gavino
11th November 2008, 21:51
Remove the line "b=last", it's unnecessary and wrong.
You are basically repeating the two sections of clip1 instead of including clip2. That's because 'last' always refers to the result of the last statement that had no explicit assignment. In your case, last is still the result of the 2nd line, Trim(...)+Trim(...).
Industrial_One
11th November 2008, 22:03
I see, last works like a separator. However, script is still not working. It says invalid arguments for trim in line 2.
Guest
11th November 2008, 22:06
s=AVISource("C:\clip1.avi").LanczosResize(720,480)
a=Trim(s,0,414)+Trim(s,5601,6287)
b=AVISource("C:\clip2.avi").Trim(3022,0)
c=AVISource("C:\clip3.avi").LanczosResize(720,480)
a+b+c
If a clip result is not explicitly assigned to a variable, it is assigned to last.
If a clip input is not explicitly provided, it is taken from last (but only once).
That's it, it's not a "separator".
Gavino
11th November 2008, 22:08
Sorry, I didn't notice you had another error in the first line, remove "a=" so that 'last' gets set (or do it as neuron2 suggests).
Industrial_One
11th November 2008, 22:26
s=AVISource("C:\clip1.avi").LanczosResize(720,480)
a=Trim(s,0,414)+Trim(s,5601,6287)
b=AVISource("C:\clip2.avi").Trim(3022,0)
c=AVISource("C:\clip3.avi").LanczosResize(720,480)
a+b+c
If a clip result is not explicitly assigned to a variable, it is assigned to last.
If a clip input is not explicitly provided, it is taken from last (but only once).
That's it, it's not a "separator".
'Sup neuron2. Thanks for the help, your script did it. I apologize for being a dickwad on your site. I acquired this helicobacteria stomach infection, been pukin' every hour and it took forever to cure. I'm **** pissed off when I'm sick.
Guest
11th November 2008, 23:26
Please remember forum rule 4.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.