X-Git-Url: http://git.osdn.net/view?p=rec10%2Frec10-git.git;a=blobdiff_plain;f=rec10%2Ftrunk%2Fsrc%2Fts2x264.py;h=bde0c803330932695f352a476b4f9dffd8b99afd;hp=9f83b75675c7d98ba22dcb31cbcccabb1e7f5336;hb=bdcd627011d8cfc6e210a477608423d8cd31f3b4;hpb=da7a32eeb35c724b6748cc117660dcc1e54a0a72 diff --git a/rec10/trunk/src/ts2x264.py b/rec10/trunk/src/ts2x264.py index 9f83b75..bde0c80 100644 --- a/rec10/trunk/src/ts2x264.py +++ b/rec10/trunk/src/ts2x264.py @@ -38,9 +38,11 @@ def ts2x264(pin, pout, opts):#sizeは"HD"か"SD" if re.search("MW1",opts): size = "QVGA_BASE" crf=crf+4 + sar=0 if re.search("MW2", opts): size = "WVGA_BASE" crf=crf+2 + sar=0 if re.search("v", opts): is24fps=1 crf=int(configreader.getConfEnv("animation_crf")) @@ -187,7 +189,7 @@ def encodeMencoderSar(pin,pout,size,is24fps,quality,crf,deinterlace=1,uselavf=0, encvf=encvf+harddup x264streamsize=str(tsize[0])+u"x"+str(tsize[1]) if usebluray==1: - encvf = encvf + ",scale=-2:1080::0:3,expand=1920:1080"+harddup + encvf = u"-sws 9 "+encvf + ",scale=-2:1080::0:3,expand=1920:1080"+harddup x264streamsize=u"1920x1080" if tsize[0] <= 0 or tsize[1] <= 0: encvf="-sws 9 -vf yadif=0,pp=l5" @@ -383,6 +385,12 @@ def getMovieBaseSize2(pin):##動画開始後すぐに解像度が変更された ffmpeg=configreader.getConfPath("ffmpeg") os.environ['LANG']="ja_JP.UTF-8" exe=ffmpeg+u" -ss 5 -fs 1 -i \""+pin+"\" \""+pin+".size.ts\" 2>&1" + try: + recdblist.addCommandSelfLog(pin, exe) + except Exception, inst: + print type(inst) + print str(inst) + print traceback.print_exc(file=sys.stdout) txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore') rT=re.compile(u"Stream.*#.*:.*\D+([\d]+x[\d]+)\D+PAR\D+(\d+:\d+)\D+.*\Z") sizeMaxX=0 @@ -434,6 +442,12 @@ def getMoviePAR2(pin): ffmpeg=configreader.getConfPath("ffmpeg") os.environ['LANG']="ja_JP.UTF-8" exe=ffmpeg+u" -ss 5 -fs 1 -i \""+pin+"\" \""+pin+".size.ts\" 2>&1" + try: + recdblist.addCommandSelfLog(pin, exe) + except Exception, inst: + print type(inst) + print str(inst) + print traceback.print_exc(file=sys.stdout) txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore') rT=re.compile(u".*Stream.*#.*:.*\D+([\d]+x[\d]+)\D+PAR\D+(\d+:\d+)\D+.*\Z") sizeMaxX=0 @@ -531,7 +545,9 @@ def getParSize(pin,y): return [tX,tY] def getX264CoreVersion(): x264=configreader.getConfPath("x264") + #print x264 t1=commands.getoutput(x264+" --help|grep core") + #print t1 rT=re.compile(u"x264 core:(\d*)[\d]*.*\Z") rM=rT.match(t1) v=-1 @@ -554,21 +570,38 @@ def getX264Commandline(preset,sar,fps,x264profile,x264tune,pout,pin,x264streamsi if interlaced==1: x264interlaced="--tff --nal-hrd vbr" if bluray==1: - x264bluray="--weightp 1 --nal-hrd vbr --bframes 3 --b-pyramid none --open-gop bluray --slices 4 --aud --colorprim bt709 --transfer bt709 " - x264_addline="" - if fps=="24000/1001 --keyint 24" or fps =="24000/1001": - if x264streamsize=="1280x720": - x264bluray=u"--ref 6 "+x264bluray - if x264streamsize=="1920x1080": - x264bluray=u"--ref 3 "+x264bluray - elif fps=="30000/1001 --keyint 30" or fps =="30000/1001": - if x264streamsize=="1280x720": - x264bluray=u"--ref 6 --pulldown double "+x264bluray - if x264streamsize=="1920x1080": - if interlaced==0: - x264bluray=u"--ref 3 --fake-interlaced --pic-struct "+x264bluray - else: - x264bluray=u"--ref 3 "+x264bluray + if getX264CoreVersion()<115: + x264bluray=" --weightp 1 --nal-hrd vbr --bframes 3 --b-pyramid none --open-gop bluray --slices 4 --aud --colorprim bt709 --transfer bt709 " + x264_addline="" + if fps=="24000/1001 --keyint 24" or fps =="24000/1001": + if x264streamsize=="1280x720": + x264bluray=u"--ref 6 "+x264bluray + if x264streamsize=="1920x1080": + x264bluray=u"--ref 4 "+x264bluray + elif fps=="30000/1001 --keyint 30" or fps =="30000/1001": + if x264streamsize=="1280x720": + x264bluray=u"--ref 6 --pulldown double "+x264bluray + if x264streamsize=="1920x1080": + if interlaced==0: + x264bluray=u"--ref 4 --fake-interlaced --pic-struct "+x264bluray + else: + x264bluray=u"--ref 4 "+x264bluray + elif getX264CoreVersion()>=115: + x264bluray=" --slices 4 --bluray-compat --open-gop --nal-hrd vbr --bframes 3 --b-pyramid strict --aud --colorprim bt709 --transfer bt709 " + x264_addline="" + if fps=="24000/1001 --keyint 24" or fps =="24000/1001": + if x264streamsize=="1280x720": + x264bluray=u"--ref 6 "+x264bluray + if x264streamsize=="1920x1080": + x264bluray=u"--ref 4 "+x264bluray + elif fps=="30000/1001 --keyint 30" or fps =="30000/1001": + if x264streamsize=="1280x720": + x264bluray=u"--ref 6 --pulldown double "+x264bluray + if x264streamsize=="1920x1080": + if interlaced==0: + x264bluray=u"--ref 4 --fake-interlaced --pic-struct "+x264bluray + else: + x264bluray=u"--ref 4 "+x264bluray x264_thread="auto" try: xtt=configreader.getConfEnv("x264_thread") @@ -580,7 +613,7 @@ def getX264Commandline(preset,sar,fps,x264profile,x264tune,pout,pin,x264streamsi x264_addline=configreader.getConfEnv("x264_addline") if getX264CoreVersion()>103: x264res=u"--input-res "+x264streamsize - exe=u"nice -n 19 "+x264+" "+x264_sar+" "+x264crf+u" "+x264bluray+u" "+x264interlaced+u" "+x264_addline+u" --colormatrix bt709 --threads "+x264_thread+" "+x264profile+x264preset+" "+x264tune+" "+x264fps+" "+x264res+" -o \""+pout+"\" "+pin + exe=u"nice -n 19 "+x264+" --demuxer raw --vbv-maxrate 30000 --vbv-bufsize 25000 "+x264_sar+" "+x264crf+u" "+x264bluray+u" "+x264interlaced+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" "+x264bluray+u" "+x264interlaced+u" "+x264_addline+u" --colormatrix bt709 --threads "+x264_thread+" "+x264profile+x264preset+" "+x264tune+" "+x264fps+" -o \""+pout+"\" "+pin+" "+x264streamsize + exe=u"nice -n 19 "+x264+" --demuxer raw --vbv-maxrate 30000 --vbv-bufsize 25000 "+x264_sar+" "+x264crf+u" "+x264bluray+u" "+x264interlaced+u" "+x264_addline+u" --colormatrix bt709 --threads "+x264_thread+" "+x264profile+x264preset+" "+x264tune+" "+x264fps+" -o \""+pout+"\" "+pin+" "+x264streamsize return exe