[mythtv-users] cutlist parsing help needed.
Raymond Wagner
raymond at wagnerrp.com
Sat Nov 27 18:58:25 UTC 2010
On 11/27/2010 13:48, belcampo wrote:
> Thank you very much for your script. I do have to rephrase my question
> a little bit.
> Because I do have 6 PCs for transcoding, it would be nice to get an
> amount of individual ffmpeg commandlines which I could feed to a
> 'free' PC to do the job, instead of serial execution.
Now requires a third 'cut index' argument on the command line. Also
fixed that it should be using 'getuncutlist()'.
Raymond Wagner wrote:
> from MythTV import Recorded, System, findfile, MythLog
> import sys
>
> # pull command line inputs
> if len(sys.argv) < 4:
> raise Exception('CHANID, STARTTIME, and CUT must be provided on
> the command line')
> rec = Recorded(sys.argv[1:3])
> cut = int(sys.argv[3])
> MythLog._setlevel('important,general,file')
>
> # estimate framerate
> rate = rec.seek[-1].mark/float((rec.endtime-rec.starttime).seconds)
> rates = [24000./1001.,25,30000./1001.,50,60000./1001.]
> diff = [abs(f-rate) for f in rates]
> rate = rates[diff.index(min(diff))]
>
> # start transcoding
> sg = findfile(rec.basename,rec.storagegroup)
> ffmpeg = System(path='/usr/bin/ffmpeg')
> ffmpeg.append('-i', sg.dirname+rec.basename)
> ffmpeg.append('#### all your other options here ####')
> cutlist = rec.markup.getuncutlist():
> if (len(cutlist) < cut) or (cut <= 0):
> raise Exception('Invalid cut index given on the command line')
> start,stop = cutlist[cut+1]:
> ffmpeg.command('-ss',start/rate,
> '-vframes',stop-start,
> 'split_rec.%d.mp4' % start)
> if ffmpeg.returncode:
> print 'FFMPEG failed with error code: %d' % ffmpeg.returncode
> print ffmpeg.stderrr
> sys.exit(1)
More information about the mythtv-users
mailing list