A commercial detection apparatus includes a frame grab thread which
acquires frames from an input data stream to be analyzed by a cut detector
thread and a filter thread. A commercial detection thread determines
whether a commercial has occurred from data created by the cut detector
thread and the filter thread stored in a memory. A factor used by the
commercial detection thread is whether a black frame has occurred. The
input data stream is divided into a plurality of regions and then a
maximum and minimum value for a section of these regions is determined and
compared to one another. If the maximum and minimum values are close
enough, and the maximum value is below a threshold, then the frame is
deemed to be black. The commercial detection thread also looks at the
average cut frame distance, cut rate, changes in the average cut frame
distance, the absence of a logo, a commercial signature detection, brand
name detection, a series of black frames preceding a high cut rate,
similar frames located within a specified period of time before a frame
being analyzed and character detection. During playback, the detected
commercials are either skipped or substituted with alternate content.