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))
+ recdblist.Commonlogex("Error", "ts2x264(ts2x264.py)", str(type(inst)), str(inst),log_level=200)
else:
try:
encode_sar(pin, pout,size,is24fps,quality,crf,deinterlace)
except Exception, inst:
- recdblist.Commonlogex("Error", "ts2x264(ts2x264.py)", str(type(inst)), str(inst))
+ recdblist.Commonlogex("Error", "ts2x264(ts2x264.py)", str(type(inst)), str(inst),log_level=200)
def encode_sar(pin,pout,size,is24fps,quality,crf,deinterlace=1):
mencoder=configreader.getpath("mencoder")
encvf=""
harddup=",harddup"
encvf=encvf+harddup
x264streamsize=str(tsize[0])+u"x"+str(tsize[1])
+ if tsize[0] <= 0 or tsize[1] <= 0:
+ encvf="-sws 9 -vf yadif=0,pp=l5"
+ harddup=",hqdn3d=2:1:2,unsharp=l3x3:0.75:c3x3:0.75,harddup"
+ ofps="-ofps 30000/1001"
+ fps="-fps 30000/1001"
+ x264fps="30000/1001"
+ tsize=[1280,720]
+ encvf = encvf + ",scale=-2:720::0:3,expand=1280:720"+harddup
+ x264streamsize=u"1280x720"
+ x264_bitrate="2500"
if quality==1:
x264preset=u"ultrafast"
elif quality==2:
os.environ['LANG']="ja_JP.UTF-8"
exe=ffmpeg+u" -y -i \""+pin+"\" -vsync 400 -vcodec rawvideo -pix_fmt yuv420p "+s+fps+" "+filter+" -an -f rawvideo - | "
exe=exe+get_x264_commandline(x264preset, x264sar, x264fps, x264profile, x264tune, pout,"-", x264streamsize, crf=x264crf)
- #exe=exe+u" nice -n 19 "+x264+" "+x264_sar+" "+x264crf+u" "+x264_addline+u" --threads "+x264_thread+" "+x264profile+x264preset+" "+x264tune+" "+x264fps+" -o \""+pout+"\" - "+x264streamsize
exe = "nice -n 19 " + exe
txt=""
recdblist.printutf8(exe)
return [darx,dary]
def get_par_size(pin,y):
tSize=getMovieBaseSize(pin)
- tX=tSize[0]*10*y/tSize[1]
- tY=y
- if tX>int(tX/10)*10:
- tX=tX/10+1
+ if tSize[1] != 0 :
+ tX=tSize[0]*10*y/tSize[1]
+ tY=y
+ if tX>int(tX/10)*10:
+ tX=tX/10+1
+ else:
+ tX=tX/10
else:
- tX=tX/10
+ tX=-1
+ tY=-1
return [tX,tY]
def get_x264core_version():
x264_addline=configreader.getenv("x264_addline")
if get_x264core_version()>103:
x264res=u"--input-res "+x264streamsize
- exe=u"nice -n 19 "+x264+" "+x264_sar+" "+x264crf+u" "+x264_addline+u" --threads "+x264_thread+" "+x264profile+x264preset+" "+x264tune+" "+x264fps+" "+x264res+" -o \""+pout+"\" "+pin
+ exe=u"nice -n 19 "+x264+" "+x264_sar+" "+x264crf+u" "+x264_addline+u" --colormatrix bt709 --threads "+x264_thread+" "+x264profile+x264preset+" "+x264tune+" "+x264fps+" "+x264res+" -o \""+pout+"\" "+pin
else:
- exe=u"nice -n 19 "+x264+" "+x264_sar+" "+x264crf+u" "+x264_addline+u" --threads "+x264_thread+" "+x264profile+x264preset+" "+x264tune+" "+x264fps+" -o \""+pout+"\" "+pin+" "+x264streamsize
+ exe=u"nice -n 19 "+x264+" "+x264_sar+" "+x264crf+u" "+x264_addline+u" --colormatrix bt709 --threads "+x264_thread+" "+x264profile+x264preset+" "+x264tune+" "+x264fps+" -o \""+pout+"\" "+pin+" "+x264streamsize
return exe
\ No newline at end of file