[mythtv] Getting started with real-time commercial detection

Robert S. Grimes rsg at alum.mit.edu
Sat Jul 15 00:49:47 UTC 2006

Hi Chris,

Okay, it's been a while, but you know how life tends to get in the way of
programming sometimes, right?

Anyway, while what you said a month ago makes a lot of sense, I have not
been able to locate the relevant code; I'm not even sure what is actually
code changes I'll have to do and what are configuration issues.

> -----Original Message-----
> Subject: Re: [mythtv] Getting started with real-time commercial
> detection
> * On Fri Jun 16, 2006 at 09:51:18AM -0400, Robert S. Grimes wrote:
> > commercials!  My first goal is to watch TV with commercial detection
> > running, such that when a commercial begins, MythTV simply
> cranks the volume
> > down; later, maybe I'll want to do something like play music,
> or show some
> A few issues.  I don't think that the flagger currently gets run on LiveTV
> recordings.  I have a note in my TODO to look into this but
> haven't had time
> lately.  It's a matter of looking into tv_rec.cpp and scheduling a flagger
> job if the user has realtime flagging turned on.  There shouldn't
> be a need to
> check the 'transcode after flagging' setting because we shouldn't
> be transcoding
> LiveTV programs anyway.

Okay, the closest I found is the function init_jobs, but its only apparent
caller (TVRec::TuningNewRecorder) doesn't seem to get called.  So I wonder
what you mean by a few things you said:
  1. "user has realtime flagging turned on" - Is this an existing setting,
or a new one you assume I'll add?  If the latter, I'm almost certainly going
to "hard code" that setting at first, as that's another can of worms I'd
prefer to not open yet.
  2. "scheduling a flagger job" - Is this set via the "user job...On New
Recordings" settings on the "General (Jobs)" settings page?  Or is it code
I'll need to add to TVRec?  If so, where?

> So, assume that you are running commercial flagging when
> recording a LiveTV
> program.

This is the subject of my confusion in the previous section - how do I get
it running?

> When the flagger runs, it periodically (every 500
> frames currently)
> recomputes the commercial skip list and if it has changed it sends out a
> COMMFLAG_UPDATE event to any frontends watching the program.  It only does
> this if a frontend has requested updates via the COMMFLAG_REQUEST event so
> it doesn't waste time computing the skip list and sending out events if no
> one is watching the recording.

I gather the frontend will have to request the updates while watching
LiveTV, right?  Not sure how, but I suspect it's easier than the previous

> The issue is that the flagging accuracy for the last part of the video
(ie, near realtime) is not really
> accurate.  ...

Yeah, these will raise their heads soon enough, but I can certainly tolerate
extending the delay between broadcast time and LiveTV time, so this may be
the approach to take.

> So I'm not sure if you realize the scope of what you were thinking.

Okay, I certainly underestimated the scope of figuring out just what to do!
Still feel I can do it, but certainly I would appreciate some more guidance.
I do want to figure this out, and clearly others are much more experienced,
so whatever you or others can do to help would be wonderful!

Thanks, and take care,

More information about the mythtv-dev mailing list