3 # Rec10 TS Recording Tools
\r
4 # Copyright (C) 2009-2011 Yukikaze
\r
16 def ts2x264(pin, pout, opts):#sizeは"HD"か"SD"
\r
18 pinで指定されたファイルをpoutにx264でエンコードして書き出す
\r
25 quality=int(configreader.getConfEnv("x264_preset"))
\r
26 crf=int(configreader.getConfEnv("crf"))
\r
30 if re.search("H", opts):
\r
32 if re.search("S", opts):
\r
34 if re.search("F", opts):
\r
36 if re.search("W",opts):
\r
38 if re.search("MW1",opts):
\r
42 if re.search("MW2", opts):
\r
46 if re.search("v", opts):
\r
48 crf=int(configreader.getConfEnv("animation_crf"))
\r
49 if re.search("a", opts):
\r
51 crf=int(configreader.getConfEnv("animation_crf"))
\r
52 if re.search("I", opts):
\r
54 if re.search("B", opts):
\r
57 if re.search("q",opts):
\r
59 if re.search("w",opts):
\r
61 if re.search("e",opts):
\r
63 if re.search("r",opts):
\r
65 if re.search("u",opts):
\r
67 if re.search("i",opts):
\r
69 if re.search("o",opts):
\r
71 if re.search("p",opts):
\r
73 if re.search("d",opts):#二カ国語放送の場合
\r
74 tm2v=pin.replace(".ts",".m2v")
\r
75 encodeFfmpegSar(tm2v,pout,size,is24fps,quality,crf,deinterlace=deinterlace,usebluray=bluray,usesar=sar)
\r
76 elif re.search("5",opts):#5.1chの場合
\r
77 encodeFfmpegSar(pin,pout,size,is24fps,quality,crf,deinterlace=deinterlace,usebluray=bluray,usesar=sar)
\r
78 elif re.search("b",opts):#BonTsDemuxを使いたい場合
\r
79 tm2v=pin.replace(".ts",".m2v")
\r
80 encodeFfmpegSar(tm2v,pout,size,is24fps,quality,crf,deinterlace=deinterlace,usebluray=bluray,usesar=sar)
\r
83 encodeMencoderSar(pin, pout,size,is24fps,quality,crf,deinterlace=deinterlace,uselavf=1,usebluray=bluray,usesar=sar)
\r
84 if os.path.exists(pout):
\r
85 if not os.path.getsize(pout)>1*1000:
\r
86 recdblist.addCommonlogEX("Warning", "Old mencoder option used.","","",log_level=200)
\r
88 encodeMencoderSar(pin, pout,size,is24fps,quality,crf,deinterlace=deinterlace,uselavf=0,usebluray=bluray,usesar=sar)
\r
89 except Exception, inst:
\r
90 recdblist.addCommonlogEX("Error", "ts2x264_mencoder_old(ts2x264.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)
\r
92 recdblist.addCommonlogEX("Warning", "Old mencoder option used.","","",log_level=200)
\r
94 encodeMencoderSar(pin, pout,size,is24fps,quality,crf,deinterlace=deinterlace,uselavf=0,usebluray=bluray,usesar=sar)
\r
95 except Exception, inst:
\r
96 recdblist.addCommonlogEX("Error", "ts2x264_mencoder_old(ts2x264.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)
\r
97 except Exception, inst:
\r
98 recdblist.addCommonlogEX("Error", "ts2x264(ts2x264.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)
\r
99 def encodeMencoderSar(pin,pout,size,is24fps,quality,crf,deinterlace=1,uselavf=0,usebluray=0,usesar=1):
\r
100 mencoder=configreader.getConfPath("mencoder")
\r
101 tee=configreader.getConfPath("tee")
\r
104 encvf="-sws 9 -vf yadif=0,pp=l5"
\r
105 harddup=",hqdn3d=2:1:2,unsharp=l3x3:0.75:c3x3:0.75,harddup"
\r
106 ofps="-ofps 30000/1001"
\r
107 fps="-fps 30000/1001"
\r
108 x264fps="30000/1001 --keyint 30"
\r
112 x264_bitrate="5000"
\r
115 tsar=getMoviePAR2(pin)
\r
117 x264sar=str(tsar[0])+u":"+str(tsar[1])
\r
120 ofps="-ofps 24000/1001"
\r
121 fps="-fps 30000/1001"
\r
122 x264fps="24000/1001 --keyint 24"
\r
123 x264tune="--tune animation"
\r
124 encvf="-sws 9 -vf pullup,softskip"
\r
125 harddup=",pp=l5,unsharp=l3x3:0.75:c3x3:0.75,hqdn3d=2:1:2,harddup"
\r
127 tsize=getParSize(pin,720)
\r
129 encvf = encvf + ",scale=-3:720::0:3"+harddup
\r
130 x264streamsize=str(tsize[0])+u"x720"
\r
132 encvf = encvf + ",scale=-2:720::0:3,expand=1280:720"+harddup
\r
133 x264streamsize=u"1280x720"
\r
134 x264_bitrate="2500"
\r
135 elif size == "WVGA":
\r
136 tsize=getParSize(pin,480)
\r
138 encvf = encvf + ",scale=-3:480::0:3"+harddup
\r
139 x264streamsize=str(tsize[0])+u"x480"
\r
141 encvf = encvf + ",scale=-2:480::0:3,expand=854:480"+harddup
\r
142 x264streamsize=u"854x480"
\r
143 x264_bitrate="1500"
\r
144 elif size == "FullHD":
\r
145 tsize=getParSize(pin,1080)
\r
147 encvf = encvf + ",scale=-3:1080::0:3"+harddup
\r
148 x264streamsize=str(tsize[0])+u"x1080"
\r
150 encvf = encvf + ",scale=-2:1080::0:3,expand=1920:1080"+harddup
\r
151 x264streamsize=u"1920x1080"
\r
152 x264_bitrate="5000"
\r
153 elif size == "QVGA_BASE":
\r
154 tsize=getParSize(pin,240)
\r
156 encvf = encvf + ",scale=-3:240::0:3"+harddup
\r
157 x264streamsize=str(tsize[0])+u"x240"
\r
159 encvf = encvf + ",scale=320:-2::0:3,expand=320:240"+harddup
\r
160 x264streamsize=u"320x240"
\r
162 elif size == "WVGA_BASE":
\r
163 tsize=getParSize(pin,480)
\r
165 encvf = encvf + ",scale=-3:480::0:3"+harddup
\r
166 x264streamsize=str(tsize[0])+u"x480"
\r
168 encvf = encvf + ",scale=-2:480::0:3,expand=854:480"+harddup
\r
169 x264streamsize=u"854x480"
\r
170 x264_bitrate="1500"
\r
172 tsize=getParSize(pin,720)
\r
174 encvf = encvf + ",scale=-3:720::0:3"+harddup
\r
175 x264streamsize=str(tsize[0])+u"x720"
\r
177 encvf = encvf + ",scale=-2:720::0:3,expand=1280:720"+harddup
\r
178 x264streamsize=u"1280x720"
\r
179 x264_bitrate="2500"
\r
181 tsize=getMovieBaseSize2(pin)
\r
182 ofps="-ofps 30000/1001"
\r
183 #fps="-fps 30000/1001"
\r
185 x264fps="30000/1001 --keyint 30"
\r
187 encvf="-vf hqdn3d=2:1:2"
\r
189 encvf=encvf+harddup
\r
190 x264streamsize=str(tsize[0])+u"x"+str(tsize[1])
\r
192 encvf = encvf + ",scale=-2:1080::0:3,expand=1920:1080"+harddup
\r
193 x264streamsize=u"1920x1080"
\r
194 if tsize[0] <= 0 or tsize[1] <= 0:
\r
195 encvf="-sws 9 -vf yadif=0,pp=l5"
\r
196 harddup=",hqdn3d=2:1:2,unsharp=l3x3:0.75:c3x3:0.75,harddup"
\r
197 ofps="-ofps 30000/1001"
\r
198 fps="-fps 30000/1001"
\r
199 x264fps="30000/1001 --keyint 30"
\r
201 encvf = encvf + ",scale=-2:720::0:3,expand=1280:720"+harddup
\r
202 x264streamsize=u"1280x720"
\r
203 x264_bitrate="2500"
\r
205 x264preset=u"ultrafast"
\r
207 x264preset=u"veryfast"
\r
211 x264preset=u"medium"
\r
215 x264preset=u"slower"
\r
217 x264preset=u"medium"
\r
218 if size == "WVGA_BASE" or size == "QVGA_BASE":
\r
219 x264profile=" --level 32 --profile baseline "
\r
221 x264profile=" --level 41 --profile high "
\r
223 lavft="-demuxer lavf "
\r
225 os.environ['LANG']="ja_JP.UTF-8"
\r
227 random.jumpahead(10)
\r
228 temptime=int(time.time())
\r
229 temptime=temptime % 9697
\r
230 random.jumpahead(temptime)
\r
231 streampath=os.path.join(os.path.dirname(pin),str(random.randint(10000, 99999999)))
\r
232 unicode(commands.getoutput(u"mkfifo "+streampath),'utf-8','ignore')
\r
233 logmencoder=recdblist.getLogTitle(pin)+".mencoder.log"
\r
234 logx264=recdblist.getLogTitle(pin)+".x264.log"
\r
235 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
236 encexe=encexe+getX264Commandline(x264preset, x264sar, x264fps, x264profile, x264tune, pout, streampath, x264streamsize, crf=x264crf,interlaced=x264interlaced,bluray=usebluray)
\r
237 #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
238 encexe=u"nice -n 19 " +encexe+" 2>&1 | "+tee+" \""+logx264+"\""
\r
240 recdblist.addCommandSelfLog(pin, encexe)
\r
241 except Exception, inst:
\r
244 print traceback.print_exc(file=sys.stdout)
\r
245 recdblist.printutf8(encexe)
\r
248 txt=unicode(commands.getoutput(encexe.encode('utf-8')),'utf-8','ignore')
\r
251 os.remove(streampath)
\r
252 zip.addFile2FileZip(logmencoder, recdblist.getLogTitle(pin)+".log.zip")
\r
253 zip.addFile2FileZip(logx264, recdblist.getLogTitle(pin)+".log.zip")
\r
254 os.remove(logmencoder)
\r
256 recdblist.addCommandLog(pin, u"Mencoder", encexe, txt)
\r
257 # recdblist.addCommandLogTar(pin,u"Mencoder","mencoder", encexe,txt)
\r
258 def encodeFfmpegSar(pin,pout,size,is24fps,quality,crf,deinterlace=1,usebluray=0,usesar=1):
\r
262 ffmpeg=configreader.getConfPath("ffmpeg")
\r
263 tee=configreader.getConfPath("tee")
\r
264 fps=u"-r 29.970030 "
\r
265 x264fps="30000/1001 --keyint 30"
\r
269 x264_bitrate="2500"
\r
272 tsar=getMoviePAR2(pin)
\r
273 filter="-deinterlace"
\r
274 x264sar=str(tsar[0])+":"+str(tsar[1])
\r
276 fps=u"-r 23.976023 "
\r
277 x264fps="24000/1001 --keyint 24"
\r
278 x264tune="--tune animation"
\r
280 tsize=getParSize(pin,720)
\r
281 s = "-s "+str(tsize[0])+"x720 "
\r
282 x264streamsize=str(tsize[0])+u"x720"
\r
283 x264_bitrate="2500"
\r
284 elif size == "WVGA":
\r
285 tsize=getParSize(pin,480)
\r
286 s = "-s "+str(tsize[0])+"x480 "
\r
287 x264streamsize=str(tsize[0])+u"x480"
\r
288 x264_bitrate="1500"
\r
289 elif size == "FullHD":
\r
290 tsize=getParSize(pin,1080)
\r
291 s = "-s "+str(tsize[0])+"x1080 "
\r
292 x264streamsize=str(tsize[0])+u"x1080"
\r
293 x264_bitrate="5000"
\r
295 tsize=getParSize(pin,480)
\r
296 s = "-s "+str(tsize[0])+"x480 "
\r
297 x264streamsize=str(tsize[0])+u"x480"
\r
298 x264_bitrate="1250"
\r
299 elif size == "QVGA_BASE":
\r
300 tsize=getParSize(pin,240)
\r
301 s = "-s "+str(tsize[0])+"x240 "
\r
302 x264streamsize=str(tsize[0])+u"x240"
\r
304 elif size == "WVGA_BASE":
\r
305 tsize=getParSize(pin,480)
\r
306 s = "-s "+str(tsize[0])+"x480 "
\r
307 x264streamsize=str(tsize[0])+u"x480"
\r
308 x264_bitrate="1500"
\r
310 tsize=getParSize(pin,720)
\r
311 s = "-s "+str(tsize[0])+"x720 "
\r
312 x264streamsize=str(tsize[0])+u"x720"
\r
313 x264_bitrate="2500"
\r
315 tsize=getMovieBaseSize2(pin)
\r
317 s = "-s "+str(tsize[0])+"x"+str(tsize[1])+" "
\r
318 x264fps="30000/1001 --keyint 30"
\r
321 x264streamsize=str(tsize[0])+u"x"+str(tsize[1])
\r
323 x264preset=u"ultrafast"
\r
325 x264preset=u"veryfast"
\r
329 x264preset=u"medium"
\r
333 x264preset=u"slower"
\r
335 x264preset=u"medium"
\r
336 if size == "WVGA_BASE" or size == "QVGA_BASE":
\r
337 x264profile=" --level 32 --profile baseline "
\r
339 x264profile=" --level 41 --profile high "
\r
342 os.environ['LANG']="ja_JP.UTF-8"
\r
343 log_ffmpeg=recdblist.getLogTitle(pin)+".ffmpeg.log"
\r
344 log_x264=recdblist.getLogTitle(pin)+".x264.log"
\r
345 exe=ffmpeg+u" -y -i \""+pin+"\" -vsync 400 -vcodec rawvideo -pix_fmt yuv420p "+s+fps+" "+filter+" -an -f rawvideo - 2> \""+log_ffmpeg+"\" | "
\r
346 exe=exe+getX264Commandline(x264preset, x264sar, x264fps, x264profile, x264tune, pout,"-", x264streamsize, crf=x264crf,interlaced=x264interlaced,bluray=usebluray)
\r
347 exe = "nice -n 19 " + exe+" 2>&1 | "+tee+" \""+log_x264+"\""
\r
349 #recdblist.addCommandSelfLog(log_ffmpeg,recdblist.getLogTitle(pin)+".log.zip")
\r
350 #recdblist.addCommandSelfLog(log_x264,recdblist.getLogTitle(pin)+".log.zip")
\r
351 recdblist.printutf8(exe)
\r
352 recdblist.addCommandSelfLog(pin,exe)
\r
354 txt=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
\r
357 recdblist.addCommandLog(pin, u"FFmpeg動画エンコード", exe, txt)
\r
358 zip.addFile2FileZip(log_ffmpeg, recdblist.getLogTitle(pin+".log.zip"))
\r
359 zip.addFile2FileZip(log_x264, recdblist.getLogTitle(pin+".log.zip"))
\r
360 os.remove(log_ffmpeg)
\r
361 os.remove(log_x264)
\r
362 def getMovieBaseSize(pin):
\r
363 ffmpeg=configreader.getConfPath("ffmpeg")
\r
364 os.environ['LANG']="ja_JP.UTF-8"
\r
365 exe=ffmpeg+u" -i \""+pin+"\" 2>&1"
\r
366 txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
\r
367 rT=re.compile(u".*Stream.*#.*:.*\D+([\d]+x[\d]+)\D+PAR\D+(\d+:\d+)\D+.*\Z")
\r
370 txtls=txts.split("\n")
\r
374 sizetxt=rM.group(1)
\r
376 tX=int(sizetxt.split("x")[0])
\r
377 tY=int(sizetxt.split("x")[1])
\r
378 tEX=int(partxt.split(":")[0])
\r
379 tEY=int(partxt.split(":")[1])
\r
383 return [sizeMaxX,sizeMaxY]
\r
384 def getMovieBaseSize2(pin):##動画開始後すぐに解像度が変更されたときに対処
\r
385 ffmpeg=configreader.getConfPath("ffmpeg")
\r
386 os.environ['LANG']="ja_JP.UTF-8"
\r
387 exe=ffmpeg+u" -ss 5 -fs 1 -i \""+pin+"\" \""+pin+".size.ts\" 2>&1"
\r
389 recdblist.addCommandSelfLog(pin, exe)
\r
390 except Exception, inst:
\r
393 print traceback.print_exc(file=sys.stdout)
\r
394 txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
\r
395 rT=re.compile(u"Stream.*#.*:.*\D+([\d]+x[\d]+)\D+PAR\D+(\d+:\d+)\D+.*\Z")
\r
398 txtls=txts.split("\n")
\r
402 sizetxt=rM.group(1)
\r
404 tX=int(sizetxt.split("x")[0])
\r
405 tY=int(sizetxt.split("x")[1])
\r
406 tEX=int(partxt.split(":")[0])
\r
407 tEY=int(partxt.split(":")[1])
\r
411 os.remove(pin+".size.ts")
\r
412 return [sizeMaxX,sizeMaxY]
\r
413 def getMoviePAR(pin):
\r
414 ffmpeg=configreader.getConfPath("ffmpeg")
\r
415 os.environ['LANG']="ja_JP.UTF-8"
\r
416 exe=ffmpeg+u" -i \""+pin+"\" 2>&1"
\r
417 txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
\r
418 rT=re.compile(u".*Stream.*#.*:.*\D+([\d]+x[\d]+)\D+PAR\D+(\d+:\d+)\D+.*\Z")
\r
422 txtls=txts.split("\n")
\r
426 sizetxt=rM.group(1)
\r
428 tX=int(sizetxt.split("x")[0])
\r
429 tY=int(sizetxt.split("x")[1])
\r
430 tEX=int(dartxt.split(":")[0])
\r
431 tEY=int(dartxt.split(":")[1])
\r
434 if tX==1920 and tY==1080:
\r
441 def getMoviePAR2(pin):
\r
442 ffmpeg=configreader.getConfPath("ffmpeg")
\r
443 os.environ['LANG']="ja_JP.UTF-8"
\r
444 exe=ffmpeg+u" -ss 5 -fs 1 -i \""+pin+"\" \""+pin+".size.ts\" 2>&1"
\r
446 recdblist.addCommandSelfLog(pin, exe)
\r
447 except Exception, inst:
\r
450 print traceback.print_exc(file=sys.stdout)
\r
451 txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
\r
452 rT=re.compile(u".*Stream.*#.*:.*\D+([\d]+x[\d]+)\D+PAR\D+(\d+:\d+)\D+.*\Z")
\r
456 txtls=txts.split("\n")
\r
460 sizetxt=rM.group(1)
\r
462 tX=int(sizetxt.split("x")[0])
\r
463 tY=int(sizetxt.split("x")[1])
\r
464 tEX=int(dartxt.split(":")[0])
\r
465 tEY=int(dartxt.split(":")[1])
\r
468 if tX==1920 and tY==1080:
\r
474 os.remove(pin+".size.ts")
\r
476 def getMovieDAR(pin):
\r
477 ffmpeg=configreader.getConfPath("ffmpeg")
\r
478 os.environ['LANG']="ja_JP.UTF-8"
\r
479 exe=ffmpeg+u" -i \""+pin+"\" 2>&1"
\r
480 txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
\r
481 rT=re.compile(u".*Stream.*#.*:.*\D+([\d]+x[\d]+)\D+.*DAR\D+(\d+:\d+)\D+.*\Z")
\r
485 txtls=txts.split("\n")
\r
489 sizetxt=rM.group(1)
\r
491 tX=int(sizetxt.split("x")[0])
\r
492 tY=int(sizetxt.split("x")[1])
\r
493 tEX=int(dartxt.split(":")[0])
\r
494 tEY=int(dartxt.split(":")[1])
\r
497 if tX==1920 and tY==1080:
\r
504 def getMovieDAR2(pin):
\r
505 ffmpeg=configreader.getConfPath("ffmpeg")
\r
506 os.environ['LANG']="ja_JP.UTF-8"
\r
507 exe=ffmpeg+u" -ss 5 -fs 1 -i \""+pin+"\" \""+pin+".size.ts\" 2>&1"
\r
508 txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
\r
509 rT=re.compile(u".*Stream.*#.*:.*\D+([\d]+x[\d]+)\D+.*DAR\D+(\d+:\d+)\D+.*\Z")
\r
513 txtls=txts.split("\n")
\r
517 sizetxt=rM.group(1)
\r
519 tX=int(sizetxt.split("x")[0])
\r
520 tY=int(sizetxt.split("x")[1])
\r
521 tEX=int(dartxt.split(":")[0])
\r
522 tEY=int(dartxt.split(":")[1])
\r
525 if tX==1920 and tY==1080:
\r
531 os.remove(pin+".size.ts")
\r
533 def getParSize(pin,y):
\r
534 tSize=getMovieBaseSize2(pin)
\r
536 tX=tSize[0]*10*y/tSize[1]
\r
538 if tX>int(tX/10)*10:
\r
546 def getX264CoreVersion():
\r
547 x264=configreader.getConfPath("x264")
\r
549 t1=commands.getoutput(x264+" --help|grep core")
\r
551 rT=re.compile(u"x264 core:(\d*)[\d]*.*\Z")
\r
557 def getX264Commandline(preset,sar,fps,x264profile,x264tune,pout,pin,x264streamsize,crf=-1,bitrate=0,interlaced=0,bluray=0):
\r
558 x264=configreader.getConfPath("x264")
\r
559 os.environ['LANG']="ja_JP.UTF-8"
\r
560 x264_sar="--sar "+sar
\r
561 x264preset=u"--preset "+preset
\r
562 x264fps="--fps "+fps
\r
565 x264_addline=configreader.getConfEnv("x264_addline")
\r
567 x264bitrate=u"--bitrate "+str(bitrate)
\r
569 x264crf=u"--crf "+str(crf)
\r
571 x264interlaced="--tff --nal-hrd vbr"
\r
573 if getX264CoreVersion()<115:
\r
574 x264bluray=" --weightp 1 --nal-hrd vbr --bframes 3 --b-pyramid none --open-gop bluray --slices 4 --aud --colorprim bt709 --transfer bt709 "
\r
576 if fps=="24000/1001 --keyint 24" or fps =="24000/1001":
\r
577 if x264streamsize=="1280x720":
\r
578 x264bluray=u"--ref 6 "+x264bluray
\r
579 if x264streamsize=="1920x1080":
\r
580 x264bluray=u"--ref 3 "+x264bluray
\r
581 elif fps=="30000/1001 --keyint 30" or fps =="30000/1001":
\r
582 if x264streamsize=="1280x720":
\r
583 x264bluray=u"--ref 6 --pulldown double "+x264bluray
\r
584 if x264streamsize=="1920x1080":
\r
586 x264bluray=u"--ref 3 --fake-interlaced --pic-struct "+x264bluray
\r
588 x264bluray=u"--ref 3 "+x264bluray
\r
589 elif getX264CoreVersion()>=115:
\r
590 x264bluray=" --slices 4 --bluray-compat --open-gop --nal-hrd vbr --bframes 3 --b-pyramid none --aud --colorprim bt709 --transfer bt709 "
\r
592 if fps=="24000/1001 --keyint 24" or fps =="24000/1001":
\r
593 if x264streamsize=="1280x720":
\r
594 x264bluray=u"--ref 6 "+x264bluray
\r
595 if x264streamsize=="1920x1080":
\r
596 x264bluray=u"--ref 3 "+x264bluray
\r
597 elif fps=="30000/1001 --keyint 30" or fps =="30000/1001":
\r
598 if x264streamsize=="1280x720":
\r
599 x264bluray=u"--fake-interlaced --ref 6 --pulldown double "+x264bluray
\r
600 if x264streamsize=="1920x1080":
\r
602 x264bluray=u"--ref 3 --fake-interlaced --pic-struct "+x264bluray
\r
604 x264bluray=u"--ref 3 "+x264bluray
\r
607 xtt=configreader.getConfEnv("x264_thread")
\r
610 x264_thread=str(xtt)
\r
613 x264_addline=configreader.getConfEnv("x264_addline")
\r
614 if getX264CoreVersion()>103:
\r
615 x264res=u"--input-res "+x264streamsize
\r
616 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
618 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