It is well-known that:
- Many commercials are delimited by blank frames.
- Commercials are often of similar fixed duration (in the US, 15, 30, or 60 seconds).
Identifying "blank" frames that are a certain distance apart, and then coalescing those segments together, sounds almost trivially easy to do. However:
- "Blank" can vary by channel, signal quality, and input source. For example, analog cable is likely to contain a noisier signal than over-the-air broadcast digital HDTV, and "black" in the former case might not be as "black" in the latter case. Empirical evidence suggests that "black" values in an analog signal may take on greyscale-converted ranges of 0 to 32, while "black" values in an OTA HDTV signal only takes on greyscale-converted ranges of 0 to 8.
- Some blank frames are actually content, such as when a character or object temporarily completely blocks the camera. This makes it difficult to correctly infer which "blank" frames actually delimit a commercial break and which ones are simply dark content frames. Even worse, because of Murphy's Law, these dark frames can occur 30 seconds before or after a real commercial break.
Blank-frame detection is really a special case of a more general "scene change detection" strategy, where "sudden" changes in the video stream (large change in color histogram from one frame to the next) can be inferred to be some kind of delimiting event (separating different commercials from each other, or a commercial from the content). The blank-frame strategy is simply looking for a sudden change in the scene from something non-blank to something almost completely blank. The MythTV code has separate implementations for detecting blank frames and scene changes; it should be possible to build something that generalizes the problem to require only a single module of code.
Blank-frame detection can be used to help influence the identification of commercials detected by other methods. For example, television broadcast logos often appear a few seconds after the show has resumed, or they disappear a few seconds before the commercial break actually begins. Knowing that blank frames exist a few seconds away from a logo appearance (or disappearance) can help identify and handle these cases, making commercial-skip happen much more smoothly.