maskAndLayer() trouble

This forum is for questions and discussion of all the aspects of handling and cleaning up your footage with Avisynth.
Locked
User avatar
SQ
Doesn't have a title
Joined: Fri Nov 08, 2002 8:11 pm
Status: youtube.com/SQ
Location: Upstate NY
Contact:
Org Profile

maskAndLayer() trouble

Post by SQ » Wed Oct 10, 2007 11:22 am

So I was reading the guide to maskandlayer() for WMM.
Put it simply, I can't get it to work.

I was just playing around - this isn't for a real video or anything, hence why the videos aren't mine. Just stuff I had on my desktop.

Code: Select all

MaskAndLayer(baseclip(), layerclip(), maskclip())

clip baseclip = AviSource("E:\Documents and Settings\SQ.AMPAGE\Desktop\guessclip_moonie211.avi")
clip layerclip = AviSource("E:\Documents and Settings\SQ.AMPAGE\Desktop\guessclip_moonie211.avi")
clip maskclip = ImageSource("E:\Documents and Settings\SQ.AMPAGE\Desktop\mask.png")

function MaskAndLayer(clip baseclip, clip layerclip, clip maskclip, int "x", int "y", int "width", int "height")
{
x = default(x,0)
y = default(y,0)
width = default(width,width(layerclip))
height = default (height, height(layerclip))

baseclip = baseclip.converttorgb32()
layerclip = layerclip.converttorgb32()laczosresize(width, height)
maskclip = maskclip.converttorgb32().naczosresize(width(layerclip), height(layerclip))

maskedlayerclip = mask(layerclip, maskclip)
output = layer(baseclip, maskedlayerclip, op="add",level=255, x=x, y=y)
return output
}
Basically what happens is when I go into MakeAVIs, it says it doesn't know what clip means.
When I take out clip for defining my source, it says there's no function named baseclip.

So I think I'm defining my sources wrong. I tried looking in the AVS Wiki, and that didn't help. So what am I doing wrong? I know it's something stupid and simple.
Discord: @standardquip (Vars)
BentoVid.com

User avatar
Scintilla
(for EXTREME)
Joined: Mon Mar 31, 2003 8:47 pm
Status: Quo
Location: New Jersey
Contact:
Org Profile

Post by Scintilla » Wed Oct 10, 2007 12:03 pm

Baseclip, layerclip, and maskclip are not functions, so take out the parentheses after them in the MaskAndLayer call in the first line. Then get rid of the "clip" declarations.
ImageImage
:pizza: :pizza: Image :pizza: :pizza:

User avatar
SQ
Doesn't have a title
Joined: Fri Nov 08, 2002 8:11 pm
Status: youtube.com/SQ
Location: Upstate NY
Contact:
Org Profile

Post by SQ » Wed Oct 10, 2007 12:08 pm

In make AVIs it says:

AviSynth error:
"I don't know what "baseclip" means
(makeAVIS_avisynth_script, line 1)"

After changing the parameters you described.
Discord: @standardquip (Vars)
BentoVid.com

User avatar
SQ
Doesn't have a title
Joined: Fri Nov 08, 2002 8:11 pm
Status: youtube.com/SQ
Location: Upstate NY
Contact:
Org Profile

Post by SQ » Wed Oct 10, 2007 12:28 pm

Sorry for doublepost, but here's the changed script, in case I misunderstoof you or did something else wrong:

Code: Select all

MaskAndLayer(baseclip, layerclip, maskclip)

baseclip = AviSource("E:\Documents and Settings\SQ.AMPAGE\Desktop\guessclip_moonie211.avi")
layerclip = AviSource("E:\Documents and Settings\SQ.AMPAGE\Desktop\guessclip_moonie211.avi")
maskclip = ImageSource("E:\Documents and Settings\SQ.AMPAGE\Desktop\mask.png")

