ts2mkv.py

changeset 12
f0c7db3b239d
parent 11
821c02fa7070
child 13
cf5c5cec1b2b
equal deleted inserted replaced
11:821c02fa7070 12:f0c7db3b239d
229 229
230 self.msg_prepare += "Video Stream selected: Stream #%s\n" % v 230 self.msg_prepare += "Video Stream selected: Stream #%s\n" % v
231 231
232 # TODO: Old dreambox images did a file split: .ts .ts.001 .ts.002 etc. 232 # TODO: Old dreambox images did a file split: .ts .ts.001 .ts.002 etc.
233 # Find all these files and join them! 233 # Find all these files and join them!
234 inputs = [fn]
235 if os.path.splitext(fn)[1].lower() == '.ts':
236 for fpart in glob.glob(self.filename + '.' + ('[0-9]' * 3)):
237 fn = "\\'".join(p for p in fpart.split("'"))
238 fn = fn.replace(" ", "\\ ")
239 inputs.append(fn)
240 #inputs.append(shlex.split(fpart))
241
242 if len(inputs) > 1:
243 # use ffmpeg input concat function
244 # attention, ffmpeg doesnt like escape sequences
245 fn = "\"concat:" + \
246 "|".join(inputs)\
247 .replace('\ ', ' ')\
248 .replace("\'", "'")\
249 + "\""
250
251 idx = 0
252 for tmp in inputs:
253 self.msg_prepare += "Input file #%i: %s\n" % (
254 idx, os.path.basename(tmp))
255 idx += 1
234 256
235 cmd = [ 257 cmd = [
236 "ffmpeg", 258 "ffmpeg",
237 "-i %s" % fn, 259 "-i %s" % fn,
238 "-map %s" % v, 260 "-map %s" % v,

mercurial