if re.search("MW1",opts):\r
size = "QVGA_BASE"\r
crf=crf+4\r
+ sar=0\r
if re.search("MW2", opts):\r
size = "WVGA_BASE"\r
crf=crf+2\r
+ sar=0\r
if re.search("v", opts):\r
is24fps=1\r
crf=int(configreader.getConfEnv("animation_crf"))\r
harddup=",harddup"\r
encvf=encvf+harddup\r
x264streamsize=str(tsize[0])+u"x"+str(tsize[1])\r
+ if usebluray==1:\r
+ encvf = u"-sws 9 "+encvf + ",scale=-2:1080::0:3,expand=1920:1080"+harddup\r
+ x264streamsize=u"1920x1080"\r
if tsize[0] <= 0 or tsize[1] <= 0:\r
encvf="-sws 9 -vf yadif=0,pp=l5"\r
harddup=",hqdn3d=2:1:2,unsharp=l3x3:0.75:c3x3:0.75,harddup"\r
ffmpeg=configreader.getConfPath("ffmpeg")\r
os.environ['LANG']="ja_JP.UTF-8"\r
exe=ffmpeg+u" -ss 5 -fs 1 -i \""+pin+"\" \""+pin+".size.ts\" 2>&1"\r
+ try:\r
+ recdblist.addCommandSelfLog(pin, exe)\r
+ except Exception, inst:\r
+ print type(inst)\r
+ print str(inst)\r
+ print traceback.print_exc(file=sys.stdout)\r
txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')\r
rT=re.compile(u"Stream.*#.*:.*\D+([\d]+x[\d]+)\D+PAR\D+(\d+:\d+)\D+.*\Z")\r
sizeMaxX=0\r
ffmpeg=configreader.getConfPath("ffmpeg")\r
os.environ['LANG']="ja_JP.UTF-8"\r
exe=ffmpeg+u" -ss 5 -fs 1 -i \""+pin+"\" \""+pin+".size.ts\" 2>&1"\r
+ try:\r
+ recdblist.addCommandSelfLog(pin, exe)\r
+ except Exception, inst:\r
+ print type(inst)\r
+ print str(inst)\r
+ print traceback.print_exc(file=sys.stdout)\r
txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')\r
rT=re.compile(u".*Stream.*#.*:.*\D+([\d]+x[\d]+)\D+PAR\D+(\d+:\d+)\D+.*\Z")\r
sizeMaxX=0\r
return [tX,tY]\r
def getX264CoreVersion():\r
x264=configreader.getConfPath("x264")\r
+ #print x264\r
t1=commands.getoutput(x264+" --help|grep core")\r
+ #print t1\r
rT=re.compile(u"x264 core:(\d*)[\d]*.*\Z")\r
rM=rT.match(t1)\r
v=-1\r
if interlaced==1:\r
x264interlaced="--tff --nal-hrd vbr"\r
if bluray==1:\r
- x264bluray="--weightp 1 --bframes 3 --nal-hrd vbr --b-pyramid none --open-gop bluray --slices 4 --aud --colorprim bt709 --transfer bt709 "\r
- x264_addline=""\r
+ if getX264CoreVersion()<115:\r
+ x264bluray=" --weightp 1 --nal-hrd vbr --bframes 3 --b-pyramid none --open-gop bluray --slices 4 --aud --colorprim bt709 --transfer bt709 "\r
+ x264_addline=""\r
+ if fps=="24000/1001 --keyint 24" or fps =="24000/1001":\r
+ if x264streamsize=="1280x720":\r
+ x264bluray=u"--ref 6 "+x264bluray\r
+ if x264streamsize=="1920x1080":\r
+ x264bluray=u"--ref 4 "+x264bluray\r
+ elif fps=="30000/1001 --keyint 30" or fps =="30000/1001":\r
+ if x264streamsize=="1280x720":\r
+ x264bluray=u"--ref 6 --pulldown double "+x264bluray\r
+ if x264streamsize=="1920x1080":\r
+ if interlaced==0:\r
+ x264bluray=u"--ref 4 --fake-interlaced --pic-struct "+x264bluray\r
+ else:\r
+ x264bluray=u"--ref 4 "+x264bluray\r
+ elif getX264CoreVersion()>=115:\r
+ x264bluray=" --slices 4 --bluray-compat --open-gop --nal-hrd vbr --bframes 3 --b-pyramid strict --aud --colorprim bt709 --transfer bt709 "\r
+ x264_addline=""\r
+ if fps=="24000/1001 --keyint 24" or fps =="24000/1001":\r
+ if x264streamsize=="1280x720":\r
+ x264bluray=u"--ref 6 "+x264bluray\r
+ if x264streamsize=="1920x1080":\r
+ x264bluray=u"--ref 4 "+x264bluray\r
+ elif fps=="30000/1001 --keyint 30" or fps =="30000/1001":\r
+ if x264streamsize=="1280x720":\r
+ x264bluray=u"--ref 6 --pulldown double "+x264bluray\r
+ if x264streamsize=="1920x1080":\r
+ if interlaced==0:\r
+ x264bluray=u"--ref 4 --fake-interlaced --pic-struct "+x264bluray\r
+ else:\r
+ x264bluray=u"--ref 4 "+x264bluray\r
x264_thread="auto"\r
try:\r
xtt=configreader.getConfEnv("x264_thread")\r
x264_addline=configreader.getConfEnv("x264_addline")\r
if getX264CoreVersion()>103:\r
x264res=u"--input-res "+x264streamsize\r
- 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\r
+ 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\r
else:\r
- 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\r
+ 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\r
return exe\r