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=""
ofps="-ofps 24000/1001"
fps="-fps 30000/1001"
x264fps="24000/1001"
- x264tune="animation"
+ x264tune="--tune animation"
encvf="-sws 9 -vf pullup,softskip"
harddup=",pp=l5,unsharp=l3x3:0.75:c3x3:0.75,hqdn3d=2:1:2,harddup"
if size == "HD":
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:
"""
ffmpeg=configreader.getpath("ffmpeg")
- x264=configreader.getpath("x264")
fps=u"-r 29.970030 "
x264fps="30000/1001"
x264streamsize=""
x264_bitrate="2500"
x264_thread="auto"
tsar=getMoviePAR(pin)
+ filter="-deinterlace"
x264sar=str(tsar[0])+":"+str(tsar[1])
if size == "HD":
tsize=get_par_size(pin,720)
s = "-s "+str(tsize[0])+"x720 "
x264streamsize=str(tsize[0])+u"x720"
x264_bitrate="2500"
+ if deinterlace==0:
+ tsize=getMovieBaseSize(pin)
+ fps=""
+ s = "-s "+str(tsize[0])+"x"+str(tsize[1])+" "
+ x264fps="30000/1001"
+ x264tune=x264tune+" --tff --nal-hrd vbr"
+ filter=""
+ x264streamsize=str(tsize[0])+u"x"+str(tsize[1])
if quality==1:
x264preset=u"ultrafast"
elif quality==2:
x264profile=" --level 32 --profile baseline "
else:
x264profile=" --level 42 --profile high "
- x264crf=u"--crf "+str(crf)
+ x264crf=str(crf)
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=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():
v=int(rM.group(1))
return v
def get_x264_commandline(preset,sar,fps,x264profile,x264tune,pout,pin,x264streamsize,crf=0,bitrate=0):
+ x264=configreader.getpath("x264")
os.environ['LANG']="ja_JP.UTF-8"
x264_sar="--sar "+sar
x264preset=u"--preset "+preset
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