View Single Post
Old 25th September 2015, 03:00   #22  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
The following kiddiescript is nothing compared to StainlessS' professional work, but it is a simple way to get you 80% of the way there. Here's the output file containing flash frame numbers:

Flash Frame.txt

And here's the simple script:

Code:
#Script to find flash frames

filename = "e:\flash_frames.txt"
global flashthreshold=0.8

i=AVISource("E:\Documents\Dnload\UNPACK\join3.avi")

j=trim(i,1,0) #Previous frame

# Temporarily un-comment next line to display the average luma value on screen to help determine threshold value
#ScriptClip(i,"Subtitle(String(YDifferenceToNext(i) ))" )

#This finds the FIRST frame in a series that fall below the threshold
#WriteFileIf(i, filename,  "(YDifferenceToNext(i)>flashthreshold)&&YDifferenceToNext(j)<flashthreshold", "current_frame+1", append = false)

#This line below will output EVERY frame that is below threshold, which results in LOTS of frames
WriteFileIf(i, filename,  "(YDifferenceToNext(i)>flashthreshold)", "current_frame+1", append = false)

#The line below finds the LAST flash frame in a series
#WriteFileIf(i, filename,  "(YDifferenceToNext(i)<flashthreshold)&&YDifferenceToNext(j)>flashthreshold", "current_frame+1", append = false)
johnmeyer is offline   Reply With Quote