PDA

View Full Version : Variables And Crop


Got Milk?
9th August 2002, 20:28
I've set up variables on a compare script to save me time when choosing the best options to use before encoding. This works fine except crop won't accept the values.

Here's the AVS:LoadPlugin("c:\DVD\GORDIA~1\mpeg2dec.dll")
LoadPlugin("c:\DVD\GORDIA~1\GreedyHMA.dll")

source="Y:\VOBS\THEWEDDINGSINGER_UK_SCN\VIDEO_TS\The Wedding Singer.d2v"
caption1="Bilinear"
caption2="Blank"
caption3="Neutral"
caption4="Sharp"
GreedyHMA0="0,0,1,0,0,0,0,0"
GreedyHMA1="1,0,1,0,0,0,0,0"
size="10,15,701,547"

clip1=mpeg2source(source).crop(size).BilinearResize(512,272).Subtitle(caption1) <- Line 13
clip2=Blankclip(clip1).Subtitle(caption2)
clip3=mpeg2source(source).crop(size).BicubicResize(512,272,0,0.5).Subtitle(caption3)
clip4=mpeg2source(source).crop(size).BicubicResize(512,272,0,0.75).Subtitle(caption4)

vertclip1=StackVertical(clip1,clip2)
vertclip2=StackVertical(clip3,clip4)

StackHorizontal(vertclip1,vertclip2)I get the following error in VirtualDub:Avisynth open failure:
Script error: Invalid arguments to function "crop"
(C:\DVD\AVS\compare.avs, line 13)

Richard Berg
9th August 2002, 21:19
Sorry, you can't use a string to substitute for multiple integer arguments like that.

WarpEnterprises
9th August 2002, 23:48
Not completely true.
If you really want you can use something like:

vsource=mpeg2source(source)

clip1=Eval( "crop(source, " + size + ")" ).BilinearResize(512,272).Subtitle(caption1)


What doesn't work is:
clip1 = mpeg2source(source).Eval ....

Btw, I believe it's not good and at least not necessary to use mpeg2source for the same source threetimes !?!?

poptones
10th August 2002, 00:20
I didn't even notice that. You're right, I think. I know I get all kinds of crashes when trying that.

If you have one clip, best to open it once. Trim it if you need, but don't open it repeatedly in a script - lest you find this the hard way, halfway through a few hours of rendering.

Got Milk?
11th August 2002, 13:03
Originally posted by Richard Berg
Sorry, you can't use a string to substitute for multiple integer arguments like that. Okie doke, I assume GreedyHMA is just using the numbers as a string which allows this to work?

Originally posted by WarpEnterprises
Btw, I believe it's not good and at least not necessary to use mpeg2source for the same source threetimes !?!?I had no idea :) I found this script on a thread somewhere and just changed it a bit. I have very little knowledge of AVS scripting, how would you recommend I set up the script?

It's only opened in VDub to compare the filter effects anyway, so I don't suppose it really matters too much. :)

Thanks for all your help so far.

Richard Berg
11th August 2002, 15:12
Okie doke, I assume GreedyHMA is just using the numbers as a string which allows this to work?
Actually, you never call GreedyHMA at all.

how would you recommend I set up the script?

Something like this will avoid errors and probably be a lot faster too:


clip1=mpeg2source("foo")
clip2=clip1
clip3=clip1

#work with clips1-3

Got Milk?
11th August 2002, 20:45
Originally posted by Richard Berg

Actually, you never call GreedyHMA at all.I hadn't in that particular script, but I have used a variable with GreedyHMA previously. I just left it there to save me time next time I wanted to compare GreedyHMA stuff.

Thanks for the advice.