[mythtv] PATCH: Commercial detection/skip using blank frames

Chris Pinkham cpinkham at bc2va.org
Fri Feb 21 18:04:11 EST 2003

> > Give it a shot on your system
> Ha ha!
> I don't know how to do any of that. I have to wait until Robert writes the
> documentation for it :)

that's as easy as changing to the MC source directory and running:

patch -p0 < MythTV_commercial_skip_v2.patch

Then recompile as normal. :)

> I was just curious, since I thought someone said it would be in real time,
> since it had to check every frame. I was wondering what the frame jumps cut
> out.

I don't remember if I used that term or if it was someone else.  The
commercial skips have been taking less than 5 seconds on my system I
believe.  So, rather than hitting FFwd 6 times then Rewind 1 or 2 times,
I just hit 'Z' and a few seconds later I'm back to watching the show.

The jumps are for when the code is searching for the next blank frame.
If most commercials are 15, 30, or 60 seconds long it doesn't make sense
to scan the every frame so the code jumps to 14 seconds then scans a little
to find the blank.  If no blank is found after scanning 3 seconds worth of
video it jumps to 29 seconds and scans a couple seconds of video there.

Even if it scanned every frame it could still run faster than real-time since
the decoding process doesn't take 100% cpu to decode in real-time.  If there
are 29.97 frames per second but the cpu can decode 600 per second then
the code can scan through 20 seconds of video in one 'real' second of time.
So your average commercial break of 4-6 thirty-second commercials could
be scanned through in just a few in about 6-10 seconds.  These numbers
aren't exact but you get the idea.  By jumping around rather than decoding
and scanning every frame, that 6-10 can be cut down to maybe 3-5.


** Chris Pinkham                  Linux v2.2.18, Sane v1.0.4, Cajun v3.0-8 **
** cpinkham at bc2va.org                          http://www.bc2va.org/chris/ **

More information about the mythtv-dev mailing list