add.append([recdblist.REC_AUTO_SUGGEST_DECODE,title,nchtxt])
elif proc=="ts":
add.append([recdblist.REC_AUTO_SUGGEST_ENCODE,title,nchtxt])
- elif proc =="avi":
+ elif proc =="264":
add.append([recdblist.REC_AUTO_SUGGEST_AVI2FP,title,nchtxt])
#elif proc =="mp4":
# add.append([recdblist.REC_AUTO_SUGGEST_AP2FP,title,nchtxt])
return "mp4"
else:
return "mp4making"
- elif os.path.exists(os.path.join(path,title+".avi")):
- if int(time.time()-os.path.getmtime(os.path.join(path,title+".avi")))>300:
- return "avi"
+ elif os.path.exists(os.path.join(path,title+".264")):
+ if int(time.time()-os.path.getmtime(os.path.join(path,title+".264")))>300:
+ return "264"
else:
return "encoding"
elif os.path.exists(os.path.join(path,title+".ts.log")):
if pid > 0:#親プロセスの場合
""
else:
+ makeMP4=0
+ try:
+ if configreader.getenv("make_mp4")==1:
+ makeMP4=1
+ except:
+ ""
+ if re.search("m", opt):
+ makeMP4=0
+ if re.search("4", opt):
+ makeMP4=1
recdb.del_reckey(recdblist.REC_AVI_TO_MKV, title, chtxt, btime)
recdb.rec_reckey(recdblist.REC_CHANGING_CANTAINER, title, chtxt, btime, etime, opt)
- #tv2mp4.avi2mp4(os.path.join(recpath,title+".avi"),os.path.join(recpath,title+".mkv"),opt)
- tv2mkv.avi2mkv(os.path.join(recpath,title+".avi"),os.path.join(recpath,title+".mkv"),opt)
+ if makeMP4==1:
+ tv2mp4.raw2mp4(os.path.join(recpath,title+".264"),os.path.join(recpath,title+".mp4"),opt)
+ else:
+ tv2mkv.raw2mkv(os.path.join(recpath,title+".264"),os.path.join(recpath,title+".mkv"),opt)
recdb.del_reckey(recdblist.REC_CHANGING_CANTAINER, title, chtxt, btime)
sys.exit()
elif task["type"] == recdblist.REC_AVI_TO_MP4:
if pid > 0:#親プロセスの場合
""
else:
+ makeMP4=0
+ try:
+ if configreader.getenv("make_mp4")==1:
+ makeMP4=1
+ except:
+ ""
+ if re.search("m", opt):
+ makeMP4=0
+ if re.search("4", opt):
+ makeMP4=1
recdb.del_reckey(recdblist.REC_AVI_TO_MP4, title, chtxt, btime)
recdb.rec_reckey(recdblist.REC_CHANGING_CANTAINER, title, chtxt, btime, etime, opt)
- tv2mp4.avi2mp4(os.path.join(recpath,title+".avi"),os.path.join(recpath,title+".mp4"),opt)
+ if makeMP4==1:
+ tv2mp4.ts2mp4(pin, pout, opt)
+ tv2mp4.raw2mp4(os.path.join(recpath,title+".264"),os.path.join(recpath,title+".mp4"),opt)
+ else:
+ tv2mkv.raw2mkv(os.path.join(recpath,title+".264"),os.path.join(recpath,title+".mkv"),opt)
recdb.del_reckey(recdblist.REC_CHANGING_CANTAINER, title, chtxt, btime)
sys.exit()
elif task["type"] == recdblist.REC_MKV_TO_MP4:
streampath=os.path.join(os.path.dirname(pin),str(random.randint(10000, 999999)))
os.system(u"mkfifo "+streampath)
encexe=u"mencoder \""+pin+u"\" -vfm ffmpeg -quiet -sws 9 "+encvf+u",format=i420 "+fps+" "+ofps+" -oac mp3lame -ovc raw -of rawvideo -o \""+streampath+"\" &"
- encexe=encexe+u" nice -n 19 x264 "+x264crf+" --level 41 --profile high "+x264preset+" "+x264tune+" "+x264fps+" -o \""+pout+"\" "+streampath+" "+x264streamsize
+ encexe=encexe+u" nice -n 19 x264 "+x264crf+" --vbv-bufsize 30000 --vbv-maxrate 15000 --level 41 --profile high "+x264preset+" "+x264tune+" "+x264fps+" -o \""+pout+"\" "+streampath+" "+x264streamsize
encexe=u"nice -n 19 " +encexe
recdblist.printutf8(encexe)
txt=txt+"Cmd : "+encexe+"\n"
txt=""
os.environ['LANG']="ja_JP.UTF-8"
exe=ffmpeg+u" -y -i \""+pin+"\" -vsync 400 -vcodec rawvideo -pix_fmt yuv420p "+s+fps+"-deinterlace -an -f rawvideo - |"
- exe=exe+u" nice -n 19 x264 "+x264crf+" --level 41 --profile high "+x264preset+" "+x264tune+" "+x264fps+" -o \""+pout+"\" - "+x264streamsize
+ exe=exe+u" nice -n 19 x264 "+x264crf+" --vbv-bufsize 30000 --vbv-maxrate 10000 --level 41 --profile high "+x264preset+" "+x264tune+" "+x264fps+" -o \""+pout+"\" - "+x264streamsize
txt=txt+"Cmd : "+exe+"\n"
exe = "nice -n 19 " + exe
txt=txt+"Cmd : "+exe+"\n"