View Single Post
Old 18th September 2015, 07:28   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Since adding InsertSign() edit to my previous post, I've had a little play and made a mod to do similar but a little extended.
Below is probably not of much use to you but I thought that you or others might some day find a use for it.

Requires mask tools, but only to add the artificial Elliptical Disk mask in script function client.
Code:
Function OverlayClip(clip c,clip c2,Int "S", Int "E", Int "X", Int "Y",Float "Opacity",String "Mode") {
/*
    Requires RGB32 clips c and c2, c2 with Alpha mask.
    Overlay clip c with clip c2 using c2's RGB32 Alpha channel mask, frames S to E, @ clip c overlay coords X and Y.
    Start and End Args S & E, are similar but not exactly like trim.

    OverlayClip(c,c2, 0,0)     # Entire clip
    OverlayClip(c,c2, 100,0)   # Frame 100 to End of Clip
    OverlayClip(c,c2, 0,-1)    # Frame 0 Only
    OverlayClip(c,c2, 1,1)     # Frame 1 Only
    OverlayClip(c,c2, 1,-1)    # Frame 1 Only
    OverlayClip(c,c2, 1)       # Frame 1 Only [Not same as Trim()], E defaults to -1 ie single frame.
    OverlayClip(c,c2, 1,-3)    # Frames 1 to 3 (ie 3 frames)
    OverlayClip(c,c2, 100,200) # Frames 100 to 200    
    OverlayClip(c,c2, 100,-50) # Frames 100 to 149 ie 50 frames
    
    X and Y are OverLay x & y offsets, and can be -ve where is relative to c.Width & c.Height, use eg x = -(c2.Width+16)
    If c2.Framecount is shorter than S,E specified range, then final c2 frame will be used for remainder of overlay range,
    so if c2 clip is single frame, then that frame will be used for entire overlay range.
    Opacity=Overlay::Opacity and Mode=Overlay::Mode. 
*/
    FMX=c.FrameCount-1
    S = Min(Max(Default(S,0),0),FMX)            E = Default(E,-1)
    X=Default(X,0)                              Y=Default(Y,0)
    Opacity=Float(Default(Opacity,1.0))         Mode=Default(Mode,"Blend")
    X = (X<0) ? c.Width  + X : X  
    Y = (Y<0) ? c.Height + Y : Y
    E = (E==0) ? FMX : E
    E = Min(((E < 0) ? S-E-1 : E),FMX)                                      # S <= E <= FMX : E is +ve END Frame number (may be 0)
    Empty = c.BlankClip(Length=0)        
    CS = (S==0) ? Empty : c.Trim(0,-S) 
    CM = c.Trim(S,E==0?FMX:E).Overlay(c2, mask=c2.showalpha(),x=X,y=Y,opacity=Opacity,mode=Mode)
    CE = (E==FMX) ? Empty : c.Trim(E+1,0)
    CS ++ CM ++ CE 
}

Avisource("E:\V\StarWars.avi").ConvertToRGB32()                     # Source
Sym=Avisource("E:\V\XMen2.avi").Trim(5000,0)                        # Overlay clip (YV12, we will convert to RGB and add Alpha Channel)

W=(Width/16)  * 4
H=(Height/16) * 4
Sym=Sym.BilinearResize(W,H)

#S="(((x-.5)^2 +(y-.5)^2) < .25 ? 255 : 0"                                                       # Elliptical Disk (Hard Edge)
S="((x-.5)^2+(y-.5)^2)>.25?0:(((x-.5)^2+(y-.5)^2)<.2?255:(.25-((x-.5)^2+(y-.5)^2))*5100)"      # Elliptical Disk (Soft Edge)
# Create Elliptical Disk 
ElipDisk = Sym.trim(0,-1).mt_lutspa(mode = "relative", expr = Mt_Polish(S), chroma = "-128" ).ConvertToRGB32.Loop(Sym.framecount,0,0)
# Add Elliptical Disk mask to Alpha Channel
Sym=Sym.ConvertToRGB32.Mask(ElipDisk)
# Start @ frame 100, End at end of Sym Clip, Rel Bottom RHS with 16 pixels GAP  
Return OverlayClip(Last,Sym,S=100,E= -Sym.FrameCount,x= -(Sym.Width+16),y= -(Sym.Height+16))
EDITED:
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 18th April 2019 at 20:19.
StainlessS is offline   Reply With Quote