<br><br><div class="gmail_quote">On Sun, Sep 4, 2011 at 11:56 PM, Raymond Wagner <span dir="ltr">&lt;<a href="mailto:raymond@wagnerrp.com">raymond@wagnerrp.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div class="im">
    On 9/4/2011 22:48, Jeremy Jones wrote:
    </div><blockquote type="cite"><div class="im"><br>
      <br>
      <div class="gmail_quote">On Sat, Sep 3, 2011 at 12:22 AM, Raymond
        Wagner <span dir="ltr">&lt;<a href="mailto:raymond@wagnerrp.com" target="_blank">raymond@wagnerrp.com</a>&gt;</span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div>On 9/3/2011 01:14, Jeremy Jones wrote:<br>
            &gt;<br>
            &gt; After re-looking at thwarting backend settings, I
            already have it set<br>
            &gt; to run transcoding jobs first. I checked the backend
            logs and the<br>
            &gt; commercial detection is running first anyway, so I
            assume that setting<br>
            &gt; just does not apply if you are transcoding with a user
            job.  Is that<br>
            &gt; correct?<br>
            &gt;<br>
            <br>
          </div>
          That setting only functions with the specific commflag and
          transcode<br>
          tasks.  If you want it to work with your custom transcoding
          task, you<br>
          must replace the command for mythtranscode in mythtv-setup.<br>
          <div><br>
          </div>
        </blockquote>
      </div>
      <br></div><div class="im">
      I notice the command in setup for transcode is simply,
      &quot;Mythtranscode&quot;.  Do I need put my entire user job command there
      complete with the, &quot; --chanid %CHANID% --starttime %STARTTIME%&quot;
      parameters that follow the command, or will these be passed
      automatically, and only the script file path/name is needed?<br>
    </div></blockquote>
    <br>
    The value  &#39;mythtranscode&#39; is a special key that tells the jobqueue
    to run that application with all the command line arguments needed
    to make it work.  If using anything other than &#39;mythtranscode&#39;, you
    must populate whatever arguments you need.<div class="im"><br></div></div></blockquote><div><br>That makes sense. Thanks.<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div bgcolor="#FFFFFF" text="#000000"><div class="im">
    <br>
    <blockquote type="cite">Also, as I stated in my original post, I used your,
      &quot;Transcode wrapper stub&quot; from the wiki to build my script.  Can
      you tell me what the line, &quot;flush_commskip = True&quot; Does?  Am I
      deleting the commercial flags with this?  Would changing that to
      false fix my problem, or do I need to leave it as true and swap
      the transcode command like you said above?<br>
    </blockquote>
    <br></div>
    All that does is flush the stored commercial skip data out of the
    recordedmarkup table.  That data is keyed off the frame number, so
    if your transcoding command cuts out frames, resamples, performs
    IVTC or deinterlacing, that data will no longer be valid and should
    be deleted.<br>
    <blockquote type="cite">
    </blockquote>
  </div>

<br></blockquote><div>That&#39;s what I thought after I read Mike&#39;s post, but I wanted to make sure.<br><br><br><br>So now: I added my entire user job command to the transcode command and 
ticked for autotranscode and transcode before comm flag.  Then I unchecked my userjob, and let Mythbackend do its stuff.  On my backend 
logs I get this:
<div class="de1"><br>
     2011-09-05 17:07:53.291 transcode: Transcode Errored: &quot;Between the 
Lions&quot;: Autodetect (exit status 0, job status was &quot;Starting&quot;)<br>
     2011-09-05 17:07:53.308 JobQueue: Transcode Errored: &quot;Between the 
