[mythtv-users] cutlist parsing help needed.

belcampo belcampo at zonnet.nl
Sat Nov 27 18:48:22 UTC 2010


Raymond Wagner wrote:
> On 11/27/2010 10:36, belcampo wrote:
>> I have an almost 6 hour Manual recording, several programs, with 
>> following cutlist.
>> 0-14893,50509-63697,131041-142393,226249-238405,276157-287713,364849-375277,393373-532455 
>>
>>
>> I would like to have 6 individual recordings of them.
>>
>> 1st resulting file I should get with:
>> ffmpeg -ss (14893*.04) -vframes (50509-14893) -i source.mpg 'several 
>> options' program1.mp4
>>
>> 2nd
>> ffmpeg -ss (63697*.04) -vframes (131041-63697) -i source.mpg 'several 
>> options' program2.mp4
> 
> For example, a python implementation:
> 
> 
> ##### starts here #####
> from MythTV import Recorded, System, findfile, MythLog
> import sys
> 
> # pull command line inputs
> if len(sys.argv) < 3:
>     raise Exception('CHANID and STARTTIME must be provided on the 
> command line')
> rec = Recorded(sys.argv[1: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 ####')
> for start,stop in rec.markup.getcutlist():
>     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)
> 
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.
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users



More information about the mythtv-users mailing list