dir=os.path.split(pin)[0]
title=os.path.split(pin)[1]
title=os.path.splitext(title)[0]
- audiopath=os.path.join(dir,title+u"_audio.raw")
- videopath=os.path.join(dir,title+u"_video.264")
+ etitle=base64.b16encode(title)
+ audiopath=os.path.join(dir,etitle+u"_audio.raw")
+ videopath=os.path.join(dir,etitle+u"_video.264")
exes=[]
os.environ['LANG']="ja_JP.UTF-8"
txt=""
wineexe=configreader.getpath("wine")
cfr2tc=configreader.getpath("cfr2tc")
dtsedit=configreader.getpath("DtsEdit")
- pin120=pin.replace(".avi",".120.avi")
- pints=pin.replace(".avi",".ts")
- pmp4=pin.replace(".avi",".tmp.mp4")
- pintimecode=pin.replace(".avi",".timecode.txt")
- pinaac=pin.replace(".avi",".aac")
+ pin120=os.path.join(dir,etitle+u".120.avi")
+ pints=os.path.join(dir,title+u".ts")
+ pmp4=os.path.join(dir,etitle+u".tmp.mp4")
+ pmp42=os.path.join(dir,etitle+u".tmp2.mp4")
+ pintimecode=os.path.join(dir,etitle+u".timecode.txt")
+ pinaac=os.path.join(dir,etitle+u".aac")
evfr=[]
evfr.append("ffmpeg -i '"+pints+"' -vn -f aac -acodec copy '"+pinaac+"'")
evfr.append(wineexe+u" "+cfr2tc+u" '"+"Z:\\"+pin+"' '"+"Z:\\"+pin120+u"' 'Z:\\"+pintimecode+u"' 2")
evfr.append(exe+u" -aviraw video \'"+pin120+u"\'")
- videotpath=os.path.join(dir,title+u".120_video.264")
+ videotpath=os.path.join(dir,etitle+u".120_video.264")
evfr.append(exe+u" -fps 29.970030 -add \'"+videotpath+"\' -add \'"+pinaac+"\' -new \'"+pmp4+"\'")
- #evfr.append(exe+u" -add \'"+pinaac+"\' \'"+pmp4+"\'")
- evfr.append(wineexe+u" "+dtsedit+u" -tc \'Z:\\"+pintimecode+u"\' \'Z:\\"+pmp4+"\' -o \'Z:\\"+pout+"\'")
+ evfr.append(wineexe+u" "+dtsedit+u" -tc \'Z:\\"+pintimecode+u"\' \'Z:\\"+pmp4+"\' -o \'Z:\\"+pmp42+"\'")
+ evfr.append(exe+u" -add \'"+pinaac+"\' \'"+pmp42+"\'")
exes=evfr
for e in exes:
recdblist.printutf8(e)
txt=txt+unicode(commands.getoutput(e.encode('utf-8')),'utf-8')
except:
""
+ try:
+ shutil.move(pmp42,pout)
+ except:
+ ""
if (not os.path.exists(pin.replace(".avi",".120.avi"))and (not os.path.exists(pout))):
txt=txt+"CFR2TC error. maybe avi file is over 1GB.(ODML error would have happend.)"
ptmp=pin.replace(".avi",".noodml.avi")
ex2="nice -n 17 "+e2
e3=exe+u" -aviraw video \'"+pin120+u"\'"
ex3="nice -n 17 "+e3
- e4=exe+u" -fps 29.97 -add \'"+videotpath+"\' -add \'"+pinaac+"\' -new \'"+pmp4+"\'"
+ e4=exe+u" -fps 29.97 -add \'"+videotpath+"\' -new \'"+pmp4+"\'"
ex4="nice -n 17 "+e4
- e5=wineexe+u" "+dtsedit+u" -tc \'Z:\\"+pintimecode+u"\' \'Z:\\"+pmp4+"\' -o \'Z:\\"+pout+"\'"
+ e5=wineexe+u" "+dtsedit+u" -tc \'Z:\\"+pintimecode+u"\' \'Z:\\"+pmp4+"\' -o \'Z:\\"+pmp42+"\'"
ex5="nice -n 17 "+e5
+ e6=exe+u" -add \'"+pinaac+"\' \'"+pmp42+"\'"
+ ex6="nice -n 17 "+e6
recdblist.printutf8(e)
txt=txt+e+"\n"
try:
cmdt=unicode(commands.getoutput(ex.encode('utf-8')),'utf-8')
- cmdt=cmdt+unicode(commands.getoutput(ex2.encode('utf-8')),'utf-8')
- cmdt=cmdt+unicode(commands.getoutput(ex3.encode('utf-8')),'utf-8')
- cmdt=cmdt+unicode(commands.getoutput(ex4.encode('utf-8')),'utf-8')
- cmdt=cmdt+unicode(commands.getoutput(ex5.encode('utf-8')),'utf-8')
+ except:
+ ""
+ try:
+ cmdt=unicode(commands.getoutput(ex2.encode('utf-8')),'utf-8')
+ except:
+ ""
+ try:
+ cmdt=unicode(commands.getoutput(ex3.encode('utf-8')),'utf-8')
+ except:
+ ""
+ try:
+ cmdt=unicode(commands.getoutput(ex4.encode('utf-8')),'utf-8')
+ except:
+ ""
+ try:
+ cmdt=unicode(commands.getoutput(ex5.encode('utf-8')),'utf-8')
+ except:
+ ""
+ try:
+ cmdt=unicode(commands.getoutput(ex6.encode('utf-8')),'utf-8')
+ except:
+ ""
+ try:
os.remove(ptmp)
except:
""
- txt=txt+cmdt+"\n"
- else:
- exes.append(exe+u" -aviraw audio \'"+pin+u"\'")
- exes.append(exe+u" -aviraw video \'"+pin+u"\'")
- if os.path.exists(audiopath):
- if os.path.exists(os.path.join(dir,title+u"_audio.mp3")):
- audiopath=os.path.join(dir,title+u"_audio.mp3")
- elif os.path.exists(os.path.join(dir,title+u"_audio.aac")):
- audiopath=os.path.join(dir,title+u"_audio.aac")
- exes.append(exe+u" -fps 29.970030 -add \'"+videopath+u"\' -add \'"+audiopath+u"\' -new \'"+pout+u"\'")
- for e in exes:
- recdblist.printutf8(e)
- txt=txt+e+"\n"
try:
- txt=txt+unicode(commands.getoutput(e.encode('utf-8')),'utf-8')
+ shutil.move(pmp42,pout)
except:
""
+ txt=txt+cmdt+"\n"
+ else:
+ try:
+ shutil.move(pin,os.path.join(dir,etitle+".avi"))
+ except:
+ ""
+ e0=exe+u" -aviraw audio \'"+os.path.join(dir,etitle+".avi")+u"\'"
+ e1=exe+u" -aviraw video \'"+os.path.join(dir,etitle+".avi")+u"\'"
+ os.system(e0)
+ os.system(e1)
+ if os.path.exists(audiopath):
+ if os.path.exists(os.path.join(dir,etitle+u"_audio.mp3")):
+ audiopath=os.path.join(dir,etitle+u"_audio.mp3")
+ elif os.path.exists(os.path.join(dir,etitle+u"_audio.aac")):
+ audiopath=os.path.join(dir,etitle+u"_audio.aac")
+ ptmp=os.path.exists(os.path.join(dir,etitle+u".mp4"))
+ e2=exe+u" -fps 29.970030 -add \'"+videopath+u"\' -add \'"+audiopath+u"\' -new \'"+ptmp+u"\'"
+ os.system(e2)
+ shutil.move(ptmp,pout)
logo=pin.replace(u".avi",u".log")
txt = "\n####MP4Box-log####\n"+txt
f=open(logo,'a')