Log in

View Full Version : RFI: Rendering logo


Blankman
19th March 2003, 15:59
Looking for information on two topics on rendering logos.

Topic 1:
--------

Using the following "logo.avsi" definition in the AviSynth plugins folder:

global VD_plugins = "C:\Virtualdub\plugins"

function VD_Logo(clip clip, int "x", int "y",
\ int "alpha", bool "transparent",
\ int "xr", int "xg", int "xb",
\ int "tolerance", string "filename",
\ bool "animate", int "start", int "duration", int "loops",
\ int "fadeinlen", int "fadeoutend", int "fadeoutlen")
{
LoadVirtualdubPlugin(VD_plugins+"\logo.vdf", "_VD_Logo", 0)
return clip._VD_Logo(default(x,5), default(y,5),
\ default(alpha,128), default(transparent,true)?1:0,
\ default(xr,0), default(xg,0), default(xb,0),
\ default(tolerance,10),
\ default(filename,VD_plugins+"\logo.bmp"),
\ default(animate,false)?1:0,
\ default(start,0), default(duration,0), default(loops,0),
\ default(fadeinlen,20), default(fadeoutend,300),
\ default(fadeoutlen,20))
}

The simple way of using this in the AviSynth .AVS script would be to
add:

ConvertToYUY2(VD_logo(ConvertToRGB()))

to the end of the script. But wouldn't something like:

ConvertToYUY2(VD_logo(ConvertToRGB(TRIM(0,600)))) + TRIM(601,0)

be more efficient, since only the first 600 frames will be passed through the Virtualdub logo filter?

Also wouldn't converting (Maybe I'm volunteering, where's my copy of Visual C++?) the Virtualdub logo filter into an AviSynth filter improve performance because the colormap conversion may be avoided?


Topic 2:
--------

For a really simple logo, I have used:

Subtitle("Logo", 16, 8, 20, 320, "Embie", 24, $000000, $808080, 7)

Now if I can only figure how to use Animate() and/or Layer() to make the logo fade in and out without fading the rest of the clip.

Wilbert
19th March 2003, 16:09
be more efficient, since only the first 600 frames will be passed through the Virtualdub logo filter?
True.

Also wouldn't converting (Maybe I'm volunteering, where's my copy of Visual C++?) the Virtualdub logo filter into an AviSynth filter improve performance because the colormap conversion may be avoided?
Could be true, problem is that Mask doesn't work in YUY2/YV12.

Now if I can only figure how to use Animate() and/or Layer() to make the logo fade in and out without fading the rest of the clip.
Very brief sketch:

1) Use ImageSequence plugin for loading your bmp.
2) Use loop for making your logo into a clip of several frames.
3) Use Layer and Blankclip to add your logo onto a black background (no need for Mask here).
4) Use FadeIn/FadeOut for fading in/out of the resulted clip in (3).
5) Use Mask for creating a Mask of the clip in (4, converted to RGB) and add it with Layer to your movie.

Let us know if you have problems with step 5.

Blankman
20th March 2003, 05:39
1) Use ImageSequence plugin for loading your bmp.
2) Use loop for making your logo into a clip of several frames.
3) Use Layer and Blankclip to add your logo onto a black background (no need for Mask here).
4) Use FadeIn/FadeOut for fading in/out of the resulted clip in (3).
5) Use Mask for creating a Mask of the clip in (4, converted to RGB) and add it with Layer to your movie.
Bingo! Got step 5 (after exhausting all possible errors). Actual code is shorter that the quoted description.

Thanks.

Wilbert
20th March 2003, 10:05
Nice! I guess you meant that you didn't need step 3.

Blankman
20th March 2003, 21:51
Nice! I guess you meant that you didn't need step 3.

I did not need ImageSequence in step 1, nor Layer in step 3. The file I used with the Virtualdub logo plugin was a BMP rendering of a simple text logo. Although working, I'm not sure whether I'm using Mask correctly, or I just got lucky. The on-line documentation for Mask was terse. I am currently using:

function Logo(clip clip, string "text", string "font", int "size",
\ int "color", int "halo", int "spc",
\ int "x", int "y", int "align",
\ int "fade_in", int "fade_out", int "length")
{
# < default assignments go here >

ll = BlankClip(1).Subtitle(text, x, y, 0, 0,
\ font, size, color, halo, align, spc)

aa = (ll.Loop(fade_in).FadeIn(fade_in)
\ + ll.Loop(length - fade_in + fade_out)
\ + ll.Loop(fade_out).FadeOut(fade_out)).ConvertToRGB32()

return clip.Trim(0,length).ConvertToRGB32().Layer(aa.Mask(aa),
\ "add", 255).ConvertToYUY2() + clip.Trim(length + 1,0)
}

WarpEnterprises
21st March 2003, 14:18
to Mask:
it generates the alpha (transparency) layer of the clip by making black parts of the clip transparent and white parts opaque.
In your example using a font color not completely white (e.g. yellow) would make the font slightly TRANSPARENT.
If you do not want this use

... Layer(aa.Mask(aa.Levels(0,1,1,0,255)) ...

which will make all opaque except pure black.

Blankman
22nd March 2003, 00:49
it generates the alpha (transparency) layer of the clip by making black parts of the clip transparent and white parts opaque.
In your example using a font color not completely white (e.g. yellow) would make the font slightly TRANSPARENT.
If you do not want this use

... Layer(aa.Mask(aa.Levels(0,1,1,0,255)) ...

which will make all opaque except pure black.

And with that little example, a great big bright light turns on.

Now I know why Mask has two clip arguments, and why the following did not work

... Layer(aa.ColorKeyMask(m_rgb,m_tol) ...

What I really wanted was

... Layer(aa.Mask(aa.ColorKeyMask(m_rgb,m_tol)) ...

which accomplishes the same thing as Levels() and gives me control over the transparency color.