<br><br><div class="gmail_quote">On 9 March 2012 19:30, Lawrence Rust <span dir="ltr">&lt;<a href="mailto:lvr@softsystem.co.uk">lvr@softsystem.co.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Fri, 2012-03-09 at 13:44 +1000, Anthony Giggins wrote:<br>
&gt;<br>
&gt;<br>
&gt; On 8 March 2012 20:47, Lawrence Rust &lt;<a href="mailto:lvr@softsystem.co.uk">lvr@softsystem.co.uk</a>&gt; wrote:<br>
&gt;         On Wed, 2012-03-07 at 23:13 +0000, Thomas Boehm wrote:<br>
&gt;         &gt; Martin Moores wrote:<br>
&gt;         &gt; &gt; On 7 March 2012 21:58, Doug Lytle &lt;<a href="mailto:support@drdos.info">support@drdos.info</a><br>
&gt;         &gt; &gt; &lt;mailto:<a href="mailto:support@drdos.info">support@drdos.info</a>&gt;&gt; wrote:<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt;     And I believe there was an external script based on<br>
&gt;         volume changes on a<br>
&gt;         &gt; &gt;     channel that people have reported good results with.<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; Indeed, I never got around to trying that, but many said<br>
&gt;         they had a lot<br>
&gt;         &gt; &gt; of success with it:<br>
&gt;         &gt;<br>
&gt;         &gt; It works very well for me. I changed the script so that it<br>
&gt;         runs on all<br>
&gt;         &gt; channels, not only the white listed ones. If there is really<br>
&gt;         a show<br>
&gt;         &gt; which doesn&#39;t get marked properly, I still press the forward<br>
&gt;         button a<br>
&gt;         &gt; few times as I did before, but most of the times it works.<br>
&gt;         &gt;<br>
&gt;         &gt; The mythcommflag which comes with MythTV takes much longer<br>
&gt;         and basically<br>
&gt;         &gt; doesn&#39;t work at all in the UK.<br>
&gt;<br>
&gt;<br>
&gt;         I use a script based on the wiki article<br>
&gt;         <a href="http://www.mythtv.org/wiki/Mythcommflag-wrapper" target="_blank">www.mythtv.org/wiki/Mythcommflag-wrapper</a> with good success on<br>
&gt;         most UK<br>
&gt;         Freesat channels.<br>
&gt;<br>
&gt;         I found that changing the silence threshold to -76 dB from -70<br>
&gt;         significantly improved accuracy.  Also, decreasing the<br>
&gt;         coalescence time<br>
&gt;         from 400 to 360 seconds reduced the prevalence of false<br>
&gt;         positives.  The<br>
&gt;         last useful tweak is to the awk program to add &#39;cut to<br>
&gt;         beginning&#39; or<br>
&gt;         &#39;cut to end&#39; without leaving &#39;dangling&#39; frames.<br>
&gt;<br>
&gt;         This generally leaves a few frames of ads/titles before and<br>
&gt;         after each<br>
&gt;         cut.  The only annoyance is that the post ad cut doesn&#39;t<br>
&gt;         position to a<br>
&gt;         keyframe so the cut isn&#39;t entirely invisible.  I&#39;m working on<br>
&gt;         that and<br>
&gt;         back tracking from the start of cut to detect a scene change.<br>
&gt;<br>
&gt;         The script can be found here:<br>
&gt;         <a href="http://www.softsystem.co.uk/download/mythtv/mythcommflag-silence.sh" target="_blank">http://www.softsystem.co.uk/download/mythtv/mythcommflag-silence.sh</a><br>
&gt;<br>
&gt;         To run it as a user job, start mythtv-setup and find<br>
&gt;         General/JobQueue<br>
&gt;         (Global) and set the Ad-detection command:<br>
&gt;         mythcommflag-silence.sh -j %JOBID% -C<br>
&gt;<br>
&gt;         The -C option copies the list to the cutlist.<br>
&gt;<br>
&gt;         --<br>
&gt;<br>
&gt; I get an error in this script when running from a command prompt<br>
&gt;<br>
&gt; ./mythcommflag-silence.sh -c 4010 -s &quot;2011-09-29 21:10:00&quot;<br>
&gt; -i /storage3/recordings/4010_20110929211000.mpg<br>
&gt; mythcommflag-silence.sh: line 11: syntax error near unexpected token<br>
&gt; `cat&#39;<br>
<br>
</div></div>This looks like a difference in sh implementations.  From the sh man<br>
page &#39;man sh|grep -A 3 Function&#39;:<br>
<br>
   Functions<br>
     The syntax of a function definition is<br>
<br>
           name () command<br>
<br>
See also the POSIX doc on shell functions:<br>
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_05" target="_blank">http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_05</a><br>
<br>
As I understand it, a valid function can be:<br>
<br>
f1() echo &quot;f1&quot;<br>
<br>
Note the absence of { } around the command - these are for grouping and<br>
are theoretically optional although I am aware that bash requires them.<br>
The Help() function in mythcommflag-silence.sh doesn&#39;t include the<br>
braces and so is tickling this particular bug.  For reference I&#39;m<br>
running Ubuntu and sh is provided by dash, what distribution and sh are<br>
you running?<br>
<br>
Pragmatically I updated the script to include the braces which should<br>
fix this problem.  Would you confirm that this change fixes the problem<br>
for you?  Thanks for your feedback.<br>
<div class="HOEnZb"><div class="h5"><br>
--<br>
Lawrence<br>
<br></div></div></blockquote><div>I&#39;m running mythdora 12.23 aka fedora 12<br><br>Was this right ?<br><br>Help() { cat &gt;&amp;2 &lt;&lt;END<br>Detect commercial breaks in a TV recording using silence detection.<br>
Usage: ${myname##*/} [options]<br>Options:<br>  -b &lt;n&gt;    Coalesce ad breaks upto [$MAXCOMMBREAKSECS] Seconds<br>  -c &lt;n&gt;    Channel ID<br>  -d &lt;f&gt;    Min silence duration [$SILENCE_DURATION] Seconds<br>
  -i &lt;path&gt; Recording filename<br>  -j &lt;n&gt;    Job ID<br>  -s &lt;s&gt;    Start-time<br>  -t &lt;n&gt;    Silence threshold [$SILENCE_THRESHOLD] dB (-96..0)<br>  -C        Copy to cutlist [$COPYTOCUTLIST]<br>  -M &lt;path&gt; MythTV settings folder [$MYTHCONFDIR]<br>
  -h        Display this help and exit<br>  -V        Display version and exit<br><br>A job ID, channel ID and start-time or a recording filename must be specified.<br>END<br>}<br><br><br>I tried running with with dash but it doesn&#39;t seem to do anything<br>
<br>$ dash ./mythcommflag-silence.sh -i /storage3/recordings/4010_20110929211000.mpg<br>$<br><br></div></div>Cheers,<br><br>Anthony<br>