3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009 Yukikaze
14 def ts2mkv(pin, pout, opt):
15 dir=os.path.split(pout)[0]
16 title=os.path.split(pout)[1]
17 title=os.path.splitext(title)[0]
18 tpavi=os.path.join(dir,title+".avi")
19 tpmkv=os.path.join(dir, title+".mkv")
20 tv2avi.ts2avi(pin, tpavi, opt)
22 avi2mkv(tpavi,tpmkv,opt)
23 def avi2mkv(pin,pout,opt):
25 if re.search("v", opt):
27 exe = configreader.getpath("mkvmerge")
30 wineexe=configreader.getpath("wine")
31 cfr2tc=configreader.getpath("cfr2tc")
32 pin120=pin.replace(".avi",".120.avi")
33 pints=pin.replace(".avi",".ts")
34 pintimecode=pin.replace(".avi",".timecode.txt")
35 pinaac=pin.replace(".avi",".aac")
36 exes.append("ffmpeg -i '"+pints+"' -vn -f aac -acodec copy '"+pinaac+"'")
37 exes.append(wineexe+u" "+cfr2tc+u" '"+"Z:\\"+pin+"' '"+"Z:\\"+pin120+u"' '"+"Z:\\"+pintimecode+u"' 2")
38 exes.append(exe +" -o '"+pout+u"' --forced-track 0:no --timecodes '0:"+pintimecode+"' -d 0 -A -S '"+pin120+"' --sync 0:-225 --forced-track 0:no -a 0 -D -S '"+pinaac+"' --track-order 0:0,1:0")
39 #exes.append(doexe = exe + u" -o '" + pout + u"' --cues 0:all --forced-track 0:no --default-duration 0:120000/1001fps -d 0 -A -S '" + pin + u"' --sync 0:0 --forced-track 0:no -a 0 -D -S '"+pinaac+"' --track-order 0:0,1:0")
41 exes.append(doexe = exe + u" -o '" + pout + u"' --cues 0:all --forced-track 0:no --forced-track 1:no -a 1 -d 0 -S '" + pin + u"' --track-order 0:0,0:1")
42 logo=pout.replace(".mkv",".log")
44 os.environ['LANG']="ja_JP.UTF-8"
47 recdblist.printutf8(e)
51 cmdt=unicode(commands.getoutput(ex.encode('utf-8')),'utf-8')
55 if (isvfr==1 and (not os.path.exists(pin.replace(".avi",".120.avi"))) and (not os.path.exists(pout))):
57 exes.append(doexe = exe + u" -o '" + pout + u"' --cues 0:all --forced-track 0:no --default-duration 0:120000/1001fps -d 0 -A -S '" + pin + u"' --sync 0:0 --forced-track 0:no -a 0 -D -S '"+pinaac+"' --track-order 0:0,1:0")
58 txt=txt+"120fps cfr exection\n"
60 txt=txt+unicode(commands.getoutput(ex.encode('utf-8')),'utf-8')
63 txt = "\n####mkvmerge-log####\n"+txt
65 f.write(txt.encode('utf-8'))