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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 13th July 2013, 16:52   #1  |  Link
djcj
Registered User
 
Join Date: Jun 2013
Location: Germany
Posts: 44
SimpleTransition

Usage: simpletransition(clip clip1, clip clip2, int overlap, int "mode", string "direction")

Requires shubin's transition filter: http://avisynth.org/warpenterprises/...5_20040130.zip

Example:
Code:
loadplugin("transition.dll")
import("simpletransition.avs")
clip1 = colorbars().trim(0,99)
clip2 = clip1.greyscale().normalize(0.0)
simpletransition(clip1,clip2,50)
#simpletransition(clip1,clip2,50,2,"br2tl")
#simpletransition(clip1,clip2,25,mode=4,direction="1")
overlap:
Amount of the last frames of clip1 and the first frames of clip2 overlapping.
Just like dissolve() the final clip will be shorter than clip1+clip2.

mode:
0 - Clip2 pushes Clip1 away
1 - Clip2 overlaps Clip1
2 - Clip1 will be "erased" and clip2 remains
3 - cirlce transition effect
4 - zoom transition effect

direction:
mode=0: "l2r", "r2l", "t2b" & "b2t".
mode=1 and mode=2: "l2r", "r2l", "t2b", "b2t", "tl2br", "br2tl", "tr2bl" & "bl2tr".
Explanation: "l2r" - left to right, "b2t" - bottom to top, "tr2bl" - top right to bottom left, etc.
mode=3 and mode=4: "0" - inside out, "1" - outside in

I hope you understand my explanations.


PHP Code:
# Written by djcj
# Last modified: June 25th 2013
#
# Requires: Transition filter for Avisynth 2.5 - beta - by Shubin
#

function res(clip clpclip rclpint widthint height)
{
rclp bilinearresize(rclpwidthheight)
overlay(clprclpclp.width/2-rclp.width/2clp.height/2-rclp.height/2)
}

function 
simpletransition(clip clip1clip clip2int overlapint "mode"string "direction")
{
mode      = default(mode0)
direction = default(direction"l2r")

dis   dissolve(clip1,clip2,overlap).trim(clip1.framecount-overlapclip1.framecount)
clp1  clip1.trim(0clip1.framecount-overlap-1)
clp2  clip2.trim(overlap0)
clip1 clip1.trim(clip1.framecount-overlap0)
clip2 clip2.trim(0overlap-1)

overlayclip direction=="l2r"   stackhorizontal(clip2,clip1) :
\             
direction=="r2l"   stackhorizontal(clip1,clip2) :
\             
direction=="t2b"   ?   stackvertical(clip2,clip1) :
\             
direction=="b2t"   ?   stackvertical(clip1,clip2) : nop()

transition0 direction=="l2r"   animate(0,overlap-1"overlay"clip1,overlayclip, -clip1.width,0clip1,overlayclip,0,0) :
\             
direction=="r2l"   animate(0,overlap-1"overlay"clip1,overlayclip,            0,0clip1,overlayclip,-clip1.width,0) :
\             
direction=="t2b"   animate(0,overlap-1"overlay"clip1,overlayclip,0,-clip1.heightclip1,overlayclip,0,0) :
\             
direction=="b2t"   animate(0,overlap-1"overlay"clip1,overlayclip,            0,0clip1,overlayclip,0,-clip1.height) : nop()

transition1 direction=="l2r"   animate(clip2,0,overlap-1"transition"clip1,"l",64,             0,            clip1,"l",64,clip1.width) :
\             
direction=="r2l"   animate(clip1,0,overlap-1"transition"clip2,"l",64,   clip1.width,            clip2,"l",64,0) :
\             
direction=="t2b"   animate(clip2,0,overlap-1"transition"clip1,"l"0,0,clip1.height,            clip1,"l"0,0,0) :
\             
direction=="b2t"   animate(clip1,0,overlap-1"transition"clip2,"l"0,0,           0,            clip2,"l"0,0,clip1.height) :
\             
direction=="tl2br" animate(clip2,0,overlap-1"transition"clip1,"l",32,0,clip1.height,            clip1,"l",32,clip1.width,0) :
\             
direction=="br2tl" animate(clip1,0,overlap-1"transition"clip2,"l",32clip2.width,0,            clip2,"l",32,0,clip2.height) :
\             
direction=="tr2bl" animate(clip1,0,overlap-1"transition"clip2,"l",96clip2.width,clip2.heightclip2,"l",96,0,0) :
\             
direction=="bl2tr" animate(clip2,0,overlap-1"transition"clip1,"l",96,0,           0,            clip1,"l",96,clip1.width,clip1.height) : nop()

transition2 direction=="l2r"   animate(0,overlap-1"overlay"clip1,clip2,-clip1.width,            0clip1,clip2,0,0) :
\             
direction=="r2l"   animate(0,overlap-1"overlay"clip1,clip2clip1.width,            0clip1,clip2,0,0) :
\             
direction=="t2b"   animate(0,overlap-1"overlay"clip1,clip2,           0,-clip1.heightclip1,clip2,0,0) :
\             
direction=="b2t"   animate(0,overlap-1"overlay"clip1,clip2,           0clip1.heightclip1,clip2,0,0) :
\             
direction=="tl2br" animate(0,overlap-1"overlay"clip1,clip2,-clip1.width,-clip1.heightclip1,clip2,0,0) :
\             
direction=="br2tl" animate(0,overlap-1"overlay"clip1,clip2clip1.widthclip1.heightclip1,clip2,0,0) :
\             
direction=="tr2bl" animate(0,overlap-1"overlay"clip1,clip2clip1.width,-clip1.heightclip1,clip2,0,0) :
\             
direction=="bl2tr" animate(0,overlap-1"overlay"clip1,clip2,-clip1.widthclip1.heightclip1,clip2,0,0) : nop()

radius      int(sqrtpow(clip1.width/2,2) + pow(clip1.height/2,2) ))
transition3 direction=="0" animate(clip1,0,overlap-1"transition"clip2,"c",0clip2,"c",radius) :
\             
direction=="1" animate(reverse(clip2),0,overlap-1"transition"reverse(clip1),"c",0reverse(clip1),"c",radius).reverse() :
\             
animate(clip1,0,overlap-1"transition"clip2,"c",0clip2,"c",radius)

transition4 direction=="0" animate(0,overlap-1"res"clip1,clip2,4,4clip1,clip2,clip2.width,clip2.height) :
\             
direction=="1" animate(0,overlap-1"res"clip2,clip1,clip1.width,clip1.heightclip2,clip1,4,4) :
\             
animate(0,overlap-1"res"clip1,clip2,4,4clip1,clip2,clip2.width,clip2.height)

return 
clp1++audiodubex(select(mode,transition0,transition1,transition2,transition3,transition4),dis)++clp2

djcj is offline   Reply With Quote
 

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 17:30.


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