OSDN Git Service

implement videoframe compliment option.
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Sun, 24 Oct 2010 08:52:04 +0000 (08:52 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Sun, 24 Oct 2010 08:52:04 +0000 (08:52 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@700 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/rec10.conf
rec10/trunk/src/recdblist.py
rec10/trunk/src/timerec.py
rec10/trunk/src/ts2x264.py
rec10/trunk/src/tv2audio.py
rec10/trunk/src/tv2avi.py
rec10/trunk/src/tv2mp4.py

index 70cb667..16227ff 100644 (file)
@@ -2,7 +2,6 @@
 recpt1 = /usr/local/bin/recpt1
 wine = /usr/bin/wine
 x264 = /usr/bin/x264
-xvfb-run = /usr/local/share/rec10/tstools/xvfb-run
 mencoder = /usr/bin/mencoder
 ffmpeg = /usr/bin/ffmpeg
 rec10 = /usr/local/share/rec10
index 86e2652..d1b2dc9 100644 (file)
@@ -73,6 +73,9 @@ REC_AUTO_SUGGEST_AP2FP = "auto_suggest_ap2fp"
 REC_AUTO_KEYWORD = "auto_keyword"
 REC_BAYES_SUGGEST ="bayes_suggest"
 
+global BONTSDEMUX_DELAY
+bon_ts_demux_delay="0"
+
 version = 98
 version_str="0.9.8"
 
index 9666af0..8ad8c26 100644 (file)
@@ -19,6 +19,7 @@ import epgdb
 import rec10d
 import recdb
 import status
+import tv2audio
 import tv2avi
 import tv2mkv
 import tv2mp4
@@ -568,7 +569,7 @@ def type_encode_que(typetxt,chtxt,title,bt,et,opt):
                     paac2 = recpath + "/" + title + "_2.aac"
                     pmp32 = recpath + "/" + title + "_2.mp3"
                     if not os.path.exists(paac2) and not os.path.exists(pmp32):
-                        tv2avi.dualaudio2sep(os.path.join(recpath, title+".ts"),"167")
+                        tv2audio.ts2dualaudio_BonTsDemux(os.path.join(recpath, title+".ts"),recdblist.BONTSDEMUX_DELAY,opt)
                 time.sleep(3)
             elif re.search("5", opt):
                 pin = recpath + "/" + title + ".m2v"
@@ -576,15 +577,7 @@ def type_encode_que(typetxt,chtxt,title,bt,et,opt):
                     paac2 = recpath + "/" + title + "_2.aac"
                     pmp32 = recpath + "/" + title + "_2.mp3"
                     if not os.path.exists(paac2) and not os.path.exists(pmp32):
-                        tv2avi.pentaaudio2sep(os.path.join(recpath, title+".ts"))
-                time.sleep(3)
-            elif re.search("b", opt):
-                pin = recpath + "/" + title + ".m2v"
-                if not os.path.exists(pin) or os.path.getsize(pin)<100*1000:
-                    paac2 = recpath + "/" + title + "_1.aac"
-                    pmp32 = recpath + "/" + title + "_1.mp3"
-                    if not os.path.exists(paac2) and not os.path.exists(pmp32):
-                        tv2avi.singleaudio2sep(os.path.join(recpath, title+".ts"))
+                        tv2audio.ts2pentaaudio_BonTsDemux(os.path.join(recpath, title+".ts"), recdblist.BONTSDEMUX_DELAY, opt)
                 time.sleep(3)
             makeMP4=0
             try:
index 2263665..00a8306 100644 (file)
@@ -63,18 +63,10 @@ def ts2x264(pin, pout, opts):#sizeは"HD"か"SD"
     if re.search("p",opts):
         crf=crf-2
     if re.search("d",opts):#二カ国語放送の場合
-        encode_ffmpeg_sar(pin,pout,size,is24fps,quality,crf,deinterlace)
-    elif re.search("5",opts):#5.1chの場合
-        encode_ffmpeg_sar(pin,pout,size,is24fps,quality,crf,deinterlace)
-    elif re.search("b",opts):#m2vテスト
-        try:
-            tm2v=pin.replace(".ts",".m2v")
-            encode_sar(tm2v, pout,size,is24fps,quality,crf,deinterlace)
-        except Exception, inst:
-            recdblist.Commonlogex("Error", "ts2x264(ts2x264.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)
-    elif re.search("x",opts):#videoframe補完テスト
         tm2v=pin.replace(".ts",".m2v")
         encode_ffmpeg_sar(tm2v,pout,size,is24fps,quality,crf,deinterlace)
+    elif re.search("5",opts):#5.1chの場合
+        encode_ffmpeg_sar(pin,pout,size,is24fps,quality,crf,deinterlace)
     else:
         try:
             encode_sar(pin, pout,size,is24fps,quality,crf,deinterlace)
index 6fb55d0..84f9384 100644 (file)
@@ -120,11 +120,7 @@ def ts2singlewav(pts,opts):
     bonpout = "Z:\\" + outf[1:]
     xvfb = configreader.getpath('xvfb-run')
     vf=""
-    delayt="-delay 167 "
-    if re.search(",",opts):
-        vf="-vf "
-    if re.search(".",opts):
-        delayt=""
+    delayt=""
     exe = 'wine ' + bontsdemux + " -i \"" + bonpin + "\" "+delayt+" -nd "+vf+"-sound 0 -o \"" + bonpout + "\" -start -quit"
     #recdblist.printutf8(exe)
     exe = xvfb + ' -a ' + exe
@@ -166,21 +162,17 @@ def ts2single_mp3_BonTsDemux(pts,opts):
     aout=pts.replace(".ts",".mp3")
     ain=pts.replace(".ts",".wav")
     wav2mp3_lame(ain,aout)
-def dualaudio2sep(pin, delay,opts):
+def ts2dualaudio_BonTsDemux(pin, delay,opts):
     """
     delay is string
     """
-    xvfb = configreader.getpath('xvfb-run')
     bontsdemux = configreader.getpath('bontsdemux')
     wine = configreader.getpath('wine')
     bonpin = "Z:\\" + pin[1:]
     outf = os.path.splitext(pin)[0]
     bonpout = "Z:\\" + outf[1:]
-    if re.search(",",opts):
-        vf="-vf "
     exe = wine + ' ' + bontsdemux + " -i \"" + bonpin + "\" -delay " + delay + " -nd "+vf+"-sound 1 -o \"" + bonpout + "\" -start -quit"
     recdblist.printutf8(exe)
-    exe = xvfb + ' -a ' + exe
     txt=commands.getoutput(exe.encode('utf-8'))
     try:
         recdblist.addCommandLog(pin, u"BonTsDemux 第一音声取り出し", exe, txt)
@@ -193,7 +185,7 @@ def dualaudio2sep(pin, delay,opts):
     ffpout2 = ffpin + "_2.wav"
     ffpout3 = ffpin + ".m2v"
     shutil.move(ffpin1, ffpout1)
-    exe = 'wine ' + bontsdemux + " -i \"" + bonpin + "\" -delay " + delay + " -nd  "+vf+"-sound 2 -encode Demux\(wav\) -o \"" + bonpout + "\" -start -quit"
+    exe = 'wine ' + bontsdemux + " -i \"" + bonpin + "\" -delay " + delay + " -nd  "+vf+"-sound 2 -encode Demux\(wav\) -o \"" + bonpout + "\""
     recdblist.printutf8(exe)
     exe = xvfb + ' -a ' + exe
     txt=commands.getoutput(exe.encode('utf-8'))
@@ -223,15 +215,13 @@ def dualaudio2sep(pin, delay,opts):
     time.sleep(3)
     os.remove(ffpout1)
     os.remove(ffpout2)
-def pentaaudio2sep(pin):
+def ts2pentaaudio_BonTsDemux(pin, delay,opts):
     bontsdemux = configreader.getpath('bontsdemux')
     wine = configreader.getpath('wine')
-    xvfb = configreader.getpath('xvfb-run')
     bonpin = "Z:\\" + pin[1:]
     outf = os.path.splitext(pin)[0]
     bonpout = "Z:\\" + outf[1:]
-    exe = wine + ' ' + bontsdemux + " -i \"" + bonpin + "\" -delay 167 -nd -sound 3 -o \"" + bonpout + "\" -start -quit"
-    exe = xvfb + ' -a ' + exe
+    exe = wine + ' ' + bontsdemux + " -i \"" + bonpin + "\" -delay "+delay+" -nd -sound 3 -o \"" + bonpout + "\""
     recdblist.printutf8(exe)
     txt=commands.getoutput(exe.encode('utf-8'))
     try:
@@ -264,7 +254,7 @@ def pentaaudio2sep(pin):
     else:
         wav2mp3_lame(ffpout1, ffpout21)
     if not os.path.exists(ffpout21):
-        exe = wine + ' ' + bontsdemux + " -i \"" + bonpin + "\" -delay 167 -nd -sound 0 -o \"" + bonpout + "\" -start -quit"
+        exe = wine + ' ' + bontsdemux + " -i \"" + bonpin + "\" -delay "+delay+" -nd -sound 0 -o \"" + bonpout + "\""
         exe = xvfb + ' -a ' + exe
         recdblist.printutf8(exe)
         txt=commands.getoutput(exe.encode('utf-8'))
@@ -282,4 +272,4 @@ def pentaaudio2sep(pin):
     ffpout21=ffpout1.replace(".wav",".aac")
     if os.path.exists(ffpout21):
         if os.path.getsize(ffpout21)>10*1000*1000:
-            os.remove(ffpout1)
\ No newline at end of file
+            os.remove(ffpout1)
index b1b157a..f0a3bd1 100644 (file)
@@ -71,14 +71,10 @@ def b252ts(pout, chtxt, btime, etime, opt):
             dualaudio = 1
         elif re.search(u'\(二\)', pout):
             dualaudio = 1
-        elif re.search("b",opt):
-            singleaudiosplit = 1
         if dualaudio == 1:
-            dualaudio2sep(aviin,"167")
+            tv2audio.ts2dualaudio_BonTsDemux(aviin, recdblist.BONTSDEMUX_DELAY, opt)
         if pentaaudio == 1:
-            pentaaudio2sep(aviin)
-        if singleaudiosplit ==1:
-            singleaudio2sep(aviin)
+            tv2audio.ts2pentaaudio_BonTsDemux(aviin, recdblist.BONTSDEMUX_DELAY, opt)
     except Exception, inst:
         recdblist.Commonlogex("Error", "b252ts(tv2avi.py)", str(type(inst))+traceback.format_exc(), str(inst))
     status.changeB25Decoding(-1)
@@ -100,163 +96,4 @@ def ts2raw(pin, pout, opt):
         recdblist.printutf8(str(type(inst)))
         recdblist.printutf8(str(inst)+traceback.format_exc())
     status.changeEncoding(-1)
-def dualaudio2sep(pin, delay):
-    """
-    delay is string
-    """
-    xvfb = configreader.getpath('xvfb-run')
-    bontsdemux = configreader.getpath('bontsdemux')
-    wine = configreader.getpath('wine')
-    bonpin = "Z:\\" + pin[1:]
-    outf = os.path.splitext(pin)[0]
-    bonpout = "Z:\\" + outf[1:]
-    exe = wine + ' ' + bontsdemux + " -i \"" + bonpin + "\" -delay " + delay + " -nd -sound 1 -o \"" + bonpout + "\" -start -quit"
-    recdblist.printutf8(exe)
-    exe = xvfb + ' -a ' + exe
-    txt=commands.getoutput(exe.encode('utf-8'))
-    try:
-        recdblist.addCommandLog(pin, u"BonTsDemux 第一音声取り出し", exe, txt)
-    except:
-        ""
-    ffpin = pin.replace(".ts", "")
-    ffpin1 = pin.replace("ts", "wav")
-    ffpin2 = pin.replace("ts", "m2v")
-    ffpout1 = ffpin + "_1.wav"
-    ffpout2 = ffpin + "_2.wav"
-    ffpout3 = ffpin + ".m2v"
-    shutil.move(ffpin1, ffpout1)
-    exe = 'wine ' + bontsdemux + " -i \"" + bonpin + "\" -delay " + delay + " -nd -sound 2 -encode Demux\(wav\) -o \"" + bonpout + "\" -start -quit"
-    recdblist.printutf8(exe)
-    exe = xvfb + ' -a ' + exe
-    txt=commands.getoutput(exe.encode('utf-8'))
-    try:
-        recdblist.addCommandLog(pin, u"BonTsDemux 第二音声取り出し", exe, txt)
-    except:
-        ""
-    #os.system(exe)
-    shutil.move(ffpin1, ffpout2)
-    shutil.move(ffpin2, ffpout3)
-    ffpout21=ffpout1.replace(".wav",".mp3")
-    ffpout22=ffpout2.replace(".wav",".mp3")
-    useNero=0
-    try:
-        if configreader.getpath("useNeroAAC")=="1" and os.path.exists(configreader.getpath("NeroAAC")):
-            useNero=1
-    except:
-        useNero=0
-    if useNero==1:
-        ffpout21=ffpout1.replace(".wav",".aac")
-        ffpout22=ffpout2.replace(".wav",".aac")
-        tv2audio.wav2aac_nero(ffpout1, ffpout21)
-        tv2audio.wav2aac_nero(ffpout2, ffpout22)
-    else:
-        tv2audio.wav2mp3_lame(ffpout1, ffpout21)
-        tv2audio.wav2mp3_lame(ffpout2, ffpout22)
-    time.sleep(3)
-    os.remove(ffpout1)
-    os.remove(ffpout2)
-def pentaaudio2sep(pin):
-    bontsdemux = configreader.getpath('bontsdemux')
-    wine = configreader.getpath('wine')
-    xvfb = configreader.getpath('xvfb-run')
-    bonpin = "Z:\\" + pin[1:]
-    outf = os.path.splitext(pin)[0]
-    bonpout = "Z:\\" + outf[1:]
-    exe = wine + ' ' + bontsdemux + " -i \"" + bonpin + "\" -delay 167 -nd -sound 3 -o \"" + bonpout + "\" -start -quit"
-    exe = xvfb + ' -a ' + exe
-    recdblist.printutf8(exe)
-    txt=commands.getoutput(exe.encode('utf-8'))
-    try:
-        recdblist.addCommandLog(pin, u"BonTsDemux5.1ch 第一音声取り出し", exe, txt)
-    except:
-        ""
-    ffpin = pin.replace(".ts", "")
-    ffpin1 = pin.replace("ts", "wav")
-    ffpin2 = pin.replace("ts", "m2v")
-    ffpout1 = ffpin + "_1.wav"
-    ffpout2 = ffpin + "_2.aac"
-    shutil.move(ffpin1, ffpout1)
-    exe = "ffmpeg -i '"+pin+"' -vn -f aac -acodec copy '"+ffpout2+"'"
-    recdblist.printutf8(exe)
-    txt=commands.getoutput(exe.encode('utf-8'))
-    try:
-        recdblist.addCommandLog(pin, u"FFmpeg 5.1ch 第二音声(raw AAC)取り出し", exe, txt)
-    except:
-        ""
-    ffpout21=ffpout1.replace(".wav",".mp3")
-    useNero=0
-    try:
-        if configreader.getpath("useNeroAAC")=="1" and os.path.exists(configreader.getpath("NeroAAC")):
-            useNero=1
-    except:
-        useNero=0
-    if useNero==1:
-        ffpout21=ffpout1.replace(".wav",".aac")
-        tv2audio.wav2aac_nero(ffpout1, ffpout21)
-    else:
-        tv2audio.wav2mp3_lame(ffpout1, ffpout21)
-    if not os.path.exists(ffpout21):
-        exe = wine + ' ' + bontsdemux + " -i \"" + bonpin + "\" -delay 167 -nd -sound 0 -o \"" + bonpout + "\" -start -quit"
-        exe = xvfb + ' -a ' + exe
-        recdblist.printutf8(exe)
-        txt=commands.getoutput(exe.encode('utf-8'))
-        try:
-            recdblist.addCommandLog(pin, u"BonTsDemux 修正版第二音声(2chDownmix)取り出し", exe, txt)
-        except:
-            ""
-        shutil.move(ffpin1, ffpout1)
-        if useNero==1:
-            ffpout21=ffpout1.replace(".wav",".aac")
-            tv2audio.wav2aac_nero(ffpout1, ffpout21)
-        else:
-            tv2audio.wav2mp3_lame(ffpout1, ffpout21)
-        time.sleep(3)
-    ffpout21=ffpout1.replace(".wav",".aac")
-    if os.path.exists(ffpout21):
-        if os.path.getsize(ffpout21)>10*1000*1000:
-            os.remove(ffpout1)
 
-def singleaudio2sep(pin):
-    bontsdemux = configreader.getpath('bontsdemux')
-    wine = configreader.getpath('wine')
-    xvfb = configreader.getpath('xvfb-run')
-    bonpin = "Z:\\" + pin[1:]
-    outf = os.path.splitext(pin)[0]
-    bonpout = "Z:\\" + outf[1:]
-    exe = wine + ' ' + bontsdemux + " -i \"" + bonpin + "\" -delay 167 -nd -sound 0 -o \"" + bonpout + "\" -start -quit"
-    exe = xvfb + ' -a ' + exe
-    recdblist.printutf8(exe)
-    txt=commands.getoutput(exe.encode('utf-8'))
-    try:
-        recdblist.addCommandLog(pin, u"BonTsDemux 音声(wav化)取り出し", exe, txt)
-    except:
-        ""
-    ffpin = pin.replace(".ts", "")
-    ffpin1 = pin.replace("ts", "wav")
-    ffpin2 = pin.replace("ts", "m2v")
-    ffpout1 = ffpin + "_1.wav"
-    ffpout2 = ffpin + "_2.aac"
-    shutil.move(ffpin1, ffpout1)
-    exe = "ffmpeg -i '"+pin+"' -vn -f aac -acodec copy '"+ffpout2+"'"
-    recdblist.printutf8(exe)
-    txt=commands.getoutput(exe.encode('utf-8'))
-    try:
-        recdblist.addCommandLog(pin, u"FFmpeg 音声(raw AAC)取り出し", exe, txt)
-    except:
-        ""
-    ffpout21=ffpout1.replace(".wav",".mp3")
-    useNero=0
-    try:
-        if configreader.getpath("useNeroAAC")=="1" and os.path.exists(configreader.getpath("NeroAAC")):
-            useNero=1
-    except:
-        useNero=0
-    if useNero==1:
-        ffpout21=ffpout1.replace(".wav",".aac")
-        tv2audio.wav2aac_nero(ffpout1, ffpout21)
-    else:
-        tv2audio.wav2mp3_lame(ffpout1, ffpout21)
-    ffpout21=ffpout1.replace(".wav",".aac")
-    if os.path.exists(ffpout21):
-        if os.path.getsize(ffpout21)>10*1000*1000:
-            os.remove(ffpout1)
\ No newline at end of file
index 5fe8fc1..3c16d3e 100644 (file)
@@ -26,11 +26,8 @@ def ts2mp4(pin, pout, opt):
     title=os.path.splitext(title)[0]\r
     tpraw=os.path.join(dir, title+".264")\r
     tpmp4=os.path.join(dir, title+".mp4")\r
-    if re.search("x",opt) or re.search("b",opt):\r
-        if re.search(".",opt):\r
-            tv2audio.dualaudio2sep(pin,"0", opt)\r
-        else:\r
-            tv2audio.dualaudio2sep(pin, "167", opt)\r
+    if re.search("d",opt) and not os.path.exists(pin.replace(".ts",".m2v")):\r
+        tv2audio.ts2dualaudio_BonTsDemux(pin,recdblist.BONTSDEMUX_DELAY, opt)\r
     if os.path.isfile(pin) and os.path.getsize(pin)>10*1000:\r
         tv2avi.ts2raw(pin, tpraw, opt)\r
         time.sleep(10)\r