aaar9800
28th September 2003, 02:48
Is there a filter for avisynth that could blend two defined clips together in dissolve like pattern, but use a greyscale jpg, png or bmp picture that would tell the filter which parts of the 1st clip should become the 2nd clip faster.
so, for example the picture is 0 black on the right and 255 black on the left, in the middle there are gradual steps in blackness. that should result in a wipe-like transition, where black would convert to the new clip's frames before the white. but the point is not the wiping but using different black an white pictures that would make very nice transitions in the video.
This is one of the possibilities in pinnacle studio 8 called "alpha magic", that keeps me from a complete conversion to avs scripting...
stickboy
28th September 2003, 22:00
You can do it, but it's kind of ugly. AviSynth's masking tools currently are a bit limited. Here's a generalized version of Datacable's FuzzyWipe function (http://forum.doom9.org/showthread.php?s=&threadid=58690#post356299):
function MaskTransition(clip c1, clip c2, clip transitionMaskClip)
{
assert(c1.IsRGB32() && c2.IsRGB32() && transitionMaskClip.IsRGB32(),
\ "MaskTransition: clips must be RGB32")
assert( c1.FrameRate() == c2.FrameRate()
\ && c1.FrameRate() == transitionMaskClip.FrameRate(),
\ "MaskTransition: frame rates don't match")
assert( c1.Width() == c2.Width() && c1.Width() == transitionMaskClip.Width()
\ && c1.Height() == c2.Height() && c1.Height() == transitionMaskClip.Height(),
\ "MaskTransition: frame sizes don't match")
overlap = transitionMaskClip.FrameCount()
assert(c1.FrameCount() > overlap && c2.FrameCount() > overlap,
\ "MaskTransition: clips must be longer than the transition")
assert(overlap > 0, "MaskTransition: invalid transition length")
seg1 = c1.Trim(0, -(c1.FrameCount() - overlap))
seg2 = c2.Trim(overlap, 0)
trans1 = c1.Trim(c1.FrameCount() - overlap, 0)
trans2 = c2.Trim(0, -overlap).Mask(transitionMaskClip)
trans = Layer(trans1, trans2)
return AudioDub(seg1 + trans + seg2, Dissolve(c1, c2, overlap))
}(It's not clear what to do with the audio, so it just fades audio from the two clips together using Dissolve.)
Here's sample usage:clip1 = ColorBars(640, 480).AssumeFPS(29.97).Trim(0, -500).ShowFrameNumber()
clip2 = clip1.Levels(0, 1.0, 255, 255, 0) # invert
# D:\ramp.png is a 640x480 grayscale image that defines the mask
ramp = ImageReader("D:\ramp.png", 0, 0, 1, false).ConvertToRGB32()
ramp = ramp.AssumeFPS(clip1.FrameRate()).Loop(50)
# animate from black to white... this isn't very smooth and could be
# improved greatly
ramp = Animate(ramp, 0, 50, "Levels",
\ 235, 1.0, 255, 0, 255,
\ 0, 1.0, 20, 0, 255)
MaskTransition(clip1, clip2, ramp)
Edit:
Rewrote what I originally posted. I had forgotten that Datacable had done something similar (and better) than this post's old content. :)
Edit 2:
An updated version is available from:
http://www.avisynth.org/stickboy/
Zap_Bee
23rd January 2004, 14:52
by using this script along with a greyscale transition movie clip, e.g. a small black rectangle growing to a black screen, you can reproduce many of the oh-so-shiny studio 8 "alpha magic" effects.
using flash to create a greyscale transition movie and SWF2Video for AVI conversion, i created some most exciting effects.
only problem i have: both clips, hidden behind the other or not, are always fullsize, so i haven't found a way to grow the clip itself, actually just the visible area of the clip grows.
anybody got a good idea for that? this would make studio 8 obsolete.
Zap
albertgasset
23rd January 2004, 18:24
Originally posted by aaar9800
Is there a filter for avisynth that could blend two defined clips together in dissolve like pattern, but use a greyscale jpg, png or bmp picture that would tell the filter which parts of the 1st clip should become the 2nd clip faster.
I'm working on a filter that does exactly this, I've just post the last version (Transition 0.4) here:
http://forum.doom9.org/showthread.php?s=&threadid=69155
I'd appreciate any suggestions/comments.
Albert
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.