Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ffmpegsource2("C:\Users\Seedmanc\Desktop\[765subs] Ganaha Hibiki - Episode 10.mp4")
- converttoyv12
- # boxes sizes
- w=round(312*width/(1280*2)) *2 # this way we get independent from source resolution
- h=round(120*height/(720*2)) *2 # having boxes' coordinates relative instead of absolute
- # coordinates of left box
- xb=round(196*width/(1280*2)) *2 # also this ensures mod2 rule, since video in YV12 format
- yb=round(322*height/(720*2)) *2 # must have even dimensions
- # coordinates of right box
- xr=round(770*width/(1280*2)) *2
- yr=round(322*height/(720*2)) *2
- # we don't need third box, as it is not always present
- src1= crop(xb,yb,w,h).blur(1.58) # source video area of left box
- bluemask=src1.maskhs(starthue=360-45,endhue=360-7,maxsat=70,minsat=5).converttoyv12.mt_inflate.mt_expand
- # ^ selection by color blue
- src2= crop(xr,yr,w,h).blur(1.58) # source video area of right box
- redmask = src2. maskhs(starthue=60, endhue=120, maxsat=75, minsat=10 ) .converttoyv12. mt_inflate. mt_expand
- # ^ selection by color red
- comb=mt_logic(bluemask, redmask, mode="min")
- # ^ combining masks by AND operator - so that detection happens only when both boxes are found
- xt=round(612*width/(1280*2)) *2
- yt=round(324*height/(720*2)) *2
- # ^ coordinates of timer
- wt=round(44*width/(1280*2)) *2
- ht=round(64*height/(720*2)) *2
- st=round(72*height/(720))
- # ^ sizes of timer, change 72 in st for font size
- frame=0
- detected=false
- temp="frame=current_frame detected=true"
- scriptclip("""(AverageLuma(comb)>245) ? \
- eval("(detected==false)?eval(temp):nop \
- freezeframe(0,framecount-1,frame) \
- overlay(crop(xt,yt,wt,ht).subtitle(string(round(6-(current_frame-frame)/framerate)),size=st,text_color=$00FFFFFF,halo_color=$00FF0088),x=xt,y=yt)") : \
- eval( "detected=false last")
- """)
- __END__
- Now it pauses until question boxes disappear, while showing it's own timer in place of one in the source video.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement