import time
import tv2avi
def ts2x264(pin, pout, opts):#sizeは"HD"か"SD"
- pout = pout.encode('utf-8')
- pin = pin.encode('utf-8')
"""
pinで指定されたファイルをpoutにx264でエンコードして書き出す
"""
txt=txt+commands.getoutput(pas1exe.encode('utf-8'))
print pas2exe
time.sleep(5)
- txt=txt+commands.getoutput(pas2exe.encode('utf-8'))
+ txt=txt+unicode(commands.getoutput(pas2exe.encode('utf-8')),'utf-8')
else:
pas1exe = "mencoder \'" + pin + "\' -quiet -ovc x264 " + encvf + " -ofps 30000/1001 -x264encopts " + bitrate + ":threads=auto -oac mp3lame -lameopts cbr:br=128 -o \'" + pout + "\'"
pas1exe = "nice -n 19 " + pas1exe
print pas1exe
- txt=txt+commands.getoutput(pas1exe.encode('utf-8'))
+ txt=txt+unicode(commands.getoutput(pas1exe.encode('utf-8')),'utf-8')
logo=pin
logo=logo.replace(".sa.avi",".ts")
logo=logo.replace(".ts",".log")
pentaaudio = 1
if re.search("d", opt):
dualaudio = 1
- if re.search("\[二\]", pout):
+ if re.search(u"\[二\]", pout):
dualaudio = 1
- elif re.search('(二)', pout):
+ elif re.search(u'(二)', pout):
dualaudio = 1
- elif re.search('\(二\)', pout):
+ elif re.search(u'\(二\)', pout):
dualaudio = 1
if opt == "":
opts = ""
pentaaudio = 1
if re.search("d", opt):
dualaudio = 1
- if re.search('\[二\]', pout):
+ if re.search(u'\[二\]', pout):
dualaudio = 1
- elif re.search('(二)', pout):
+ elif re.search(u'(二)', pout):
dualaudio = 1
- elif re.search('\(二\)', pout):
+ elif re.search(u'\(二\)', pout):
dualaudio = 1
opts = ""
if chdb.chtxtsearch(chtxt)['bctype'] == 'cs':
pentaaudio = 1
if re.search("d", opt):
dualaudio = 1
- if re.search('\[二\]', pout):
+ if re.search(u'\[二\]', pout):
dualaudio = 1
- elif re.search('(二)', pout):
+ elif re.search(u'(二)', pout):
dualaudio = 1
- elif re.search('\(二\)', pout):
+ elif re.search(u'\(二\)', pout):
dualaudio = 1
if opt == "":
opts = ""
if os.path.exists(videopath):
os.remove(videopath)
def mkv2mp4(pin,pout):
- exeb = configreader.getpath("mkvextract")
- exe = configreader.getpath("MP4Box")
+ exeb = configreader.getpath(u"mkvextract")
+ exe = configreader.getpath(u"MP4Box")
dir=os.path.split(pin)[0]
title=os.path.split(pin)[1]
title=os.path.splitext(title)[0]
- audiopath=os.path.join(dir,title+"_audio.mp3")
+ audiopath=os.path.join(dir,title+u"_audio.mp3")
if not os.path.exists(audiopath):
- if os.path.exists(os.path.join(dir,title+"_audio.raw")):
- audiopath=os.path.join(dir,title+"_audio.raw")
- if os.path.exists(os.path.join(dir,title+"_audio.aac")):
- audiopath=os.path.join(dir,title+"_audio.aac")
- videopath=os.path.join(dir,title+"_video.h264")
+ if os.path.exists(os.path.join(dir,title+u"_audio.raw")):
+ audiopath=os.path.join(dir,title+u"_audio.raw")
+ if os.path.exists(os.path.join(dir,title+u"_audio.aac")):
+ audiopath=os.path.join(dir,title+u"_audio.aac")
+ videopath=os.path.join(dir,title+u"_video.h264")
#doexe = exe.encode('utf-8') + u' \"' + pin.encode('utf-8') + u'\" \"' + pout.encode('utf-8') + u'\"'
- exe0=exeb+" tracks \'"+pin+"\' 1:\'"+videopath+"\' 2:\'"+audiopath+"\'"
- exe1=exe+" -aviraw audio \'"+pin+"\'"
- exe2=exe+" -aviraw video \'"+pin+"\'"
- exefin=exe+" -new -fps 29.97 -add \'"+videopath+"\'#video -add \'"+audiopath+"\'#audio \'"+pout+"\'"
+ exe0=exeb+u" tracks \'"+pin+u"\' 1:\'"+videopath+u"\' 2:\'"+audiopath+u"\'"
+ exe1=exe+u" -aviraw audio \'"+pin+u"\'"
+ exe2=exe+u" -aviraw video \'"+pin+u"\'"
+ exefin=exe+u" -new -fps 29.97 -add \'"+videopath+u"\'#video -add \'"+audiopath+u"\'#audio \'"+pout+u"\'"
logo=pin.replace(".avi",".log")
os.environ['LANG']="ja_JP.UTF-8"
txt= exe0+"\n"+exe1+"\n"+exe2+"\n"+exefin+"\n"
- txt = txt+commands.getoutput(exe0.encode('utf-8'))
- txt = txt+commands.getoutput(exe1.encode('utf-8'))
- txt = txt+commands.getoutput(exe2.encode('utf-8'))
- txt = txt+commands.getoutput(exefin.encode('utf-8'))
+ txt = txt+unicode(commands.getoutput(exe0.encode('utf-8')),'utf-8')
+ txt = txt+unicode(commands.getoutput(exe1.encode('utf-8')),'utf-8')
+ txt = txt+unicode(commands.getoutput(exe2.encode('utf-8')),'utf-8')
+ txt = txt+unicode(commands.getoutput(exefin.encode('utf-8')),'utf-8')
os.remove(audiopath)
os.remove(videopath)
txt = "\n####MKV2MP4-log####\n"+txt