View Single Post
Old 26th November 2018, 12:18   #14  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Something to play with, choose your own values for Thr and ThrC

Code:
LSmashVideoSource("Y:\test.MOV") # clip is assigned to special variable Last

####### Config ########
THR      = 1.2   # Default 1.2 (pick your own after check)
THRC     = 1.2   # Default 1.2
DOSUB    = True  # True, put subtitles, else not
ORIGSIZE = True  # Reduce stacked size to same as input source
#######

Result = GradFun3(Thr=THR , ThrC=THRC)  # Calling GradFun3 with Special Last clip and assign result to Result
#Return Result                          # return Result clip if uncommented

d1 = ClipDelta(Result,Last,Amp=False)   # Subtract Last clip from Result
d2 = ClipDelta(Result,Last,Amp=True)    # Subtract Last clip from Result, and amplify

Last   = (DOSUB) ? TSub(Last   ,"Source"  ,True,$0000AA) : Last   # If DOSUB then Last is subtitled with FrameNumber on blueish bar, else no change
Result = (DOSUB) ? TSub(Result ,"Result")                : Result # If DOSUB then Result is subtitled else no change
d1     = (DOSUB) ? TSub(d1     ,"Difference")            : d1     # If DOSUB then d1 is subtitled else no change
d2     = (DOSUB) ? TSub(d2     ,"Diff, AMP'ed")          : d2     # If DOSUB then d2 is subtitled else no change

Lft = Stackvertical(Last,Result)  # Source Stacked above Result
Rgt = Stackvertical(d1,d2)        # d1 Stacked above d2
StackHorizontal(Lft,Rgt)          # Stacked x 4, is assigned to Last clip

W = Width                         # Width of Last clip (same as W=Last.Width)
H = Height
W = W / 2                         # As for original source width
H = H / 2

Last = (ORIGSIZE) ? Spline36Resize(W,H) : Last   # If ORIGSIZE then downsize, else no change

Return Last # End Of Script, returning Last clip

########################

# Return Clip Difference of input clips (amp==true = Amplified, show==true = show background)
Function ClipDelta(clip clip1,clip clip2,bool "amp",bool "show") {
    amp=Default(amp,false)
    show=Default(show,false)
    c2=clip1.levels(128-32,1.0,128+32,128-32,128+32).greyscale()
    c1=clip1.subtract(clip2)
    c1=(amp)?c1.levels(127,1.0,129,0,255):c1
    return (show)?c1.Merge(c2):c1
}

# Stack Overhead Subtitle Text, with optional FrameNumber shown.
Function TSub(clip c,string Tit,Bool "ShowFrameNo",Int "Col"){
    c.BlankClip(height=20,Color=Default(Col,0))
    (Default(ShowFrameNo,False))?ScriptClip("""Subtitle(String(current_frame,"%.f] """+Tit+""""))"""):Subtitle(Tit)
    Return StackVertical(c).AudioDubEx(c)
}
__________________
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 ???
StainlessS is offline   Reply With Quote