Log in

View Full Version : Make this script process only every 5th frame?


dwilbank
10th March 2013, 00:02
I found this useful script here on Doom9 - but the thread is a few years old.
It basically gives you a txt file of frame numbers in which the luma is below a certain threshold.

Is there a way to make it look at every fifth frame instead of every frame?
I obviously want to speed up the processing (finding long commercial blacks).

Thanks

#Specify the name and location of the output file
filename = "c:\output_blank_frames.txt"

#Specify the threshold that will be considered black (0 = pure black)
global blankthreshold=28

#DirectShowSource("black_frames_av2i.avi").killaudio()
AVISource("black_frames_test.avi").killaudio()

#Only look at half the fields (speeds up processing
i=separatefields.selectodd.ConvertToYV12()

#Write the frame number
WriteFileIf(last, filename, "(AverageLuma(i)<blankthreshold)", "current_frame+1", append = false)

Chikuzen
10th March 2013, 03:40
#Specify the name and location of the output file
filename = "c:\output_blank_frames.txt"

#Specify the threshold that will be considered black (0 = pure black)
global blankthreshold=28
interval = 5

#DirectShowSource("black_frames_av2i.avi").killaudio()
AVISource("black_frames_test.avi").killaudio()
SelectEvery(interval, 0)

#Only look at half the fields (speeds up processing
i=separatefields.selectodd.ConvertToYV12()

#Write the frame number
WriteFileIf(last, filename, "(AverageLuma(i)<blankthreshold)", "current_frame*interval+1", append = false)

dwilbank
10th March 2013, 03:49
can't wait to try it out

thanks!