ts2mkv.py

changeset 11
821c02fa7070
parent 10
f436a7f94c6a
child 12
f0c7db3b239d
equal deleted inserted replaced
10:f436a7f94c6a 11:821c02fa7070
141 output: produces internal ffmpeg command list (empty command list on error) 141 output: produces internal ffmpeg command list (empty command list on error)
142 """ 142 """
143 if not self.filename: 143 if not self.filename:
144 return None 144 return None
145 145
146
146 commands = [] 147 commands = []
147 fn = "\\'".join(p for p in self.filename.split("'")) 148 fn = "\\'".join(p for p in self.filename.split("'"))
148 fn = fn.replace(" ", "\\ ") 149 fn = fn.replace(" ", "\\ ")
149 outfn = self.outfilebase + ".mkv" 150 outfn = self.outfilebase + ".mkv"
151 # double-check: pull the kill switch and exit if outfile exists already!
152 # we do not want to overwrite files in accident (caused by automatic file naming)
153 if len(glob.glob(outfn)) > 0:
154 print "Output file exists: %s" % outfn
155 print "NOT overwriting it!"
156 return None
150 outfn = "\\'".join(p for p in outfn.split("'")) 157 outfn = "\\'".join(p for p in outfn.split("'"))
151 outfn = outfn.replace(" ", "\\ ") 158 outfn = outfn.replace(" ", "\\ ")
152 159
153 cmd = ["ffmpeg", 160 cmd = ["ffmpeg",
154 "-ss 00:05:00", "-t 1", # search to 5 minutes, analyze 1 second 161 "-ss 00:05:00", "-t 1", # search to 5 minutes, analyze 1 second
219 print "No suitable audio stream found, aborting." 226 print "No suitable audio stream found, aborting."
220 return None 227 return None
221 228
222 229
223 self.msg_prepare += "Video Stream selected: Stream #%s\n" % v 230 self.msg_prepare += "Video Stream selected: Stream #%s\n" % v
231
232 # TODO: Old dreambox images did a file split: .ts .ts.001 .ts.002 etc.
233 # Find all these files and join them!
234
224 cmd = [ 235 cmd = [
225 "ffmpeg", 236 "ffmpeg",
226 "-i %s" % fn, 237 "-i %s" % fn,
227 "-map %s" % v, 238 "-map %s" % v,
228 ] 239 ]

mercurial