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

Bruce Markey bjm at lvcm.com
Sun Feb 23 00:54:57 EST 2003


Chris Pinkham wrote:

> I posted a small patch earlier that would scan through the file instead of
> playing it if you had a certain environment variable set.  I used that
> code and added a "cout" at the bottom to print total time used, total frames,
> and fps.  I tried changing a few things but couldn't get it to get more
> than 194fps.  At my 352x480 resolution, that's about 50 Megabytes of
> just raw video data being passed around per second not counting the other
> stuff going on like reading the compressed data, checking 200 pixels from
> each frame to see if it's blank, etc..

Just out of curiosity, I wanted to see how much load would
be added by GetFrameVariance() if it were called for each
frame while recording. I made a copy in NuppleVideoRecorder.cpp
and modified variables to match this file then called it just
before the lock around avcodec_encode_video(). One problem
I noticed is that this approach will not work for hardware
compression because there is no opportunity to sample the
uncompressed frames.

I recorded an hour of CNN Headline News with and without
the variance code and checked the CPU time for the encoder
thread PID in "top". This test was run on an Athlon 1.2GHz
at 544x480, 3300 scaled bitrate mpeg4.

Without the variance code, the encoder PID used 43:49/60:02
or 72.99%. It used 44:54/60:57 or 73.67% with the variance
code called for every frame and writing out frame numbers.
Less than 1% increase in CPU usage. I had done some shorter
tests earlier which all showed less than a 2% increase.

This seems about right because GetFrameVariance is
essentially three little 200 iteration loops which is
nothing compared to the mpeg compression.

--  bjm



More information about the mythtv-dev mailing list