function MaskAndLayer(clip baseclip, clip layerclip, clip maskclip, int "x", int "y", int "width", int "height")
{
x = default(x,0)
y = default(y,0)
width = default(width,width(layerclip))
height = default (height, height(layerclip))

baseclip = baseclip.converttorgb32()
layerclip = layerclip.converttorgb32()laczosresize(width, height)
maskclip = maskclip.converttorgb32().naczosresize(width(layerclip), height(layerclip))

maskedlayerclip = mask(layerclip, maskclip)
output = layer(baseclip, maskedlayerclip, op="add",level=255, x=x, y=y)
return output
}
Discord: @standardquip (Vars)
BentoVid.com

User avatar
Scintilla
(for EXTREME)
Joined: Mon Mar 31, 2003 8:47 pm
Status: Quo
Location: New Jersey
Contact:
Org Profile

Post by Scintilla » Wed Oct 10, 2007 12:53 pm

Oh, sorry about that. The call to MaskAndLayer should come <i>after</i> you define the three clips.
ImageImage
:pizza: :pizza: Image :pizza: :pizza:

User avatar
SQ
Doesn't have a title
Joined: Fri Nov 08, 2002 8:11 pm
Status: youtube.com/SQ
Location: Upstate NY
Contact:
Org Profile

Post by SQ » Wed Oct 10, 2007 1:09 pm

Thank you! It worked! Except there's a new problem, now.

When I tried to import the fake AVI into WMM, WMM says this:

The file E:\Documents and Settings\SQ.AMPAGE\Desktop\maskandlayer.avi cannot be imported because the codec required to play the file is not installed on your computer. If you have already tried to download and install the codec, close and restart Windows Movie Maker, and then try to import the file again.

The file(both avs and fake avi) work in virtual dub, and I do have the codec. However to be sure I changed the files in the avs script to huffyuv files, instead:

Code: Select all

baseclip = AviSource("F:\FFF\export\FFF- Huffy.avi")
layerclip = AviSource("F:\FFF\export\FFF- Huffy.avi")
maskclip = ImageSource("C:\mask.png")

MaskAndLayer(baseclip, layerclip, maskclip)


function MaskAndLayer(clip baseclip, clip layerclip, clip 

maskclip, int "x", int "y", int "width", int "height")
{
x = default(x,0)
y = default(y,0)
width = default(width,width(layerclip))
height = default (height, height(layerclip))

baseclip = baseclip.converttorgb32()
layerclip = layerclip.converttorgb32().lanczosresize(width, 

height)
maskclip = 

maskclip.converttorgb32().lanczosresize(width(layerclip), 

height(layerclip))

maskedlayerclip = mask(layerclip, maskclip)
output = layer(baseclip, maskedlayerclip, op="add",level=255, x=x, 

y=y)
return output
}
But I am still getting the codec problem from WMM.

How can I resolve this? Or is there no way going around VirtualDub?
Discord: @standardquip (Vars)
BentoVid.com

User avatar
Kionon
I ♥ the 80's
Joined: Fri Mar 02, 2001 10:13 pm
Status: Ayukawa MODoka.
Location: I wonder if you know how they live in Tokyo... DRIFT, DRIFT, DRIFT
Contact:
Org Profile

Post by Kionon » Wed Oct 10, 2007 1:58 pm

I'd love to see the three seperate clips.
ImageImage
That YouTube Thing.

User avatar
Scintilla
(for EXTREME)
Joined: Mon Mar 31, 2003 8:47 pm
Status: Quo
Location: New Jersey
Contact:
Org Profile

Post by Scintilla » Wed Oct 10, 2007 3:06 pm

First, try sticking a ConvertToRGB32() after the call to MaskAndLayer.

If that doesn't work, try storing only the name of the script when you create the fake AVI instead of the full contents of it, or vice versa.
ImageImage
:pizza: :pizza: Image :pizza: :pizza:

Locked

Return to “AviSynth Help”