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 if re.search("a", opts):
22 if re.search("2", opts):
24 if re.search("H", opts):
26 if re.search("S", opts):
28 if re.search("F", opts):
30 if re.search("L", opts):
32 if re.search("G", opts):
34 encode(pin, pout,size,isAnime,dualpass)
35 def encode(pin,pout,size,isAnime,is2pass):
39 encvf = "-vf yadif=3,pp=l5,framestep=2,"
41 encvf = "-vf yadif=3,pp=l5,framestep=2,"
43 encvf = encvf + "scale=1280:720,harddup"
44 bitrate = "bitrate=" + tv2avi.Bitrate_HD
46 encvf = encvf + "scale=720:480,harddup"
47 bitrate = "bitrate=" + tv2avi.Bitrate_SD
49 encvf = encvf + "scale=1920:1080,harddup"
50 bitrate = "bitrate=" + tv2avi.Bitrate_FHD
52 encvf = encvf + "harddup"
53 bitrate = "bitrate=" + tv2avi.Bitrate_Short
55 encvf = encvf + "scale=1280:720,harddup"
56 bitrate = "bitrate=" + tv2avi.Bitrate_LowHD
58 encvf = encvf + "scale=1280:720,harddup"
59 bitrate = "bitrate=" + tv2avi.Bitrate_HD
61 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"
62 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 + "\'"
63 pas1exe = "nice -n 19 " + pas1exe
64 pas2exe = "nice -n 19 " + pas2exe
66 txt=txt+commands.getoutput(pas1exe)
69 txt=txt+commands.getoutput(pas2exe)
71 pas1exe = "mencoder \'" + pin + "\' -quiet -ovc x264 " + encvf + " -ofps 30000/1001 -x264encopts " + bitrate + ":threads=auto -oac mp3lame -lameopts cbr:br=128 -o \'" + pout + "\'"
72 pas1exe = "nice -n 19 " + pas1exe
74 txt=txt+commands.getoutput(pas1exe)
76 logo=logo.replace(".sa.avi",".ts")
77 logo=logo.replace(".ts",".log")
89 txt="\n####mencoder-log_"+size+"####\n"+stxt