Log in

View Full Version : looping overlay


watermark1
20th September 2006, 19:59
Hi,

I'm new to AVS so this might be a newb question but is there a way to loop a watermark/overlay so it appears and disappears every 5 mins throughout the entire video? I'll pay $20-30 through paypal or epassporte for full working code example if interested msg me at adam@datexc.com

I've seen random variations of this on the post but nothing through the whole video it's either at the beginning or end of the clips, etc.

Guest
20th September 2006, 20:10
In VirtualDub, you can instantiate multiple copies of my Logo filter, each programmed to begin at 5-minute intervals. It's not automatic, but a typical movie would be just tolerable (about 20 instances).

Otherwise, for custom development, your offer would pay for about 10 minutes of my time. :)

stickboy
21st September 2006, 12:02
1. Start with my basic example (http://www.avisynth.org/stickboy/etc/logo-example.zip).

2. Modify it as follows:

# Calculate how much we need to pad the mask clip by to fill 5 minutes.
numMinutes = 5
numPadFrames = Round(logoMask.FrameRate() * 60 * numMinutes) - logoMask.FrameCount()

# Pad the mask clip.
logoMask = logoMask + logoMask.BlankClip(length=numPadFrames)

# Make it loop indefinitely (for all practical purposes).
logoMask = logoMask.Loop()

Overlay(c, logo, ..., mask=logoMask)

3. Donate $20-30 to charity.

actionman133
21st September 2006, 13:28
By the way, my nickname is charity...

:)

Stickboy's method would work if you the intervals are exactly the same. If it's a movie with commercials or something else where the '5 minutes' is only an approximation, you'd need something more precise...

watermark1
21st September 2006, 22:58
Thanks for the quick replies, but my graphic design skills REALLY suck and I'm not even sure how to make a mask or crop it, etc. I don't even use photoshop..I use psp

I've been using this filter/plugin that lets you work with transparent backgrounds and I made a logo in that and use this code:

LoadPlugin("c:\windows\system32\immaavs.dll")
clip1 = DirectShowSource("video.avi")
clip2 = immareadpic("logo.png")

overlay (clip1, clip2, mode="blend", mask=showalpha(clip2), x=0, y=0)

I'm trying the combine your code but I'm not sure how to substitue logomask or any of that..please advise.

stickboy
22nd September 2006, 12:18
If you're starting with a transparent PNG, it's easy to make a mask clip. You're already doing it: ShowAlpha(clip2).

In other words, simply do:
logoMask = ShowAlpha(clip2)
Then do what I described before, and update the "mask" argument to Overlay to use "logoMask" instead.