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 1st August 2003, 16:18   #1  |  Link
bigplac
Registered User
 
Join Date: Jul 2003
Posts: 2
Transition effect filter

Hello. How can i conbine clips with overlap and some nice transition effects like dissolve does but with blind,checkerboard,diagonal, gradient, stretch, ...?

Thanks.
bigplac is offline   Reply With Quote
Old 1st August 2003, 17:41   #2  |  Link
E-Male
mad computer-scientist
 
Join Date: Mar 2002
Posts: 1,375
i thought about trying to do some of these, but atm i donīt have the time, sorry
E-Male is offline   Reply With Quote
Old 1st August 2003, 22:00   #3  |  Link
DaveQB
Theora and Mkv fan! :)
 
DaveQB's Avatar
 
Join Date: Jun 2002
Location: Sydney
Posts: 347
yes i would be interested to see flters like these.

not demanding anything though; we are busy ppl.
__________________
Can't we all just get along?

Opty 146 @ 2.5Ghz || nForce3 ||1x330 + 3x120gig || CX23881 Capture Card
OCAU || My blog

Proud to be an Aussie!
DaveQB is offline   Reply With Quote
Old 2nd August 2003, 04:39   #4  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
Last month, just for kicks, I wrote a user-defined function to perform wipes.

I haven't actually used it in practice, though, so I'm not sure how well it works.

Code:
# Wipe
#
#   Combines two clips using a wipe transition.  The audio tracks will be
#   blended during the transition.
#
# PARAMETERS:
#   c1        - the first clip
#   c2        - the second clip
#   overlap   - the desired number of transitional frames
#   direction - the wipe direction;
#               { "right", "left", "up", "down" }
#               (default: "right")
#
function Wipe(clip c1, clip c2, int overlap, string "direction")
{
    assert(   c1.Width() == c2.Width()
    \      && c1.Height() == c2.Height()
    \      && c1.Framerate() == c2.Framerate(),
    \      "Wipe: clips must have identical attributes ")
    assert(c1.FrameCount() > overlap && c2.FrameCount() > overlap,
    \      "Wipe: each clip must have at least <overlap> frames")

    direction = default(direction, "right")

    directionIndex = (direction == "right")
    \                ? 0
    \                : ((direction == "left")
    \                   ? 1
    \                   : ((direction == "down")
    \                      ? 2
    \                      : ((direction == "up")
    \                         ? 3
    \                         : -1)))
    assert(directionIndex >= 0 && directionIndex < 4,
    \      "Wipe: invalid direction")

    seg1 = c1.Trim3(0, length=(c1.FrameCount() - overlap))
    seg2 = c2.Trim3(overlap)

    trans1 = c1.Trim3(c1.FrameCount() - overlap)
    trans2 = c2.Trim3(0, length=overlap)
    trans = Select(directionIndex,
    \              Animate(0, overlap, "SpliceHorizontal", trans1, trans2, 0,
    \                                                      trans1, trans2, c1.Width()),
    \              Animate(0, overlap, "SpliceHorizontal", trans2, trans1, c1.Width(),
    \                                                      trans2, trans1, 0),
    \              Animate(0, overlap, "SpliceVertical", trans1, trans2, 0,
    \                                                    trans1, trans2, c1.Height()),
    \              Animate(0, overlap, "SpliceVertical", trans2, trans1, c1.Height(),
    \                                                    trans2, trans1, 0))

    AudioDub(seg1 + trans + seg2, Dissolve(c1, c2, overlap))
}

function SpliceHorizontal(clip c1, clip c2, int x)
{
    # in case we're dealing with YUY2 or YV12 video, crop only on even
    # boundaries
    x = (x % 2 == 0) ? x : (x - 1)
    return (x == 0)
    \      ? c1
    \      : ((x == c1.Width())
    \         ? c2
    \         : StackHorizontal(c2.Crop(0, 0, x, 0),
    \                           c1.Crop(x, 0, c1.Width() - x, 0)))
}

function SpliceVertical(clip c1, clip c2, int y)
{
    # in case we're dealing with YUY2 or YV12 video, crop only on even
    # boundaries
    y = (y % 2 == 0) ? y : (y - 1)
    return (y == 0)
    \      ? c1
    \      : ((y == c1.Height())
    \         ? c2
    \         : StackVertical(c2.Crop(0, 0, 0, y),
    \                         c1.Crop(0, y, 0, c1.Height() - y)))
}
(see my thread about Trim for my Trim3 function)

