3 # Rec10 TS Recording Tools
\r
4 # Copyright (C) 2009-2011 Yukikaze
\r
17 def ts2x264(pin, pout, opts):#sizeは"HD"か"SD"
\r
19 pinで指定されたファイルをpoutにx264でエンコードして書き出す
\r
26 quality=int(configreader.getConfEnv("x264_preset"))
\r
27 crf=int(configreader.getConfEnv("crf"))
\r
31 if re.search("H", opts):
\r
33 if re.search("S", opts):
\r
35 if re.search("F", opts):
\r
37 if re.search("W",opts):
\r
39 if re.search("MW1",opts):
\r
43 if re.search("MW2", opts):
\r
47 if re.search("v", opts):
\r
49 crf=int(configreader.getConfEnv("animation_crf"))
\r
50 if re.search("a", opts):
\r
52 crf=int(configreader.getConfEnv("animation_crf"))
\r
53 if re.search("I", opts):
\r
55 if re.search("B", opts):
\r
58 if re.search("q",opts):
\r
60 if re.search("w",opts):
\r
62 if re.search("e",opts):
\r
64 if re.search("r",opts):
\r
66 if re.search("u",opts):
\r
68 if re.search("i",opts):
\r
70 if re.search("o",opts):
\r
72 if re.search("p",opts):
\r
74 if re.search("d",opts):#二カ国語放送の場合
\r
75 tm2v=pin.replace(".ts",".m2v")
\r
76 encodeFfmpegSar(tm2v,pout,size,is24fps,quality,crf,deinterlace=deinterlace,usebluray=bluray,usesar=sar)
\r
77 elif re.search("5",opts):#5.1chの場合
\r
78 encodeFfmpegSar(pin,pout,size,is24fps,quality,crf,deinterlace=deinterlace,usebluray=bluray,usesar=sar)
\r
79 elif re.search("b",opts):#BonTsDemuxを使いたい場合
\r
80 tm2v=pin.replace(".ts",".m2v")
\r
81 encodeFfmpegSar(tm2v,pout,size,is24fps,quality,crf,deinterlace=deinterlace,usebluray=bluray,usesar=sar)
\r
84 encodeMencoderSar(pin, pout,size,is24fps,quality,crf,deinterlace=deinterlace,uselavf=1,usebluray=bluray,usesar=sar)
\r
85 if os.path.exists(pout):
\r
86 if not os.path.getsize(pout)>1*1000:
\r
87 recdblist.addCommonlogEX("Warning", "Old mencoder option used.","","",log_level=200)
\r
89 encodeMencoderSar(pin, pout,size,is24fps,quality,crf,deinterlace=deinterlace,uselavf=0,usebluray=bluray,usesar=sar)
\r
90 except Exception, inst:
\r
91 recdblist.addCommonlogEX("Error", "ts2x264_mencoder_old(ts2x264.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)
\r
93 recdblist.addCommonlogEX("Warning", "Old mencoder option used.","","",log_level=200)
\r
95 encodeMencoderSar(pin, pout,size,is24fps,quality,crf,deinterlace=deinterlace,uselavf=0,usebluray=bluray,usesar=sar)
\r
96 except Exception, inst:
\r
97 recdblist.addCommonlogEX("Error", "ts2x264_mencoder_old(ts2x264.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)
\r
98 except Exception, inst:
\r
99 recdblist.addCommonlogEX("Error", "ts2x264(ts2x264.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)
\r
100 def encodeMencoderSar(pin,pout,size,is24fps,quality,crf,deinterlace=1,uselavf=0,usebluray=0,usesar=1):
\r
101 mencoder=configreader.getConfPath("mencoder")
\r
102 tee=configreader.getConfPath("tee")
\r
105 encvf="-sws 9 -vf yadif=0,pp=l5"
\r
106 harddup=",hqdn3d=2:1:2,unsharp=l3x3:0.75:c3x3:0.75,harddup"
\r
107 ofps="-ofps 30000/1001"
\r
108 fps="-fps 30000/1001"
\r
109 x264fps="30000/1001 --keyint 30"
\r
113 x264_bitrate="5000"
\r
116 tsar=getMoviePAR2(pin)
\r
118 x264sar=str(tsar[0])+u":"+str(tsar[1])
\r
121 ofps="-ofps 24000/1001"
\r
122 fps="-fps 30000/1001"
\r
123 x264fps="24000/1001 --keyint 24"
\r
124 x264tune="--tune animation"
\r
125 encvf="-sws 9 -vf pullup,softskip"
\r
126 harddup=",pp=l5,unsharp=l3x3:0.75:c3x3:0.75,hqdn3d=2:1:2,harddup"
\r
128 tsize=getParSize(pin,720)
\r
130 encvf = encvf + ",scale=-3:720::0:3"+harddup
\r
131 x264streamsize=str(tsize[0])+u"x720"
\r
133 encvf = encvf + ",scale=-2:720::0:3,expand=1280:720"+harddup
\r
134 x264streamsize=u"1280x720"
\r
135 x264_bitrate="2500"
\r
136 elif size == "WVGA":
\r
137 tsize=getParSize(pin,480)
\r
139 encvf = encvf + ",scale=-3:480::0:3"+harddup
\r
140 x264streamsize=str(tsize[0])+u"x480"
\r
142 encvf = encvf + ",scale=-2:480::0:3,expand=854:480"+harddup
\r
143 x264streamsize=u"854x480"
\r
144 x264_bitrate="1500"
\r
145 elif size == "FullHD":
\r
146 tsize=getParSize(pin,1080)
\r
148 encvf = encvf + ",scale=-3:1080::0:3"+harddup
\r
149 x264streamsize=str(tsize[0])+u"x1080"
\r
151 encvf = encvf + ",scale=-2:1080::0:3,expand=1920:1080"+harddup
\r
152 x264streamsize=u"1920x1080"
\r
153 x264_bitrate="5000"
\r
154 elif size == "QVGA_BASE":
\r
155 tsize=getParSize(pin,240)
\r
157 encvf = encvf + ",scale=-3:240::0:3"+harddup
\r
158 x264streamsize=str(tsize[0])+u"x240"
\r
160 encvf = encvf + ",scale=320:-2::0:3,expand=320:240"+harddup
\r
161 x264streamsize=u"320x240"
\r
163 elif size == "WVGA_BASE":
\r
164 tsize=getParSize(pin,480)
\r
166 encvf = encvf + ",scale=-3:480::0:3"+harddup
\r
167 x264streamsize=str(tsize[0])+u"x480"
\r
169 encvf = encvf + ",scale=-2:480::0:3,expand=854:480"+harddup
\r
170 x264streamsize=u"854x480"
\r
171 x264_bitrate="1500"
\r
173 tsize=getParSize(pin,720)
\r
175 encvf = encvf + ",scale=-3:720::0:3"+harddup
\r
176 x264streamsize=str(tsize[0])+u"x720"
\r
178 encvf = encvf + ",scale=-2:720::0:3,expand=1280:720"+harddup
\r
179 x264streamsize=u"1280x720"
\r
180 x264_bitrate="2500"
\r
182 tsize=getMovieBaseSize2(pin)
\r
183 ofps="-ofps 30000/1001"
\r
184 #fps="-fps 30000/1001"
\r
186 x264fps="30000/1001 --keyint 30"
\r
188 encvf="-vf hqdn3d=2:1:2"
\r
190 encvf=encvf+harddup
\r
191 x264streamsize=str(tsize[0])+u"x"+str(tsize[1])
\r
193 encvf = u"-sws 9 "+encvf + ",scale=-2:1080::0:3,expand=1920:1080"+harddup
\r
194 x264streamsize=u"1920x1080"
\r
195 if tsize[0] <= 0 or tsize[1] <= 0:
\r
196 encvf="-sws 9 -vf yadif=0,pp=l5"
\r
197 harddup=",hqdn3d=2:1:2,unsharp=l3x3:0.75:c3x3:0.75,harddup"
\r
198 ofps="-ofps 30000/1001"
\r
199 fps="-fps 30000/1001"
\r
200 x264fps="30000/1001 --keyint 30"
\r
202 encvf = encvf + ",scale=-2:720::0:3,expand=1280:720"+harddup
\r
203 x264streamsize=u"1280x720"
\r
204 x264_bitrate="2500"
\r
206 x264preset=u"ultrafast"
\r
208 x264preset=u"veryfast"
\r
212 x264preset=u"medium"
\r
216 x264preset=u"slower"
\r
218 x264preset=u"medium"
\r
219 if size == "WVGA_BASE" or size == "QVGA_BASE":
\r
220 x264profile=" --level 32 --profile baseline "
\r
222 x264profile=" --level 41 --profile high "
\r
224 lavft="-demuxer lavf "
\r
226 os.environ['LANG']="ja_JP.UTF-8"
\r
228 random.jumpahead(10)
\r
229 temptime=int(time.time())
\r
230 temptime=temptime % 9697
\r
231 random.jumpahead(temptime)
\r
232 streampath=os.path.join(os.path.dirname(pin),str(random.randint(10000, 99999999)))
\r
233 unicode(commands.getoutput(u"mkfifo "+streampath),'utf-8','ignore')
\r
234 logmencoder=recdblist.getLogTitle(pin)+".mencoder.log"
\r
235 logx264=recdblist.getLogTitle(pin)+".x264.log"
\r
236 encexe=mencoder+u" \""+pin+u"\" -quiet -vfm ffmpeg "+lavft+encvf+u",format=i420 "+fps+" "+ofps+" -oac mp3lame -ovc raw -of rawvideo -o \""+streampath+"\" 2>&1 | "+tee+" \""+logmencoder+"\" & "
\r
237 encexe=encexe+getX264Commandline(x264preset, x264sar, x264fps, x264profile, x264tune, pout, streampath, x264streamsize, crf=x264crf,interlaced=x264interlaced,bluray=usebluray)
\r
238 #encexe=encexe+u" nice -n 19 "+x264+" "+x264_sar+" "+x264crf+u" "+x264_addline+u" --threads "+x264_thread+" "+x264profile+x264preset+" "+x264tune+" "+x264fps+" -o \""+pout+"\" "+streampath+" "+x264streamsize
\r
239 encexe=u"nice -n 19 " +encexe+" 2>&1 | "+tee+" \""+logx264+"\""
\r
241 recdblist.addCommandSelfLog(pin, encexe)
\r
242 except Exception, inst:
\r
245 print traceback.print_exc(file=sys.stdout)
\r
246 recdblist.printutf8(encexe)
\r
249 txt=unicode(commands.getoutput(encexe.encode('utf-8')),'utf-8','ignore')
\r
252 os.remove(streampath)
\r
253 zip.addFile2FileZip(logmencoder, recdblist.getLogTitle(pin)+".log.zip")
\r
254 zip.addFile2FileZip(logx264, recdblist.getLogTitle(pin)+".log.zip")
\r
255 os.remove(logmencoder)
\r
257 recdblist.addCommandLog(pin, u"Mencoder", encexe, txt)
\r
258 # recdblist.addCommandLogTar(pin,u"Mencoder","mencoder", encexe,txt)
\r
259 def encodeFfmpegSar(pin,pout,size,is24fps,quality,crf,deinterlace=1,usebluray=0,usesar=1):
\r
263 ffmpeg=configreader.getConfPath("ffmpeg")
\r
264 tee=configreader.getConfPath("tee")
\r
265 fps=u"-r 29.970030 "
\r
266 x264fps="30000/1001 --keyint 30"
\r
270 x264_bitrate="2500"
\r
273 tsar=getMoviePAR2(pin)
\r
274 filter="-deinterlace"
\r
275 x264sar=str(tsar[0])+":"+str(tsar[1])
\r
277 fps=u"-r 23.976023 "
\r
278 x264fps="24000/1001 --keyint 24"
\r
279 x264tune="--tune animation"
\r
281 tsize=getParSize(pin,720)
\r
282 s = "-s "+str(tsize[0])+"x720 "
\r
283 x264streamsize=str(tsize[0])+u"x720"
\r
284 x264_bitrate="2500"
\r
285 elif size == "WVGA":
\r
286 tsize=getParSize(pin,480)
\r
287 s = "-s "+str(tsize[0])+"x480 "
\r
288 x264streamsize=str(tsize[0])+u"x480"
\r
289 x264_bitrate="1500"
\r
290 elif size == "FullHD":
\r
291 tsize=getParSize(pin,1080)
\r
292 s = "-s "+str(tsize[0])+"x1080 "
\r
293 x264streamsize=str(tsize[0])+u"x1080"
\r
294 x264_bitrate="5000"
\r
296 tsize=getParSize(pin,480)
\r
297 s = "-s "+str(tsize[0])+"x480 "
\r
298 x264streamsize=str(tsize[0])+u"x480"
\r
299 x264_bitrate="1250"
\r
300 elif size == "QVGA_BASE":
\r
301 tsize=getParSize(pin,240)
\r
302 s = "-s "+str(tsize[0])+"x240 "
\r
303 x264streamsize=str(tsize[0])+u"x240"
\r
305 elif size == "WVGA_BASE":
\r
306 tsize=getParSize(pin,480)
\r
307 s = "-s "+str(tsize[0])+"x480 "
\r
308 x264streamsize=str(tsize[0])+u"x480"
\r
309 x264_bitrate="1500"
\r
311 tsize=getParSize(pin,720)
\r
312 s = "-s "+str(tsize[0])+"x720 "
\r
313 x264streamsize=str(tsize[0])+u"x720"
\r
314 x264_bitrate="2500"
\r
316 tsize=getMovieBaseSize2(pin)
\r
318 s = "-s "+str(tsize[0])+"x"+str(tsize[1])+" "
\r
319 x264fps="30000/1001 --keyint 30"
\r
322 x264streamsize=str(tsize[0])+u"x"+str(tsize[1])
\r
324 x264preset=u"ultrafast"
\r
326 x264preset=u"veryfast"
\r
330 x264preset=u"medium"
\r
334 x264preset=u"slower"
\r
336 x264preset=u"medium"
\r
337 if size == "WVGA_BASE" or size == "QVGA_BASE":
\r
338 x264profile=" --level 32 --profile baseline "
\r
340 x264profile=" --level 41 --profile high "
\r
343 os.environ['LANG']="ja_JP.UTF-8"
\r
344 log_ffmpeg=recdblist.getLogTitle(pin)+".ffmpeg.log"
\r
345 log_x264=recdblist.getLogTitle(pin)+".x264.log"
\r
346 exe=ffmpeg+u" -y -i \""+pin+"\" -vsync 400 -vcodec rawvideo -pix_fmt yuv420p "+s+fps+" "+filter+" -an -f rawvideo - 2> \""+log_ffmpeg+"\" | "
\r
347 exe=exe+getX264Commandline(x264preset, x264sar, x264fps, x264profile, x264tune, pout,"-", x264streamsize, crf=x264crf,interlaced=x264interlaced,bluray=usebluray)
\r
348 exe = "nice -n 19 " + exe+" 2>&1 | "+tee+" \""+log_x264+"\""
\r
350 #recdblist.addCommandSelfLog(log_ffmpeg,recdblist.getLogTitle(pin)+".log.zip")
\r
351 #recdblist.addCommandSelfLog(log_x264,recdblist.getLogTitle(pin)+".log.zip")
\r
352 recdblist.printutf8(exe)
\r
353 recdblist.addCommandSelfLog(pin,exe)
\r
355 txt=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
\r
358 recdblist.addCommandLog(pin, u"FFmpeg動画エンコード", exe, txt)
\r
359 zip.addFile2FileZip(log_ffmpeg, recdblist.getLogTitle(pin+".log.zip"))
\r
360 zip.addFile2FileZip(log_x264, recdblist.getLogTitle(pin+".log.zip"))
\r
361 os.remove(log_ffmpeg)
\r
362 os.remove(log_x264)
\r
363 def getMovieBaseSize(pin):
\r
364 ffmpeg=configreader.getConfPath("ffmpeg")
\r
365 os.environ['LANG']="ja_JP.UTF-8"
\r
366 exe=ffmpeg+u" -i \""+pin+"\" 2>&1"
\r
367 txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
\r
368 rT=re.compile(u".*Stream.*#.*:.*\D+([\d]+x[\d]+)\D+PAR\D+(\d+:\d+)\D+.*\Z")
\r
371 txtls=txts.split("\n")
\r
375 sizetxt=rM.group(1)
\r
377 tX=int(sizetxt.split("x")[0])
\r
378 tY=int(sizetxt.split("x")[1])
\r
379 tEX=int(partxt.split(":")[0])
\r
380 tEY=int(partxt.split(":")[1])
\r
384 return [sizeMaxX,sizeMaxY]
\r
385 def getMovieBaseSize2(pin):##動画開始後すぐに解像度が変更されたときに対処
\r
386 ffmpeg=configreader.getConfPath("ffmpeg")
\r
387 os.environ['LANG']="ja_JP.UTF-8"
\r
388 exe=ffmpeg+u" -ss 5 -fs 1 -i \""+pin+"\" \""+pin+".size.ts\" 2>&1"
\r
390 recdblist.addCommandSelfLog(pin, exe)
\r
391 except Exception, inst:
\r
394 print traceback.print_exc(file=sys.stdout)
\r
395 txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
\r
396 rT=re.compile(u"Stream.*#.*:.*\D+([\d]+x[\d]+)\D+PAR\D+(\d+:\d+)\D+.*\Z")
\r
399 txtls=txts.split("\n")
\r
403 sizetxt=rM.group(1)
\r
405 tX=int(sizetxt.split("x")[0])
\r
406 tY=int(sizetxt.split("x")[1])
\r
407 tEX=int(partxt.split(":")[0])
\r
408 tEY=int(partxt.split(":")[1])
\r
412 os.remove(pin+".size.ts")
\r
413 return [sizeMaxX,sizeMaxY]
\r
414 def getMoviePAR(pin):
\r
415 ffmpeg=configreader.getConfPath("ffmpeg")
\r
416 os.environ['LANG']="ja_JP.UTF-8"
\r
417 exe=ffmpeg+u" -i \""+pin+"\" 2>&1"
\r
418 txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
\r
419 rT=re.compile(u".*Stream.*#.*:.*\D+([\d]+x[\d]+)\D+PAR\D+(\d+:\d+)\D+.*\Z")
\r
423 txtls=txts.split("\n")
\r
427 sizetxt=rM.group(1)
\r
429 tX=int(sizetxt.split("x")[0])
\r
430 tY=int(sizetxt.split("x")[1])
\r
431 tEX=int(dartxt.split(":")[0])
\r
432 tEY=int(dartxt.split(":")[1])
\r
435 if tX==1920 and tY==1080:
\r
442 def getMoviePAR2(pin):
\r
443 ffmpeg=configreader.getConfPath("ffmpeg")
\r
444 os.environ['LANG']="ja_JP.UTF-8"
\r
445 exe=ffmpeg+u" -ss 5 -fs 1 -i \""+pin+"\" \""+pin+".size.ts\" 2>&1"
\r
447 recdblist.addCommandSelfLog(pin, exe)
\r
448 except Exception, inst:
\r
451 print traceback.print_exc(file=sys.stdout)
\r
452 txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
\r
453 rT=re.compile(u".*Stream.*#.*:.*\D+([\d]+x[\d]+)\D+PAR\D+(\d+:\d+)\D+.*\Z")
\r
457 txtls=txts.split("\n")
\r
461 sizetxt=rM.group(1)
\r
463 tX=int(sizetxt.split("x")[0])
\r
464 tY=int(sizetxt.split("x")[1])
\r
465 tEX=int(dartxt.split(":")[0])
\r
466 tEY=int(dartxt.split(":")[1])
\r
469 if tX==1920 and tY==1080:
\r
475 os.remove(pin+".size.ts")
\r
477 def getMovieDAR(pin):
\r
478 ffmpeg=configreader.getConfPath("ffmpeg")
\r
479 os.environ['LANG']="ja_JP.UTF-8"
\r
480 exe=ffmpeg+u" -i \""+pin+"\" 2>&1"
\r
481 txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
\r
482 rT=re.compile(u".*Stream.*#.*:.*\D+([\d]+x[\d]+)\D+.*DAR\D+(\d+:\d+)\D+.*\Z")
\r
486 txtls=txts.split("\n")
\r
490 sizetxt=rM.group(1)
\r
492 tX=int(sizetxt.split("x")[0])
\r
493 tY=int(sizetxt.split("x")[1])
\r
494 tEX=int(dartxt.split(":")[0])
\r
495 tEY=int(dartxt.split(":")[1])
\r
498 if tX==1920 and tY==1080:
\r
505 def getMovieDAR2(pin):
\r
506 ffmpeg=configreader.getConfPath("ffmpeg")
\r
507 os.environ['LANG']="ja_JP.UTF-8"
\r
508 exe=ffmpeg+u" -ss 5 -fs 1 -i \""+pin+"\" \""+pin+".size.ts\" 2>&1"
\r
509 txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
\r
510 rT=re.compile(u".*Stream.*#.*:.*\D+([\d]+x[\d]+)\D+.*DAR\D+(\d+:\d+)\D+.*\Z")
\r
514 txtls=txts.split("\n")
\r
518 sizetxt=rM.group(1)
\r
520 tX=int(sizetxt.split("x")[0])
\r
521 tY=int(sizetxt.split("x")[1])
\r
522 tEX=int(dartxt.split(":")[0])
\r
523 tEY=int(dartxt.split(":")[1])
\r
526 if tX==1920 and tY==1080:
\r
532 os.remove(pin+".size.ts")
\r
534 def getParSize(pin,y):
\r
535 tSize=getMovieBaseSize2(pin)
\r
537 tX=tSize[0]*10*y/tSize[1]
\r
539 if tX>int(tX/10)*10:
\r
547 def getX264CoreVersion():
\r
548 x264=configreader.getConfPath("x264")
\r
550 t1=commands.getoutput(x264+" --help|grep core")
\r
552 rT=re.compile(u"x264 core:(\d*)[\d]*.*\Z")
\r
558 def getX264Commandline(preset,sar,fps,x264profile,x264tune,pout,pin,x264streamsize,crf=-1,bitrate=0,interlaced=0,bluray=0):
\r
559 x264=configreader.getConfPath("x264")
\r
560 os.environ['LANG']="ja_JP.UTF-8"
\r
561 x264_sar="--sar "+sar
\r
562 x264preset=u"--preset "+preset
\r
563 x264fps="--fps "+fps
\r
566 x264_addline=configreader.getConfEnv("x264_addline")
\r
568 x264bitrate=u"--bitrate "+str(bitrate)
\r
570 x264crf=u"--crf "+str(crf)
\r
572 x264interlaced="--tff --nal-hrd vbr"
\r
574 if getX264CoreVersion()<115:
\r
575 x264bluray=" --weightp 1 --nal-hrd vbr --bframes 3 --b-pyramid none --open-gop bluray --slices 4 --aud --colorprim bt709 --transfer bt709 "
\r
577 if fps=="24000/1001 --keyint 24" or fps =="24000/1001":
\r
578 if x264streamsize=="1280x720":
\r
579 x264bluray=u"--ref 6 "+x264bluray
\r
580 if x264streamsize=="1920x1080":
\r
581 x264bluray=u"--ref 4 "+x264bluray
\r
582 elif fps=="30000/1001 --keyint 30" or fps =="30000/1001":
\r
583 if x264streamsize=="1280x720":
\r
584 x264bluray=u"--ref 6 --pulldown double "+x264bluray
\r
585 if x264streamsize=="1920x1080":
\r
587 x264bluray=u"--ref 4 --fake-interlaced --pic-struct "+x264bluray
\r
589 x264bluray=u"--ref 4 "+x264bluray
\r
590 elif getX264CoreVersion()>=115:
\r
591 x264bluray=" --slices 4 --bluray-compat --nal-hrd vbr --bframes 3 --b-pyramid strict --aud --colorprim bt709 --transfer bt709 "
\r
593 if fps=="24000/1001 --keyint 24" or fps =="24000/1001":
\r
594 if x264streamsize=="1280x720":
\r
595 x264bluray=u"--ref 6 "+x264bluray
\r
596 if x264streamsize=="1920x1080":
\r
597 x264bluray=u"--ref 4 "+x264bluray
\r
598 elif fps=="30000/1001 --keyint 30" or fps =="30000/1001":
\r
599 if x264streamsize=="1280x720":
\r
600 x264bluray=u"--ref 6 --pulldown double "+x264bluray
\r
601 if x264streamsize=="1920x1080":
\r
603 x264bluray=u"--ref 4 --fake-interlaced --pic-struct "+x264bluray
\r
605 x264bluray=u"--ref 4 "+x264bluray
\r
608 xtt=configreader.getConfEnv("x264_thread")
\r
611 x264_thread=str(xtt)
\r
614 x264_addline=configreader.getConfEnv("x264_addline")
\r
615 if getX264CoreVersion()>103:
\r
616 x264res=u"--input-res "+x264streamsize
\r
617 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
619 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