Ticket #3222: mythburn.py.diff
File mythburn.py.diff, 4.1 KB (added by , 17 years ago) |
---|
-
mythburn.py
old new 1350 1350 fatalError("Failed while running ffmpeg (Pass 2) to re-encode video.\n" 1351 1351 "Command was %s" % command) 1352 1352 1353 def encodeNuvToMPEG2(chanid, starttime, destvideofile, folder, profile, usecutlist):1353 def encodeNuvToMPEG2(chanid, starttime, mediafile, destvideofile, folder, profile, usecutlist): 1354 1354 """Encodes a nuv video source file to MPEG2 video and AC3 audio, using mythtranscode & ffmpeg""" 1355 1355 1356 1356 # make sure mythtranscode hasn't left some stale fifos hanging around … … 1391 1391 if name == "-s": 1392 1392 outvideores = value 1393 1393 1394 if (usecutlist == True): 1394 if chanid != -1: 1395 if (usecutlist == True): 1396 PID=os.spawnlp(os.P_NOWAIT, "mythtranscode", "mythtranscode", 1397 '-p', '27', 1398 '-c', chanid, 1399 '-s', starttime, 1400 '--honorcutlist', 1401 '-f', folder) 1402 write("mythtranscode started (using cut list) PID = %s" % PID) 1403 else: 1404 PID=os.spawnlp(os.P_NOWAIT, "mythtranscode", "mythtranscode", 1405 '-p', '27', 1406 '-c', chanid, 1407 '-s', starttime, 1408 '-f', folder) 1409 1410 write("mythtranscode started PID = %s" % PID) 1411 elif mediafile != -1: 1395 1412 PID=os.spawnlp(os.P_NOWAIT, "mythtranscode", "mythtranscode", 1396 '-p', '27', 1397 '-c', chanid, 1398 '-s', starttime, 1399 '--honorcutlist', 1400 '-f', folder) 1401 write("mythtranscode started (using cut list) PID = %s" % PID) 1413 '-p', '27', 1414 '-i', mediafile, 1415 '-f', folder) 1416 write("mythtranscode started (using file) PID = %s" % PID) 1402 1417 else: 1403 PID=os.spawnlp(os.P_NOWAIT, "mythtranscode", "mythtranscode", 1404 '-p', '27', 1405 '-c', chanid, 1406 '-s', starttime, 1407 '-f', folder) 1408 1409 write("mythtranscode started PID = %s" % PID) 1418 fatalError("no video source passed to encodeNuvToMPEG2.\n") 1410 1419 1411 1420 1412 1421 samplerate, channels = getAudioParams(folder) … … 3148 3157 3149 3158 write("Re-encoding audio and video from nuv file") 3150 3159 3151 # Run from local file?3152 if file.hasAttribute("localfilename"):3153 mediafile = file.attributes["localfilename"].value3154 3155 3160 # what encoding profile should we use 3156 3161 if file.hasAttribute("encodingprofile"): 3157 3162 profile = file.attributes["encodingprofile"].value 3158 3163 else: 3159 3164 profile = defaultEncodingProfile 3160 3165 3161 chanid = getText(infoDOM.getElementsByTagName("chanid")[0]) 3162 starttime = getText(infoDOM.getElementsByTagName("starttime")[0]) 3163 usecutlist = (file.attributes["usecutlist"].value == "1" and 3164 getText(infoDOM.getElementsByTagName("hascutlist")[0]) == "yes") 3165 3166 #do the re-encode 3167 encodeNuvToMPEG2(chanid, starttime, os.path.join(folder, "newfile2.mpg"), folder, 3168 profile, usecutlist) 3166 if file.attributes["type"].value == "recording": 3167 mediafile = -1 3168 chanid = getText(infoDOM.getElementsByTagName("chanid")[0]) 3169 starttime = getText(infoDOM.getElementsByTagName("starttime")[0]) 3170 usecutlist = (file.attributes["usecutlist"].value == "1" and 3171 getText(infoDOM.getElementsByTagName("hascutlist")[0]) == "yes") 3172 else: 3173 chanid = -1 3174 starttime = -1 3175 usecutlist = -1 3176 3177 encodeNuvToMPEG2(chanid, starttime, mediafile, os.path.join(folder, "newfile2.mpg"), folder, 3178 profile, usecutlist) 3169 3179 mediafile = os.path.join(folder, 'newfile2.mpg') 3170 3180 else: 3171 3181 #we need to re-encode the file, make sure we get the right video/audio streams