[mythtv] Test (crude) patch for commercial skipping

JC johnmythtv at crombe.com
Tue Feb 18 11:52:30 EST 2003


Actually, I've seen them slipping in 15 second spots quite regularly, often
promos for network shows, etc., so 30 seconds isn't probably enough
resolution.

Still, I think that there's close to a zero percent chance that a commercial
will start or end anywhere except 0, 15, 30, and 45 seconds into each
minute.  Therefore, if your code only looked at say a 2 second (or less)
window at those times, it would find the start and stop of all commercials.
This would have two advantages:

1) Reduce false positives where it picked up something that wasn't really a
commercial and ran with it
2) Speed up detection by only having to look at 8 seconds per minute vs. 60
for the key frames

Additionally, you could get even smarter by not looking at certain time
periods.  For example, I don't think there's ever a commercial (at least
here in the U.S.) at 4 - 8 minutes into a show.  They know that the viewer
isn't "into it" enough yet and will tune away if they have one then so they
give them enough material to get them hooked.  Just an added idea...

FWIW, I think we're all *very* interested in this.  Even letting us assign a
key to start the commercial "skip" detection would be a terrific add-on.

Thanks!
JC



----- Original Message -----
From: "Larry Matter" <mythtv at matter.net>
To: <mythtv-dev at snowman.net>
Sent: Monday, February 17, 2003 1:18 PM
Subject: Re: [mythtv] Test (crude) patch for commercial skipping


> Neat stuff.  I think that most commercials (in the US anyway) are in 30
> second chunks.  I was thinking that once a commercial is "detected" that
> you could skip ahead in the stream by about 20-25 seconds and then start
> your detection again and maybe that would speed it up.
>
> Maybe you are already doing that; I haven't looked at the code yet.
>
> Larry
>
>
> > Attached is a crude patch to help skip commercials.  It uses a little of
> > Robert Kulagowski's code in NuppelVideoPlayer::FindCommercial() in
> > NuppelVideoPlayer.cpp and adds functionality.
> >
> > When the user hits 'Z' while watching (delayed) LiveTV or a recorded
> > program, the commercial skip code is run.
> >
> > Basically it picks X (currently 200) random pixels from the current
> > frame and determines what is the variance for those X pixels.  If the
> > variance is less than 20, it assumes the frame is blank (no color
> > detection though).  Currently I have it hardcoded to assume the blank
> > screen transition between commericials and the show is at least 10
> > frames long. As a precaution, the code will only skip forward up to 4
> > minutes at a time looking for the break.  It also should come out of
> > skip mode if it encounters the end of the recorded video or it catches
> > up to live TV.
> >
> > Currently the code still has to decode each frame since it is based upon
> > detecting blank frames.  This means it's not an instantaneous jump to
> > the end of a commercial break after you hit 'Z', but instead it may take
> > up to 10-15 seconds to scan through the frames till it finds the break.
> >
> > I'm uploading this as something to stir discussion and for people to try
> > out.  I don't expect it to be integrated into MythTV just yet.  I wanted
> > to have a setting option to specify the minimum number of blank frames
> > that should mark the transition but didn't code that yet since this is
> > basically a proof of concept.
> >
> > I've tried this code with a couple of prerecorded (U.S.) TV shows and it
> > seems to work pretty good.  I have seen a show though where the
> > commercial <-> show transitions were not separated by but 1-2 frames of
> > black so this code did not work for those.  The max frames skipped code
> > kicked in and returned to normal play after skipping 4 minutes meaning I
> > had to rewind about a minute to get back to the beginning of the show.
> >
> > I haven't thought of a way to look for breaks in reverse since there
> > isn't a reverse version of GetFrame().
> >
> > Can people take a look at this and let me know what they think or if it
> > works for them?  The patch is based upon CVS as of 11pm EST on
> > 2/16/2003.
> >
> > Possible enhancements include:
> >   - option in setup to set minimum number of blank frames to look for -
> > option in setup to set maximum number of seconds to skip while looking
> > - only look for black blank frames (ie, not totally white screen which
> >     could cause false triggers)
> >   - ability to scan backwards
> >   - auto-detection of beginning of commercials and auto-skip
> >   - show every X frames as video is skipped (currently video is paused)
> > - better commercial detection (how do the VCRs do it???)
> >
> > Chris
> >
> >
****************************************************************************
*
> > ** Chris Pinkham                  Linux v2.2.18, Sane v1.0.4, Cajun
> > v3.0-8 ** ** cpinkham at bc2va.org
> > http://www.bc2va.org/chris/ **
> >
****************************************************************************
*
>
>
>
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at snowman.net
> http://www.snowman.net/mailman/listinfo/mythtv-dev
>
>




More information about the mythtv-dev mailing list