[mythtv] PATCH: Commercial detection/skip using blank frames

Bruce Markey bjm at lvcm.com
Sat Feb 22 14:07:31 EST 2003

</offline> ;-)

Matt Zimmerman wrote:
> I misread your original message...I thought you were saying that the cutlist
> would be generated during recording.  Gathering the hints during recording
> seems logical, assuming it is an inexpensive operation (could it be done
> every X frames or something?).

I was deliberately vague since building the cutlist on the
fly is possible. Of course, doing the analysis would suck up
cycles that you could use for encoding.

Checking every X frames and/or reducing the number of pixels
sampled would save cycles. I would think that if the whole
file is sampled, checking fewer pixels would still find blank

Chris Pinkham wrote:
 > I just did some tests earlier and on my system (Athlon 700, recording 
 > at 352x480 resolution), I can decode at 194 frames per second.  That
 > takes a little under 3 minutes to decode and scan through a whole 30 
 > show looking for commercials.

So you reread the file after recording? And for all the disk
I/O, decode, and sampling it only took about 1/10 realtime?
Great! It would seem that if you sampled pixels before handing
the frame off to be encoded, the increase in CPU usage would be
significantly less than 10%. If I averaged 80% CPU during
recording, I could live with 88% to have commercial skips but
it may turn out to be just 81% or 82%. It would make sense
that checking a few pixels would only take a small fraction
of the time that the takes to do encoding.

 > So it doesn't look like it would take too much horsepower away from 
 > to detect blank frames.  The could be analyzed in a few seconds after
 > recording as well and flagged.  The post-processing could do things like
 > removing flags if the non-blank frame sequence was too small to be a
 > commercial, etc., as well as converting the regular flags to 
 > and stop-commercial.  Then during playback the start/stop sequences could
 > be automatically skipped.

Excellent. You could also solve the Simpsons Eyes problem
by ignoring long blank clusters that are not surrounded by
other commercial blanking.

When you do your flagging, did you intend to use the existing
cutlist format? I haven't really used this myself but it might
make sense so that the viewer could use edit mode to fix up
recordings she intends to keep.

--  bjm

More information about the mythtv-dev mailing list