Test snippet for LocateFrames() in previous post.
Code:
#Import("LocateFrames.avs")
VIDOEOFILE="D:\AVS\AVI\PAL-P_169_P-AeonFlux.d2v"
Test=MPEG2Source(VIDOEOFILE).Trim(0,2999)
MCOUNT=600 # Size of sample taken from full Test clip.
MSTART=1000 # Start position in Full Test clip of Sample.
MSTOP =MSTART+MCOUNT # Stop position in full test clip.
Test.Trim(MSTART,-MCOUNT) # Last = 600 Frames from MSTART to MSTART+MSTOP-1
# Manufacture 5 frame FindClip, NOTE middle frame exact, others blurred to some degree.
Q=trim(100,-1).Blur(0.1) + trim(200,-1).Blur(1.58).Blur(1.58) + Trim(300,-1) + trim(400,-1).Blur(0.3) + Trim(500,-1).Blur(1.0)
Results=LocateFrames(Test,Q,start=MSTART,stop=MSTOP)
#Results=LocateFrames(Test,Q,Thresh=1.5,Thresh2=1.6,Start=MSTART,Stop=MSTOP) # Alternative Ordered search
RT_Debug(Results) # Send combined results to debugview
RT_Debug(" ") # Line separator
GScript("""
N = RT_TxtQueryLines(Results) # Same as number of frames in find f clip.
for(i=0,N-1) {
s=RT_TxtGetLine(Results,Line=i) # Get individual result string
Eval(s) # Set variables for this find frame
RT_Debug("Found frame",String(LF_FOUND),"for find frame",String(LF_FIND),"Had a diff of",String(LF_DIFF))
}
""")
Return Test # Dummy return avoid ThrowError
Results from DebugView
Code:
00000002 25.34745216 [3680] RT_Debug: LF_FOUND=1100 LF_FIND=0 LF_DIFF=0.006134 LF_START=1000 LF_END=1599 LF_XPCNT=0 LF_MATCH=0
00000003 25.34751892 [3680] RT_Debug: LF_FOUND=1200 LF_FIND=1 LF_DIFF=0.482239 LF_START=1000 LF_END=1599 LF_XPCNT=0 LF_MATCH=0
00000004 25.34756088 [3680] RT_Debug: LF_FOUND=1300 LF_FIND=2 LF_DIFF=0.000000 LF_START=1000 LF_END=1300 LF_XPCNT=0 LF_MATCH=2
00000005 25.34760475 [3680] RT_Debug: LF_FOUND=1400 LF_FIND=3 LF_DIFF=0.038260 LF_START=1000 LF_END=1599 LF_XPCNT=0 LF_MATCH=0
00000006 25.34764290 [3680] RT_Debug: LF_FOUND=1500 LF_FIND=4 LF_DIFF=0.928930 LF_START=1000 LF_END=1599 LF_XPCNT=0 LF_MATCH=0
00000007 25.34771919 [3680] RT_Debug:
00000008 25.35038757 [3680] RT_Debug: Found frame 1100 for find frame 0 Had a diff of 0.006134
00000009 25.35267448 [3680] RT_Debug: Found frame 1200 for find frame 1 Had a diff of 0.482239
00000010 25.35495567 [3680] RT_Debug: Found frame 1300 for find frame 2 Had a diff of 0.000000
00000011 25.35724068 [3680] RT_Debug: Found frame 1400 for find frame 3 Had a diff of 0.038260
00000012 25.35950851 [3680] RT_Debug: Found frame 1500 for find frame 4 Had a diff of 0.928930