import configreader\r
import status\r
import tv2audio\r
-\r
+path = str(os.path.dirname(os.path.abspath(__file__))) + "/"\r
+tmppath = configreader.getConfPath("tmp")+"/"\r
+if tmppath=="/":\r
+ tmppath=path\r
+if not os.path.exists(tmppath):\r
+ os.mkdir(tmppath)\r
def ts2mp4(pin, pout, opt):\r
dir=os.path.split(pout)[0]\r
title=os.path.split(pout)[1]\r
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("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
if os.path.isfile(tpraw) and os.path.getsize(tpraw)>10*1000:\r
raw2mp4(tpraw, tpmp4, opt)\r
time.sleep(10)\r
- if os.path.exists(tpraw):\r
+ if os.path.exists(tpraw) and not re.search("B",opt):\r
os.remove(tpraw)\r
zip.addFile2FileZip(recdblist.getLogTitle(pin)+".command.log", recdblist.getLogTitle(pin)+".log.zip")\r
if os.path.exists(recdblist.getLogTitle(pin)+".command.log"):\r
duration="-fps 29.970030 "\r
if re.search("a",opt):\r
duration="-fps 23.976023 "\r
- elif re.search("v",opt):\r
- duration="-fps 23.976023 "\r
- if re.search("d",opt):\r
- duration="-fps 29.970030 "##ffmpegが24fpsに対応していないための措置\r
- elif re.search("5",opt):\r
- duration="-fps 29.970030 "##ffmpegが24fpsに対応していないための措置\r
if re.search("I",opt):\r
duration="-fps 29.970030 "\r
- exe = configreader.getConfPath("mp4box")\r
+ exe = configreader.getConfPath("mp4box")+u" -tmp "+tmppath\r
txt=""\r
os.environ['LANG']="ja_JP.UTF-8"\r
pints=pin.replace(".264",".ts")\r
addCaption(pints, pout)\r
if status.getSettings_auto_del_tmp()==1:\r
if os.path.exists(pout):\r
- if re.search(opt,"1") or re.search(opt,"2"):\r
- auto_process.deleteTmpFile(dir, title, ".mp4")\r
+ if re.search("t",opt):\r
+ auto_process.deleteTmpFile(dir, title, ".264")\r
+ elif re.search("k",opt):\r
+ ""#削除しない\r
else:\r
auto_process.deleteTmpFile(dir, title, ".mp4")\r
def mkv2mp4(pin,pout):\r
recdblist.addCommandLogZip(pts, "mp4box_caption", "mp4box_caption", e0, logt)\r
if os.path.exists(pincap):\r
if os.path.getsize(pincap)>1000:\r
- exe = configreader.getConfPath("mp4box")\r
+ exe = configreader.getConfPath("mp4box")+u" -tmp "+tmppath\r
e1s=exe +u" -add \""+pincap+"\" \""+pmp4+"\""\r
addmp4(pincap,pmp4,e1s)\r
def addAudio(pts,pmp4,opts):#オプションに応じた音声の追加を行う\r
- exe = configreader.getConfPath("mp4box")\r
+ exe = configreader.getConfPath("mp4box")+u" -tmp "+tmppath\r
if re.search("d",opts) or re.search("5",opts):#二カ国語放送/5.1ch放送の場合\r
paac1=pts.replace(".ts","_1.aac")\r
paac2=pts.replace(".ts","_2.aac")\r
addmp4(paac1, pmp4, e1a1)\r
if os.path.exists(paac2):\r
addmp4(paac2, pmp4, e1a2)\r
+ elif re.search("b",opts):#BonTsDemuxを使って音声をスプリットした場合\r
+ paac=pts.replace(".ts",".aac")\r
+ if not os.path.exists(paac):\r
+ paac=pts.replace(".ts",".mp3")\r
+ e1a1=exe +u" -add \""+paac+"\" \""+pmp4+"\""\r
+ if os.path.exists(paac):\r
+ addmp4(paac, pmp4, e1a1)\r
else:\r
tv2audio.ts2single_audio(pts,opts)\r
pinaac=pts.replace(".ts",".aac")\r