3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009 Yukikaze
11 def ts2x264(pin, pout, opts):#sizeは"HD"か"SD"
13 pinで指定されたファイルをpoutにx264でエンコードして書き出す
16 if re.search("a", opts):
21 if re.search("2", opts):
23 if re.search("H", opts):
25 if re.search("S", opts):
27 if re.search("F", opts):
29 if re.search("L", opts):
31 if re.search("G", opts):
33 encode(pin, pout,size,isAnime,dualpass)
34 def encode(pin,pout,size,isAnime,is2pass):
38 encvf = "-vf yadif=0,"
40 encvf = "-vf yadif=0,"
42 encvf = encvf + "scale=1280:720,harddup"
43 bitrate = "bitrate=" + tv2avi.Bitrate_HD
45 encvf = encvf + "scale=720:480,harddup"
46 bitrate = "bitrate=" + tv2avi.Bitrate_SD
48 encvf = encvf + "scale=1920:1080,harddup"
49 bitrate = "bitrate=" + tv2avi.Bitrate_FHD
51 encvf = encvf + "harddup"
52 bitrate = "bitrate=" + tv2avi.Bitrate_Short
54 encvf = encvf + "scale=1280:720,harddup"
55 bitrate = "bitrate=" + tv2avi.Bitrate_LowHD
57 encvf = encvf + "scale=1280:720,harddup"
58 bitrate = "bitrate=" + tv2avi.Bitrate_HD
60 pas1exe = "mencoder \'" + pin + "\' -quiet -ovc x264 " + encvf + " -ofps 30000/1001 -x264encopts " + bitrate + ":threads=auto:pass=1:turbo=2 -passlogfile \'" + pin + ".log\' " + "-oac mp3lame -lameopts cbr:br=128 -o /dev/null"
61 pas2exe = "mencoder \'" + pin + "\' -quiet -ovc x264 " + encvf + " -ofps 30000/1001 -x264encopts " + bitrate + ":threads=auto:pass=2 -passlogfile \'" + pin + ".log\' " + "-oac mp3lame -lameopts cbr:br=128 -o \'" + pout + "\'"
62 pas1exe = "nice -n 19 " + pas1exe
63 pas2exe = "nice -n 19 " + pas2exe
64 recdblist.printutf8(pas1exe)
65 txt=txt+unicode(commands.getoutput(pas1exe.encode('utf-8')),'utf-8')
66 recdblist.printutf8(pas2exe)
68 txt=txt+unicode(commands.getoutput(pas2exe.encode('utf-8')),'utf-8')
70 pas1exe = "mencoder \'" + pin + "\' -quiet -ovc x264 " + encvf + " -ofps 30000/1001 -x264encopts " + bitrate + ":threads=auto -oac mp3lame -lameopts cbr:br=128 -o \'" + pout + "\'"
71 pas1exe = "nice -n 19 " + pas1exe
72 recdblist.printutf8(pas1exe)
73 txt=txt+unicode(commands.getoutput(pas1exe.encode('utf-8')),'utf-8')
75 logo=logo.replace(".sa.avi",".ts")
76 logo=logo.replace(".ts",".log")
88 txt="\n####mencoder-log_"+size+"####\n"+stxt
89 f.write(txt.encode('utf-8'))