OSDN Git Service

fix mkv2mp4.
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Mon, 21 Dec 2009 12:25:12 +0000 (12:25 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Mon, 21 Dec 2009 12:25:12 +0000 (12:25 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@328 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/tv2mp4.py

index 6076742..2abd12f 100644 (file)
@@ -125,27 +125,26 @@ def avi2mp4(pin,pout,opt):
 def mkv2mp4(pin,pout):
     exeb = configreader.getpath(u"mkvextract")
     exe = configreader.getpath(u"MP4Box")
+    dtsedit=configreader.getpath("DtsEdit")
+    wineexe=configreader.getpath("wine")
     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.mp3")
-    if not os.path.exists(audiopath):
-        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")
+    audiopath=os.path.join(dir,title+u"_audio.raw")
     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'\"'
+    timecodepath=os.path.join(dir,title+u"_1_timecode.txt")
+    tmpmp4=os.path.join(dir,title+u".tmp.mp4")
     exe0=exeb+u" tracks \'"+pin+u"\' 1:\'"+videopath+u"\' 2:\'"+audiopath+u"\'"
-
-    exefin=exe+u" -new -fps 29.970030 -add \'"+videopath+u"\'#video -add \'"+audiopath+u"\'#audio \'"+pout+u"\'"
+    exe1=exeb+u" timecodes_v2 \'"+pin+"\' 1:\'"+timecodepath+"\'"
+    exe2=exe+u" -new -fps 29.970030 -add \'"+videopath+u"\'#video -add \'"+audiopath+u"\'#audio \'"+tmpmp4+u"\'"
+    exe3=wineexe+u" "+dtsedit+u" -tc \'Z:\\"+timecodepath+u"\' \'Z:\\"+tmpmp4+"\' -o \'Z:\\"+pout+"\'"
     logo=pin.replace(".avi",".log")
     os.environ['LANG']="ja_JP.UTF-8"
-    txt= exe0+"\n"+exe1+"\n"+exe2+"\n"+exefin+"\n"
+    txt= exe0+"\n"+exe1+"\n"+exe2+"\n"+exe3+"\n"
     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')
+    txt = txt+unicode(commands.getoutput(exe3.encode('utf-8')),'utf-8')
     os.remove(audiopath)
     os.remove(videopath)
     txt = "\n####MKV2MP4-log####\n"+txt