3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009 Yukikaze
10 def ts2x264(pin,pout,opts):#sizeは"HD"か"SD"
11 pout = pout.encode('utf-8')
12 pin = pin.encode('utf-8')
14 pinで指定されたファイルをpoutにx264でエンコードして書き出す
17 status.setEncoding(status.getEncoding()+1)
22 if re.search("a",opts):
26 if re.search("2",opts):
28 if re.search("Q",opts):
30 if re.search("F",opts):
32 if re.search("H",opts):
34 if re.search("S",opts):
37 encvf="-vf pullup,softskip,pp=l5,"
41 encvf=encvf+"scale=720:480,harddup"
42 bitrate="bitrate=1250"
44 encvf=encvf+"scale=1280:720,harddup"
45 bitrate="bitrate=2000"
47 encvf=encvf+"scale=1920:1080,harddup"
48 bitrate="bitrate=2500"
50 encvf=encvf+"scale=400:240,harddup"
53 encvf=encvf+"scale=1280:720,harddup"
54 bitrate="bitrate=2000"
57 pas1exe="mencoder \'"+pin+"\' -ovc x264 "+encvf+" -x264encopts "+bitrate+":threads=auto:pass=1:turbo=2 -passlogfile "+pin+".log "+"-oac mp3lame -lameopts cbr:br=128 -o /dev/null"
58 pas2exe="mencoder \'"+pin+"\' -ovc x264 "+encvf+" -x264encopts "+bitrate+":threads=auto:pass=2 -passlogfile "+pin+".log "+"-oac mp3lame -lameopts cbr:br=128 -o \'"+pout+"\'"
59 pas1exe="/usr/bin/nice -n 19 "+pas1exe
60 pas2exe="/usr/bin/nice -n 19 "+pas2exe
67 pas1exe="mencoder \'"+pin+"\' -ovc x264 "+encvf+" -x264encopts "+bitrate+":threads=auto -oac mp3lame -lameopts cbr:br=128 -o \'"+pout+"\'"
69 status.setEncoding(status.getEncoding()-1)