Lions&quot;: Autodetect (exit status 0, job status was &quot;Starting&quot;)</div>
<br>
But, the file was transcoded (or at least it appears to have worked).  What gives?  <br><br><br>
Extra info if needed:<br>---------------------------------------<br>Transcode command:<br>/home/jeremy/DVDtranscode.py --chanid %CHANID% --starttime %STARTTIME%<br><br>-------------------------------------------<br>contents of DVDtranscode.py:<br>
#!/usr/bin/env python<br><br>from MythTV import Job, Recorded, System, MythDB, findfile, MythError<br><br>from optparse import OptionParser<br>import sys<br>import os<br><br>################################<br>#### adjust these as needed ####<br>
transcoder = &#39;/usr/bin/ffmpeg&#39;<br>flush_commskip = True<br>build_seektable = True<br>################################<br><br>def runjob(jobid=None, chanid=None, starttime=None):<br>    db = MythDB()<br>    if jobid:<br>
        job = Job(jobid, db=db)<br>        chanid = job.chanid<br>        starttime = job.starttime<br>    rec = Recorded((chanid, starttime), db=db)<br><br>    sg = findfile(rec.basename, rec.storagegroup, db=db)<br>    if sg is None:<br>
        print &#39;Local access to recording not found.&#39;<br>        sys.exit(1)<br><br>    infile = os.path.join(sg.dirname, rec.basename)<br>    outfile = &#39;%s.mpeg&#39; % infile.rsplit(&#39;.&#39;,1)[0]<br>    #### list of segments to be cut<br>
    # rec.markup.gencutlist()<br>    #### list of segments to keep<br>    # rec.markup.genuncutlist()<br><br>    task = System(path=transcoder, db=db)<br>    try:<br>##############################################<br>#### probably need to adjust this one too ####<br>
        output = task(&#39;-y -i &quot;%s&quot; -target ntsc-dvd -async 1 &quot;%s&quot; 2&gt; /dev/null &#39; % (infile, outfile) )<br>##############################################<br>    except MythError, e:<br>        print &#39;Command failed with output:\n%s&#39; % e.stderr<br>
        sys.exit(e.returncode)<br><br>    rec.basename = os.path.basename(outfile)<br>    os.remove(infile)<br>    rec.filesize = os.path.getsize(outfile)<br>    rec.transcoded = 1<br>    rec.seek.clean()<br><br>    if flush_commskip:<br>
        for index,mark in reversed(list(enumerate(rec.markup))):<br>            if mark.type in (rec.markup.MARK_COMM_START, rec.markup.MARK_COMM_END):<br>                del rec.markup[index]<br>        rec.bookmark = 0<br>
        rec.cutlist = 0<br>        rec.markup.commit()<br><br>    if build_seektable:<br>        task = System(path=&#39;mythcommflag&#39;)<br>        task.command(&#39;--chanid %s&#39; % chanid,<br>                     &#39;--starttime %s&#39; % starttime,<br>
                     &#39;--rebuild&#39;)<br><br>    rec.update()<br><br><br>def main():<br>    parser = OptionParser(usage=&quot;usage: %prog [options] [jobid]&quot;)<br><br>    parser.add_option(&#39;--chanid&#39;, action=&#39;store&#39;, type=&#39;int&#39;, dest=&#39;chanid&#39;,<br>
            help=&#39;Use chanid for manual operation&#39;)<br>    parser.add_option(&#39;--starttime&#39;, action=&#39;store&#39;, type=&#39;int&#39;, dest=&#39;starttime&#39;,<br>            help=&#39;Use starttime for manual operation&#39;)<br>
    parser.add_option(&#39;-v&#39;, &#39;--verbose&#39;, action=&#39;store&#39;, type=&#39;string&#39;, dest=&#39;verbose&#39;,<br>            help=&#39;Verbosity level&#39;)<br><br>    opts, args = parser.parse_args()<br>
<br>    if opts.verbose:<br>        if opts.verbose == &#39;help&#39;:<br>            print MythLog.helptext<br>            sys.exit(0)<br>        MythLog._setlevel(opts.verbose)<br><br>    if len(args) == 1:<br>        runjob(jobid=args[0])<br>
    elif opts.chanid and opts.starttime:<br>        runjob(chanid=opts.chanid, starttime=opts.starttime)<br>    else:<br>        print &#39;Script must be provided jobid, or chanid and starttime.&#39;<br>        sys.exit(1)<br>
<br>if __name__ == &#39;__main__&#39;:<br>    main()<br><br><br><br><br><br></div></div>