The comm flagger has been working worse for me over time so I decided to have a look at the algorithms.

The main components are:

Command line method parsing fix. Was completely broken. See first patch

Audio silence and change data fusion

Scene changer param change. 0.85 was way too high to get useful scene cut info. Still not sure what the right value is. Debugging procedure to adventurers will follow.

2 and 3 are in the comm-detector-audio patch. This patch is completely independent of the myth libraries so that it is easier to test. There are some enum changes that will eventually make it into libmyth.
Only the all method is implemented.
Audio power min and max dont appear to add anything useful and will probably be removed.

It seems to me this code assumes start_display_time and end_display_time are relative times to the frame number. Instead in my recordings they are absolutes timecodes in ms, directly related to the timecodes associated with each video frame. And the above code yields incorrect framenumbers, and subtitle detection fails.

I guess we could subtract the the initial frame's timecode, if we can assume fps is constant for recordings. I'm not sure that is a safe assumption. I suspect the time code wraps around to zero at some point, and that would need to be handled.

Instead I think it would be safer to follow the pattern of subtitlescreen.cpp which just compares the subtitle start and end timecodes with the frame timecodes.

Presumably the current code works for some people, although I find it hard to see how. It's entirely possible I'm not understanding something deeper here. Comments welcome. But I'm hoping if I do a good job, the changed code should still work correctly for them and also work for me.

Changed 6 years ago by bryan@…

I decided to put these here since a lot of the work is similar; my apologies if they should have gone in their own ticket. I have been these in testing now for about a month with good results. It's not perfect of course, but it works better for me (US Eastcoast mostly HiDef? from a HDHRP) that the baseline 0.25/0.26 comm flagger. I've got 4 diffs here, and I apologize for the size... I got kind of carried away and I should have probably tried to do these tasks more independently.

The largest one is all of the others combined. I split it up into 3 individual pieces for easy reviewing, but I didn't generate them separately so I'm not sure they will apply as individuals. If there's problems with that and using the monolithic one isn't a good idea, I can split them up and diff them individually against the baseline.

The "commdetector.diff" file contains my extensive changes to BuildAllMethodsCommList?(). I did a lot of reorganizing in here to help me wrap my head around what was going on. I'm not sure that any of my changes netted all that much positive here, except where related to the other two patches. I think the cleanups make it easier to follow, but that could just be me.

I mostly rewrote the LogoDetector? to use "Sobel" edge detection (there's a decent wikipedia article about it). That plus a few other changes to the thresholds and border areas makes the logo detector a lot more reliable. Because of that, I recommend making changes to BuildAllMethodsCommList?() to require less frames containing the logo before giving a score boost.

I rewrote Histogram similarity detection to allow slight changes in overall brightness by averaging over a range of intensities. This seems to work well. Bundled together, I added a bit of code to the scene change detector to avoid rapid scene changes over a very short (< 1s) period of time (reducing them to 1). I also added a bit of a "memory" of the previous scene, so that when the scene switches to something, and then switches back to the previous scene, neither is counted as a scene change. This is common in programming when there's dialog going on. These changes resulted in a much lower (about half as much) scene changes being reported, but nearly no legitimate changes are missed (except those purposely not reported because they appear to be part of programming). This necessitates changes to BuildAllMethodsCommList?() to account for the lower scene change rate. I ended up going with about half of what all of the old schene change rate requirements were.

I hope these are helpful. I'm happy to answer questions on them or try to clean them up a bit if needed. I can also change them to be against THE Nextgen detectors rather than Classic if that works better.

Hi Bryan. Please understand this is feedback - a couple of data points. I certainly appreciate you sharing your efforts.

I successfully added your mythcommflag.patch to the current development tree. I ran it on my two test recordings I'm working with, and using --method 7 (ie all) and also 6 (logo+scene) I didn't detect any commercials. The current master detects 2 of the 3 commercial breaks (and gets the timing correct on one of them). What I observe is that fewer Blanks are being detected (27 versus 35), and not consecutively. That combined with my observation that all methods are dependent on blank detection (I have found it useless to use any method without also detecting blanks), than this is a problem in my test set.

Hope you find the feedback useful. I shall go back to trying to figure out whether New Zealand TV2 is sending NULL/blank subtitles to clear subtitles off the screen... I wish there was some good debugging code to break down what is going on with DVB-T subtitle streams in a H.264 broadcast.

I very much appreciate the feedback. I went back through and cleaned up my patches. I've reduced it to 2 (they both overlap a little in ClassicCommDetector?): a new SceneChangeDetector? and a new LogoDetector?. My other patch had made some more changes to the overall commflagging method that may have been a bad idea for non-US so I decided to abandon those changes. These 2 (scene change and logo detection) have both worked really well for me over the last 2 months.

Changed 4 years ago by Mark Spieth

Changed 4 years ago by Mark Spieth

After being prompted by helen, Ive produced a timely update to my patchset which incorporates helens findings and some others that I noticed while testing.
Use all patches prefixed 20141111- in that order.

updated to use helens bytesperline patch instead of the one I was using previously.

fix to coalesce segment scores which wasn't being done before helps with short program segments.

new log detector which is incomplete can be accessed with method ng_allx or 1055+256

use correct fps as players is just a wrong default. Only affects log output.

I like the results Im getting and will put this into my main backend shortly.
Not perfect by better than I am currently getting. I tried to pick a varied set of material.
Thanks to helen for her work that prompted me to revisit something I'd been using for ages.

As always feedback appreciated and YMMV.
Note: view table in browser, mail won't do it justice.