Find Frame


Home
Download

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.

Syntax:

FindFrame uses named parameters except the first one which must be logo clip:

FindFrame(clip, parameter_list)

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.

Example script:

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:

FindFrame(logo, analyze=377,  log=”result.txt”)

result.txt content:

1 4.1 4.1
2 0.2 4.3
3 0.0 4.3
4 0.5 4.8
5 22.0 26.8
6 34.1 60.9
7 4.1 65.0
8 4.8 69.8
9 5.1 74.9
102.2 77.1
111.9 79.0
121.0 80.0
132.2 82.1
142.9 85.0
152.7 87.7

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%.


Home | IE Middle Clicker | Logo Cutter | Find Frame | Contact Information

  2004-2005 iemdl.com
Last updated: 11/23/07.