From here:-
https://forum.doom9.org/showthread.p...42#post1786042
Demo to show scene changes [could hack to use in any script, uses MvTools]
Code:
FN=".\LowBitrateAnime.avi"
Avisource(FN)
Function EndOfSceneClip(clip c,Int "thSCD1",Int "thSCD2") { # All Luma Samples set 255 at EOS
thSCD1=Default(thSCD1,400) thSCD2=Default(thSCD2,130)
sup=c.MSuper(pel=1,sharp=0,rfilter=2,hpad=16, vpad=16)
bv=sup.MAnalyse(isb=true, delta=1,blksize=16,overlap=8)
Return c.MSCDetection(bv,thSCD1=thSCD1,thSCD2=thSCD2)
}
Function StartOfSceneClip(clip c,Int "thSCD1",Int "thSCD2") { # All Luma Samples set 255 at SOS
thSCD1=Default(thSCD1,400) thSCD2=Default(thSCD2,130)
sup=c.MSuper(pel=1,sharp=0,rfilter=2,hpad=16, vpad=16)
fv=sup.MAnalyse(isb=false,delta=1,blksize=16,overlap=8)
Return c.MSCDetection(fv,thSCD1=thSCD1,thSCD2=thSCD2)
}
EOS = EndOfSceneClip
SOS = StartOfSceneClip
#return EOS
SSS="""
e = EOS.AverageLuma
s = SOS.AverageLuma
Subtitle(String(current_frame)+String(e,"] EOS=%.1f")+String(s," : SOS=%.1f"))
(e!=0.0)
\ ? Subtitle("End Of Scene",Size=48,Text_Color=$FF0000,Y=Height/2-24,Align=5)
\ : (s!=0.0) ? Subtitle("Start Of Scene",Size=48,Text_Color=$0000FF,Y=Height/2+24,Align=5)
\ : NOP
return last
"""
Scriptclip(SSS)
EDIT: Blend of SOS and EOS would be above 127 if either EOS or SOS (actually anything above 0.0 would would detect).
Could use with eg ConditionalSelect or some other runtime filter [as eg above scriptclip].