Last edited by stickboy; 2nd August 2003 at 04:42.
stickboy is offline   Reply With Quote
Old 3rd August 2003, 07:52   #5  |  Link
Richard Berg
developer wannabe
 
Richard Berg's Avatar
 
Join Date: Nov 2001
Location: Brooklyn, NY
Posts: 1,211
Stickboy, would you mind adding your functions to the Wiki? http://www.avisynth.org/index.php?page=ShareFunctions
Richard Berg is offline   Reply With Quote
Old 3rd August 2003, 10:33   #6  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
I'm planning to do it; I just haven't gotten around to figuring out the Wiki system just yet.

Last edited by stickboy; 3rd August 2003 at 10:41.
stickboy is offline   Reply With Quote
Old 10th August 2003, 04:30   #7  |  Link
DataCable
Registered User
 
DataCable's Avatar
 
Join Date: Aug 2003
Posts: 6
You can also make more complex transitions using the Layer filter, with an appropriate transparency mask. i.e., To do a wipe, you'd need a simple B/W animation of a white frame wiping across a black frame. You could even generate a mask using stickboy's functions on all-black and all-white frames, then run a Blur on the mask to create a slight fuzzy edge on the transition (ala the numerous "Star Wars" wipes) rather than a hard-cropped edge.

I've toyed with these ideas in my head since discovering AviSynth last week, but haven't actually applied them, so I haven't written any code for them yet.
__________________
DataCable^2003 A+
DataCable is offline   Reply With Quote
Old 10th August 2003, 07:59   #8  |  Link
DataCable
Registered User
 
DataCable's Avatar
 
Join Date: Aug 2003
Posts: 6
Ok, that got my thought process cranking, so I just threw this together. Instead of Blurring the generated mask, I decided to Resize it down, then Resize it back up to original input clip size, which performs the blur. I found Blur didn't have nearly as much effect as I wanted on a single pass, and left a fuzzy light stripe on the right edge of the mask, which I found distracting. (I borrowed a few lines of code from Wipe, I hope you don't mind, stickboy )

Code:
#FuzzyWipe
#
#Perform a "fuzzy" wipe from one clip to another.  Uses stickboy's "wipe" function to generate the mask.
#
#Parameters:
#	C1        - First clip
#	C2        - Second clip
#	Overlap   - Number of transitional frames
#	FuzzWidth - Width (in pixels, approximate) of the blended boundary.  0 = sharp boundary
#	Direction - Diretion of wipe

function FuzzyWipe( clip C1, clip C2, int overlap, int Fuzzwidth, string "Direction")
{
	# Generate the Black and White clips used to create the Wipe Mask
	BlackFrame = BlankClip( overlap+1, C1.Width, C1.Height, fps=C1.framerate, Color=$000000 )
	WhiteFrame = BlankClip( overlap+1, C1.Width, C1.Height, fps=C1.framerate, Color=$FFFFFF )

	# Define how small to rezise the mask
	WipeWidth = C1.Width / ( Fuzzwidth + 1 )
	WipeHeight = C1.Height / ( Fuzzwidth + 1 )

	# Generate the Wipe Mask
	WipeMask = Wipe( BlackFrame, WhiteFrame, overlap, Direction )
	WipeMask = Trim3( WipeMask, 1 ).BilinearResize( WipeWidth, WipeHeight ).Bicubicresize( C1.Width, C1.Height )

	seg1 = c1.Trim3( 0, length=( c1.FrameCount() - overlap ) )
        seg2 = c2.Trim3( overlap )

	trans1 = c1.Trim3( c1.FrameCount() - overlap ) 
	trans2 = c2.Trim3( 0, length=overlap ).Mask( WipeMask )

	# Overlap the layers
	trans = Layer( trans1, trans2 )

	# Stitch it all together
	AudioDub(seg1 + trans + seg2, Dissolve(c1, c2, overlap ))
}
__________________
DataCable^2003 A+
DataCable is offline   Reply With Quote
Old 10th August 2003, 08:08   #9  |  Link
DaveQB
Theora and Mkv fan! :)
 
DaveQB's Avatar
 
