FindFrame is an Avisynth plugin that will search for a frame that matches the supplied still image.
It was developed as part of Logo Cutter tool to automatically cut recorded TV shows by looking for a show “logo” frame, so that when you view the recorded program it will start right from the beginning.
The plugin is based on Dup filter by Donald Graft, and uses many of its parameters. It requires Avisynth 2.5 and beyond.
FindFrame uses named parameters except the first one which must be logo clip:
Logo clip must be the same dimension and color space format as the main clip (YUY2 or YV12). First frame of logo clip will be used as a reference frame to look for in the main movie.
parameter_list is a comma-separated list of (optional) named parameters:
threshold (0.0-100.0, default 7.0): the percentage change in the most different 32x32-pixel window that is enough to declare a frame equal to logo frame.
For example, with the default setting of 7%, if any 32x32 pixel area changes by 7% or more than logo frame, they are not equal, otherwise there are.
allow_over_threshold (0.0-100.0, default 0): the percentage of 32x32 pixel areas that are allowed to be above threshold. Increase this setting when, for example, logo frame has changing parts like episode title, or when there are slight variations of logo frame.
chroma (true/false, default true): use chroma in the frame difference calculation.
debug (true/false, default false): debug output to the DebugView utility.
upto_minute (default is a whole clip): search for logo frame up to this minute.
log (string): if logo frame is found, write frame number to this file. If it is not found, the file is not created. In analyze mode (see below), used to output frame difference information.
analyze (frame number): compare given frame to logo frame and output difference information to log file. For each threshold from 1 to 15 (first column in the log), show the percentage of 32x32 pixel areas that are below the threshold (third column).
This mode is useful to detect suitable threshold/allow_over_threshold parameters.
logo = ImageSource(“logo.ebmp”) DGDecode_mpeg2source(“movie.d2v”) FindFrame(logo, threshold=13, allow_over_threshold=10, chroma=false, upto_minute=20, debug=true, log=”result.txt”)
Compare frame 377 with logo to understand how much they are different:
So for the threshold = 11%, 79% of the pixel areas were below the threshold, which means that in order to declare frame 377 equal to logo, allow_over_threshold must be set to 21%.