[mythtv] commdetector2

Robert Tsai mythtv at tsaiberspace.net
Fri Aug 18 16:54:52 UTC 2006

On Fri, Aug 18, 2006 at 10:40:27AM -0400, Daniel Walton wrote:
> I tried out the new commercial flagging code last night (svn 10820).
> The first time I ran mythcommflag I saw a "convert: command not
> found" error in the log but the commercial flagger kept going.  I
> installed imagemagick in order to get 'convert'.  No biggie but it
> might be worth mentioning in the install docs that you need
> imagemagick now.

Thanks; I've updated the Wiki page. ImageMagick is only needed for
TemplateFinder/TemplateMatcher debugging, and is not required for
normal operation of the flagger.

> I tested the flagger on a 60 minute episode of Mythbusters recorded
> on a PVR-150.  I recorded at 720x480, bitrate 6000, max bitrate
> 8000.

I am expecting parameter tuning problems with analog recordings, since
I myself only have digital sources.

I also expect problems with cable channels. I myself don't get any
cable channels, so didn't have anything to test with.

> - The new commercial flagger found 11 commercial segments but in
> reality there were 5 commercial breaks

The beginning has some other useful stuff. In particular, there should
be something like:

2006-08-10 18:53:22.043 CommDetector2::go pass 2 of 2 (39760 frames, 29.97 fps)
2006-08-10 18:53:22.048 HistogramAnalyzer::nuppelVideoPlayerInited 1920x1088: logo 185x88@(1324,876)
2006-08-10 18:53:22.115 BlankFrameDetector::nuppelVideoPlayerInited 1920x1088
2006-08-10 18:53:22.116 TemplateMatcher::nuppelVideoPlayerInited 185x88@(1324,876), 2834 edge pixels (want 1586)

The last line "TemplateMatcher::nuppelVideoPlayerInited" will tell you
the desired thresholds for matching on the logo. The
TemplateMatcher.txt debugfile will show the per-frame edge counts, so
you can see if maybe things can be fixed with simple tuning (currently

You also left out all the "BF Blank" results, for example:

2006-08-10 19:03:16.858 BlankFrameDetector::finished(3501)
2006-08-10 19:03:16.859 Blanks selecting median<=1 (0-87%), stddev<=0.305322 (87-87%)

Again, these threshold values as compared against
BlankFrameDetector.txt will reveal why frames were marked as blank (or
not). The idea here is to avoid marking blank white frames as "blank",
while still accommodating different "black" values (by not requiring
too clean a signal for total true "black").

> 2006-08-18 00:17:09.495 TemplateMatcher::finished(107865)
> 2006-08-18 00:17:09.502 TM Break:      1-   161 (0:00:00-0:00:05, 0:00:05)
> 2006-08-18 00:17:09.507 TM Break:  16732- 17957 (0:09:18-0:09:59, 0:00:41)
> 2006-08-18 00:17:09.511 TM Break:  19511- 20307 (0:10:51-0:11:18, 0:00:27)
> Actual commercial segments (by hand)
> ------------------------------------
> 0:00:00-0:00:14		14sec
> 0:08:09-0:11:45		3min 36sec
> 0:21:08-0:23:43		2min 35sec
> 0:29:36-0:32:58		3min 22sec
> 0:38:50-0:41:20		2min 30sec
> 0:51:10-0:55:40		4min 30sec
>                   Total 16min 47sec
> The BlankFrameDetector results are a little puzzling to me.  I
> looked at the video and there wasn't a blank frame at all at 0:00:05
> (incorrectly flagged as blank) but there was an obvious blank frame
> at 0:00:14 (not flagged).

Try bumping BlankFrameDetectorDebugLevel to 2 or 3, and use an OSD
theme with a "framedisplay" element so that you can see exact frame
numbers. These can be correlated with the BlankFrameDetector.txt file
to see why/why not it isn't blank.

If you are ambitious and have lots of disk space, you can also bump
TemplateFinder/TemplateMatcher debugging to level 2 or 3, to get lots
of frames dumped out.

> I need to flag this same show with the old commflagg engine to see
> how it compares but I would say that the new engine didn't seem to
> flag as well.  It seemed to find too many mini breaks within the
> commercial.  When I watched the show and told it to jump to the next
> break I had to click to the right on my remote multiple times to
> make it through one commercial.  I understand that this is a work in
> progress though and I appreciate all of the development that has
> gone into this new engine :)
> I have the backend log, HistogramAnalyzer-pgm.txt, etc that I can
> zip and email to anyone interested.


More information about the mythtv-dev mailing list