[mythtv-users] Commercial Detection

Lawrence Rust lvr at softsystem.co.uk
Fri Mar 9 09:30:23 UTC 2012


On Fri, 2012-03-09 at 13:44 +1000, Anthony Giggins wrote:
> 
> 
> On 8 March 2012 20:47, Lawrence Rust <lvr at softsystem.co.uk> wrote:
>         On Wed, 2012-03-07 at 23:13 +0000, Thomas Boehm wrote:
>         > Martin Moores wrote:
>         > > On 7 March 2012 21:58, Doug Lytle <support at drdos.info
>         > > <mailto:support at drdos.info>> wrote:
>         > >
>         > >
>         > >     And I believe there was an external script based on
>         volume changes on a
>         > >     channel that people have reported good results with.
>         > >
>         > >
>         > > Indeed, I never got around to trying that, but many said
>         they had a lot
>         > > of success with it:
>         >
>         > It works very well for me. I changed the script so that it
>         runs on all
>         > channels, not only the white listed ones. If there is really
>         a show
>         > which doesn't get marked properly, I still press the forward
>         button a
>         > few times as I did before, but most of the times it works.
>         >
>         > The mythcommflag which comes with MythTV takes much longer
>         and basically
>         > doesn't work at all in the UK.
>         
>         
>         I use a script based on the wiki article
>         www.mythtv.org/wiki/Mythcommflag-wrapper with good success on
>         most UK
>         Freesat channels.
>         
>         I found that changing the silence threshold to -76 dB from -70
>         significantly improved accuracy.  Also, decreasing the
>         coalescence time
>         from 400 to 360 seconds reduced the prevalence of false
>         positives.  The
>         last useful tweak is to the awk program to add 'cut to
>         beginning' or
>         'cut to end' without leaving 'dangling' frames.
>         
>         This generally leaves a few frames of ads/titles before and
>         after each
>         cut.  The only annoyance is that the post ad cut doesn't
>         position to a
>         keyframe so the cut isn't entirely invisible.  I'm working on
>         that and
>         back tracking from the start of cut to detect a scene change.
>         
>         The script can be found here:
>         http://www.softsystem.co.uk/download/mythtv/mythcommflag-silence.sh
>         
>         To run it as a user job, start mythtv-setup and find
>         General/JobQueue
>         (Global) and set the Ad-detection command:
>         mythcommflag-silence.sh -j %JOBID% -C
>         
>         The -C option copies the list to the cutlist.
>         
>         --
> 
> I get an error in this script when running from a command prompt
> 
> ./mythcommflag-silence.sh -c 4010 -s "2011-09-29 21:10:00"
> -i /storage3/recordings/4010_20110929211000.mpg
> mythcommflag-silence.sh: line 11: syntax error near unexpected token
> `cat'

This looks like a difference in sh implementations.  From the sh man
page 'man sh|grep -A 3 Function':

   Functions
     The syntax of a function definition is

           name () command

See also the POSIX doc on shell functions:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_05

As I understand it, a valid function can be:

f1() echo "f1"

Note the absence of { } around the command - these are for grouping and
are theoretically optional although I am aware that bash requires them.
The Help() function in mythcommflag-silence.sh doesn't include the
braces and so is tickling this particular bug.  For reference I'm
running Ubuntu and sh is provided by dash, what distribution and sh are
you running?

Pragmatically I updated the script to include the braces which should
fix this problem.  Would you confirm that this change fixes the problem
for you?  Thanks for your feedback.

-- 
Lawrence


More information about the mythtv-users mailing list