PDA

View Full Version : ConvertToRGB - Invalid Argument


Bucky Wheat
26th August 2003, 03:03
I am a little lost. I am trying to forego any VirtualDub functions to be able to use Fast Recompress.
The function I would like to use from VDub is Logo.

I made a script like this:

LoadPlugin("d:\filter\MPEG2Dec3.dll")
LoadPlugin("d:\filter\Decomb.dll")
LoadPlugin("d:\filter\mpasource.dll")

Import("d:\filter\vdub_filters.avs")

v=mpeg2source("F:\test.d2v").telecide(guide=1).decimate(cycle=5).LanczosResize(352,240,6,2,530,476)

ConvertToRGB()
VD_logo(0, 0, 128, true, 123, 123, 123, 0, "f:\images\greek.bmp", false, 10, 200, 50, 10, 180, 10)
ConvertToYUY2()

a=MPASource("F:\test.mp2", normalize = false)
return AudioDub(V,A)

Well, it doesn't work. I get the error message:
Avisynth Open Failure:
Script Error: Invalid arguments to function "ConvertToRGB"

This is the first time I am using ConvertToRGB. I don't know what I am doing wrong, does anyone have any pointers for me?

Thanks
Bucky

stickboy
26th August 2003, 03:29
You didn't supply an input clip to ConvertToRGB.

ConvertToRGB() is shorthand for last.ConvertToRGB() (or alternatively ConvertToRGB(last)). In your case, however, no clip is assigned to last, so ConvertToRGB has no clip to operate on.

What you mean to use is:

v = v.ConvertToRGB()
v = v.VD_logo(0, 0, 128, true, 123, 123, 123, 0,
\ "f:\images\greek.bmp", false,
\ 10, 200, 50, 10, 180, 10)
v = v.ConvertToYUY2()

Bucky Wheat
26th August 2003, 03:45
Hmmm, you mean like this?

LoadPlugin("d:\filter\MPEG2Dec3.dll")
LoadPlugin("d:\filter\Decomb.dll")
LoadPlugin("d:\filter\mpasource.dll")

Import("d:\filter\vdub_filters.avs")

v=mpeg2source("F:\test.d2v").telecide(guide=1).decimate(cycle=5).LanczosResize(352,240,6,2,530,476)

v=v.ConvertToRGB()
v=v.VD_logo(0, 0, 128, true, 123, 123, 123, 0, "f:\images\greek.bmp", false, 10, 200, 50, 10, 180, 10)
v=v.ConvertToYUY2()

a=MPASource("F:\test.mp2", normalize = false)

return AudioDub(V,A)

The problem is, then it doesn't show my logo.

Bucky Wheat
26th August 2003, 04:01
Hmpf, I am a liar. It does show my logo. The problem is, that I am cutting parts from the front and the logo does not "move" like the VDub logo plugin did. With the VDub Logo plugin, the logo appeared to whatever were the first frames in the output file.

Now I only have to figure out where to add my values.
Say, I have to cut the front part up to frame 6838, I assume I would have to define this frame somewhere as my start frame. I just don't know where the value goes, I am a little lost with all the variables I guess :-(

Theoretically, this should explain it:
LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\logo.vdf", "_VD_Logo", 1)
return clip._VD_Logo(default(x,0), default(y,0), default(alpha,128),
\ default(transparent,true)?1:0, default(xr,0), default(xg,0), default(xb,255),
\ default(tolerance,0), default(filename,"d:\virtual dub\plugins\logo.bmp"),
\ default(animate,false)?1:0, default(start,0), default(duration,0), default(loops,0),
\ default(fadein,0), default(fadeoutend,0), default(fadeoutlen,0))
But I still am not sure...

Can you show me?

Thanks for your help
Bucky

Bucky Wheat
26th August 2003, 04:07
Ha! Sorry for the spam here, but I think I figured it out! This is my script now, I had it all wrong :scared:

LoadPlugin("d:\filter\MPEG2Dec3.dll")
LoadPlugin("d:\filter\Decomb.dll")
LoadPlugin("d:\filter\mpasource.dll")

Import("d:\filter\vdub_filters.avs")

v=mpeg2source("F:\test.d2v").telecide(guide=1).decimate(cycle=5).LanczosResize(352,240,6,2,530,476)

v=v.ConvertToRGB(last)
v=v.VD_logo(0, 0, 128, true, 123, 123, 123, 0, "f:\images\greek.bmp", false, 6848, 200, 0, 10, 7038, 10)
v=v.ConvertToYUY2(last)

a=MPASource("F:\test.mp2", normalize = false)

return AudioDub(V,A)

AWESOME! Thank you so much. Sometimes you just need someone to push you off to the right direction :-)

Have a good one
Bucky

KpeX
26th August 2003, 04:09
I am trying to forego any VirtualDub functions to be able to use Fast Recompress.
I'd recommend just using Vdub anyways. When you load the plugin in AviSynth like that with converttoRGB and a ConverttoYUY2 after the function, you're doing the exact same thing as VD does in full processing mode. You won't gain anything by running this clip through fast recompress, colorspace conversions are still occuring, no getting around it if a plugin requires RGB.

cheap-red-wine
26th August 2003, 04:09
You have only to think of the clip as the Logo filter sees it. If you cut away some frames before Logo, then the first frame Logo sees is referred to by Logo as frame 0.

Bucky Wheat
26th August 2003, 12:49
@Kpex: That is strange, because not only is it still faster, but it also does not have the dreaded yellow line on the left that I usually have when doing RGB. Could it be that only the range of the logo is in RGB? I don't really know what is going on...

@Cheap: If I understand you right, what you describe is the way VDub handles Logo. With Avisynth, if the logo is defined to start at frame 10, and I cut the first chunk off, the logo is gone. But I have solved that now, I just have to determine at what frame my encoding starts.

Gruss
Bucky

cheap-red-wine
26th August 2003, 22:19
It depends on whether you do your trim before or after invocation of Logo. I am assuming before.

Bucky Wheat
26th August 2003, 23:36
Originally posted by cheap-red-wine
It depends on whether you do your trim before or after invocation of Logo. I am assuming before.

Well, my script did show what I did, right? I just thought it may handle it like the filter in VDub, but it didn't. For VDub, whatever was the first encoded frame, it counted as 1. When using the Logo in avisynth, it will always assume the first frame in the stream is frame one, no matter if it has been cut or not.


Well, I solved it, so don't worry.
Gruss
Bucky

cheap-red-wine
27th August 2003, 12:30
Originally posted by Bucky Wheat
Well, my script did show what I did, right?No, I don't see any cutting in your posted scripts.

Well, I solved it, so don't worry.I'm not worried.

Bucky Wheat
27th August 2003, 12:53
Originally posted by cheap-red-wine
No, I don't see any cutting in your posted scripts.
Well, I thought that was the hint :-)
I am cutting in VDub, not in the script, ergo afterwards...