[mythtv] commdetector2

Robert Tsai mythtv at tsaiberspace.net
Fri Sep 1 22:04:46 UTC 2006


> - I had several commercials that weren't flagged because they
> weren't a 15 sec, 20 sec, 30 sec, or 60 sec commercial (+/- the
> delta for each).  One was 10 seconds, another 42 seconds, etc. I
> made the following changes but at this point almost any commercial
> length less than 65 seconds can be flagged so not sure how much good
> it does to search on commercials of specific lengths.

> Index: programs/mythcommflag/BlankFrameDetector.cpp
> ===================================================================
> --- programs/mythcommflag/BlankFrameDetector.cpp        (revision 11004)
> +++ programs/mythcommflag/BlankFrameDetector.cpp        (working copy)
> @@ -212,9 +212,12 @@
>          int     delta;  /* seconds */
>      } breaktype[] = {
>          /* Sort by "len". */
> +        { 10,   2 },
>          { 15,   2 },
>          { 20,   2 },
>          { 30,   5 },
> +        { 40,   5 },
> +        { 50,   5 },
>          { 60,   5 },
>      };

These lengths are only used when using blank frames as the primary
means of identifying commercial segments.

If the logo detector has decided that a logo does in fact exist, then
the blank frames are only used to help detect the cases where a logo
is delayed in its appearance after a commercial break; the "hint"
lengths then are not used.

> - Blank frames are marked pretty reliably for digitial recordings
> but for analog where the blank frames aren't as dark (sometimes in
> digitial they are 100% black) I saw a lot of misses.  Right now a
> MAXRANGE of 32 seems to do the trick but I am reflagging everything
> to make sure I'm not getting any non-blanks flagged as blanks with
> this setting.

The trade-off of a bigger range is that other
monochromatically-colored frames (say, a grey-out scene like in a
snowstorm or something) might be mistakenly identified as "blanK"
frames.

> - ESPN Classic tends to wait longer than most stations when it comes
> to displaying their logo after a commercial break.  The longest I
> saw was 34 seconds so I changed MAXBLANKADJUSTMENT to 35.  The only
> case where this hasn't been long enough was for the "30 days" show
> on FX.  FX sometimes waits a few minutes before displaying their
> logo after a commercial.
> 
> Index: programs/mythcommflag/TemplateMatcher.cpp
> ===================================================================
> --- programs/mythcommflag/TemplateMatcher.cpp   (revision 11004)
> +++ programs/mythcommflag/TemplateMatcher.cpp   (working copy)
> @@ -730,7 +752,7 @@
>       * to deviate by up to MAXBLANKADJUSTMENT frames before/after the break
>       * actually begins/ends.
>       */
> -    const int       MAXBLANKADJUSTMENT = (int)roundf(25 * fps);  /* frames */
> +    const int       MAXBLANKADJUSTMENT = (int)roundf(35 * fps);  /* frames */
>      const bool      skipCommBlanks = blankFrameDetector->getSKipCommBlanks();
> 

The trade-off with aggressively increasing this value (e.g., go as far
back as necessary to find a blank frame) is that if a commercial break
is actually *not* delimited by blank frames (e.g., broadcast resumes
immediately after commercial with no blank frames), then you might
pick up an inter-commercial blank frame as the resumption of your
regularly-scheduled show.

--Rob


More information about the mythtv-dev mailing list