h264 transcode script problem with utcisoformat

For discussion of topics specific to MythTV on linux
Post Reply
pabentdahl
Newcomer
Posts: 1
Joined: Sun Jan 17, 2016 3:09 am
United States of America

h264 transcode script problem with utcisoformat

Post by pabentdahl » Sun Jan 17, 2016 4:04 am

I've been using the Mythbuntu Linux implementation of MythTV as a backend to multiple Kodi frontends. It's been great for serving up live and recorded broadcasts from my HD Homerun. Now I'd like to start transcoding some of my recordings to h264. I've been trying to get the transcode-h264.py script on MythTV's site at https://www.mythtv.org/wiki/Transcode_Mpeg2_to_H264 to work. I can't get it to run because it doesn't like the use of utcisoformat in the script. As I understand it that line of the script is converting the local start time of the recording to the UTC time. This is the error that's produced:

Code: Select all

Traceback (most recent call last):
  File "./transcode-h264.py", line 149, in <module>
    main()
  File "./transcode-h264.py", line 143, in main
    runjob(chanid=opts.chanid, starttime=opts.starttime)
  File "./transcode-h264.py", line 40, in runjob
    starttime = str(starttime.utcisoformat().replace(u':', '').replace(u' ', '').replace(u'T', '').replace('-', ''))
AttributeError: 'int' object has no attribute 'utcisoformat'
I've tried search variations on python, mythtv and utcisoformat but I can't find where that attribute is defined. As a test I commented out the utcisoformat line and hardcoded the UTC value it should have produced (ex. 20160109193700). I successfully transcoded a recording and I can see and play the transcoded video through my Kodi frontend. That's telling me I supplied the correct parameters to the script. As an example these are the parameters I used for the test:

Code: Select all

./transcode-h264.py --chanid=1021 --starttime=20160109133700 --verbose all
Since this script is posted on the MythTV site a solution would probably benefit a lot of people that come across it from a search result. Thanks!

User avatar
dizygotheca
Developer
Posts: 266
Joined: Wed Sep 03, 2014 9:02 am
Great Britain

Re: h264 transcode script problem with utcisoformat

Post by dizygotheca » Mon Jan 18, 2016 10:51 pm

utcisoformat is a method of MythTV.datetime (MythTV/utility/dt.py).

The original transcode script only used the (int) starttime to create a Recorded() object. This script assumes it's a datetime when formatting it for mythtranscode.
When run as a job it will work because job.starttime does return a datetime object but running from the command line has probably never worked.

You could fix it by converting starttime from an int to a datetime;

Code: Select all

    ...
    if jobid:
        job = Job(jobid, db=db)
        chanid = job.chanid
        starttime = job.starttime
    else:
        starttime = MythTV.datetime.duck(starttime)
    ...

daraden
Senior
Posts: 169
Joined: Tue Feb 23, 2016 7:33 am
United States of America

Re: h264 transcode script problem with utcisoformat

Post by daraden » Wed Mar 09, 2016 3:49 am

you could just run the job with %jobid% or you need to add --tzoffset after --starttime

Code: Select all

./transcode-h264.py --chanid=1021 --starttime=20160109133700 --tzoffset -8 --verbose all

Post Reply