Join Date: Jun 2002
Location: Sydney
Posts: 347
definately share your ideas when you finalise them.

Sounds like it has loads of potential.

__________________
Can't we all just get along?

Opty 146 @ 2.5Ghz || nForce3 ||1x330 + 3x120gig || CX23881 Capture Card
OCAU || My blog

Proud to be an Aussie!
DaveQB is offline   Reply With Quote
Old 10th August 2003, 22:23   #10  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
Join Date: Apr 2002
Location: Austria
Posts: 830
(without wanting to make too much promotion)

you can try Zoom(), it really works good for problems as discussed above (using the pan and rotate functionality)
WarpEnterprises is offline   Reply With Quote
Old 10th August 2003, 23:46   #11  |  Link
DataCable
Registered User
 
DataCable's Avatar
 
Join Date: Aug 2003
Posts: 6
Funny you should mention that, WE, as the first script function I wrote was PanZoom (didn't know there was already a plugin to do this):
Code:
# PanZoom - Pan, Tilt and Zoom a small frame across a clip, with edge detection

# Parameters:
#	Output_W, Output_H		Output frame width/height
#	Start_Frame, End_Frame		Frame numbers to start/end the operation
#	Start_Focus_X, Start_Focus_Y	Starting center coordinates
#	End_Focus_X, int End_Focus_Y	Ending center coordinates
#	Start_Zoom, End_Zoom 		Start/End zoom levels, 1 = Original size, 2 = 2x zoom, etc.

function PanZoom( clip Input, int Output_W, int Output_H,\
		  int Start_Frame, int End_Frame,\
		  int Start_Focus_X, int Start_Focus_Y,\
		  int End_Focus_X, int End_Focus_Y,\
		  float Start_Zoom, float End_Zoom )
{
	Start_W = Output_W / Start_Zoom
	Start_H = Output_H / Start_Zoom

	Assert( Start_W <= Input.Width,\
	"Start frame Width exceeds input clip dimensions. Reduce output frame size or increase Start_Zoom" )

	Assert( Start_H <= Input.Height,\
	"Start frame height exceeds input clip dimensions. Reduce output frame size or increase Start_Zoom" )

	Start_HW = Start_W / 2
	Start_HH = Start_H / 2

	Start_Origin_X = Start_Focus_X - Start_HW
	Start_Origin_X = Start_Origin_X < 0 ? 0 : Start_Origin_X
	Start_Origin_X = Start_Origin_X + Start_W > Input.Width ? Input.Width - Start_W : Start_Origin_X

	Start_Origin_Y = Start_Focus_Y - Start_HH
	Start_Origin_Y = Start_Origin_Y < 0 ? 0 : Start_Origin_Y
	Start_Origin_Y = Start_Origin_Y + Start_H > Input.Height ? Input.Height - Start_H : Start_Origin_Y

	End_W = Output_W / End_Zoom
	End_H = Output_H / End_Zoom

	Assert( End_W <= Input.Width,\
	"End frame Width exceeds input clip dimensions. Reduce output frame size or increase End_Zoom" )

	Assert( End_H <= Input.Height,\
	"End frame height exceeds input clip dimensions. Reduce output frame size or increase End_Zoom" )

	End_HW = End_W / 2
	End_HH = End_H / 2

	End_Origin_X = End_Focus_X - End_HW
	End_Origin_X = End_Origin_X < 0 ? 0 : End_Origin_X
	End_Origin_X = End_Origin_X + End_W > Input.Width ? Input.Width - End_W : End_Origin_X

	End_Origin_Y = End_Focus_Y - End_HH
	End_Origin_Y = End_Origin_Y < 0 ? 0 : End_Origin_Y
	End_Origin_Y = End_Origin_Y + End_H > Input.Height ? Input.Height - End_H : End_Origin_Y
	
	Animate( Input, Start_Frame, End_Frame, "BicubicResize",\
		 Output_W, Output_H, 0, 0.5, Start_Origin_X, Start_Origin_Y, Start_W, Start_H,\
		 Output_W, Output_H, 0, 0.5, End_Origin_X,   End_Origin_Y,   End_W,   End_H )
}
Pretty crude code, doesn't have as many features as yours, but for what it is, it works.
__________________
DataCable^2003 A+
DataCable 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 00:25.


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