Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th September 2003, 02:48   #1  |  Link
aaar9800
Registered User
 
Join Date: Mar 2003
Location: Tucson, AZ
Posts: 62
transitioning between 2 diff. clips using a greyscale picture.

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...
aaar9800 is offline   Reply With Quote
Old 28th September 2003, 22:00   #2  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
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:
Code:
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:
Code:
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/

Last edited by stickboy; 7th July 2004 at 09:36.
stickboy is offline   Reply With Quote
Old 23rd January 2004, 14:52   #3  |  Link
Zap_Bee
Registered User
 
Join Date: Jun 2003
Location: Berlin, Germany
Posts: 26
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
Zap_Bee is offline   Reply With Quote
Old 23rd January 2004, 18:24   #4  |  Link
albertgasset
Registered User
 
albertgasset's Avatar
 
Join Date: Jan 2003
Location: Barcelona
Posts: 68
Re: transitioning between 2 diff. clips using a greyscale picture.

Quote:
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
albertgasset is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:42.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.