OSDN Git Service

fix many bug.
[rec10/rec10-git.git] / rec10 / trunk / src / ts2x264.py
index 59dd78d..5356fc2 100644 (file)
@@ -37,41 +37,48 @@ def ts2x264(pin, pout, opts):#sizeは"HD"か"SD"
 def encode(pin,pout,size,isvfr,is2pass):
     encvf=""
     txt=""
-    encvf="-vf yadif=0"
+    encvf="-vf yadif=0,pp=mb"
     harddup=",harddup"
     ofps="-ofps 30000/1001"
     bm=1
     scale=""
     x264enc1=""
     x264enc2=""
+    crf=""
     if isvfr==1:
         ofps="-ofps 120000/1001"
-        encvf="-vf pullup,softskip,yadif=0"
+        encvf="-vf pullup,softskip,pp=mb"
         bm=4
-        x264enc1=":frameref=3:me=hex"
-        x264enc2=":frameref=3:subq=7:partitions=all:8x8dct:me=umh:bframes=3:b_pyramid:weight_b"
+        x264enc1=":me=hex:bframes=3"
+        x264enc2=":frameref=3:subq=7:partitions=all:8x8dct:direct=auto:me=umh:bframes=3:weight_b"
         harddup=""
     if size == "HD":
-        encvf = encvf + ",scale=1280:720"+harddup
+        encvf = encvf + ",scale=1280:720::0:4"+harddup
         bitrate = "bitrate=" + str(tv2avi.Bitrate_HD*bm)
+        crf="crf=20"
     elif size == "SD":
-        encvf = encvf + ",scale=720:480"+harddup
+        encvf = encvf + ",scale=720:480::0:4"+harddup
         bitrate = "bitrate=" + str(tv2avi.Bitrate_SD*bm)
+        crf="crf=20"
     elif size == "FHD":
-        encvf = encvf + ",scale=1920:1080"+harddup
+        encvf = encvf + ",scale=1920:1080::0:4"+harddup
         bitrate = "bitrate=" + str(tv2avi.Bitrate_FHD*bm)
+        crf="crf=22"
     elif size == "Short":
         encvf = encvf +harddup
         bitrate = "bitrate=" + str(tv2avi.Bitrate_Short*bm)
+        crf="crf=20"
     elif size == "LowHD":
-        encvf = encvf + ",scale=1280:720"+harddup
+        encvf = encvf + ",scale=1280:720::0:4"+harddup
         bitrate = "bitrate=" + str(tv2avi.Bitrate_LowHD*bm)
+        crf="crf=22"
     else:
-        encvf = encvf + ",scale=1280:720"+harddup
+        encvf = encvf + ",scale=1280:720::0:4"+harddup
         bitrate = "bitrate=" + str(tv2avi.Bitrate_HD*bm)
+        crf="crf=22"
     if is2pass == 1:
-        pas1exe = "mencoder \'" + pin + "\' -quiet -ovc x264 " + encvf + " "+ofps+" -x264encopts " + bitrate +x264enc1+ ":threads=auto:pass=1:turbo=2 -passlogfile \'" + pin + ".log\' " + "-oac mp3lame -lameopts cbr:br=128 -o /dev/null"
-        pas2exe = "mencoder \'" + pin + "\' -quiet -ovc x264 " + encvf + " "+ofps+" -x264encopts " + bitrate +x264enc2+ ":threads=auto:pass=2 -passlogfile \'" + pin + ".log\' " + "-oac mp3lame -lameopts cbr:br=128 -o \'" + pout + "\'"
+        pas1exe = "mencoder \'" + pin + "\' -noskip -quiet -nosound -sws 9 -ovc x264 " + encvf + " "+ofps+" -x264encopts " + bitrate +x264enc1+ ":threads=auto:pass=1:turbo=2 -passlogfile \'" + pin + ".log\' " + " -o /dev/null"
+        pas2exe = "mencoder \'" + pin + "\' -noskip -noodml -quiet -nosound -sws 9 -ovc x264 " + encvf + " "+ofps+" -x264encopts " + bitrate +x264enc2+ ":threads=auto:pass=2 -passlogfile \'" + pin + ".log\' " + " -o \'" + pout + "\'"
         pas1exe = "nice -n 19 " + pas1exe
         pas2exe = "nice -n 19 " + pas2exe
         recdblist.printutf8(pas1exe)
@@ -80,7 +87,7 @@ def encode(pin,pout,size,isvfr,is2pass):
         time.sleep(5)
         txt=txt+unicode(commands.getoutput(pas2exe.encode('utf-8')),'utf-8')
     else:
-        pas1exe = "mencoder \'" + pin + "\' -quiet -ovc x264 " + encvf + " "+ofps+" -x264encopts " + bitrate +x264enc2+":threads=auto -oac mp3lame -lameopts cbr:br=128  -o \'" + pout + "\'"
+        pas1exe = "mencoder \'" + pin + "\' -noskip -noodml -nosound -quiet -sws 9 -ovc x264 " + encvf + " "+ofps+" -x264encopts " + bitrate +x264enc2+":threads=auto -o \'" + pout + "\'"
         pas1exe = "nice -n 19 " + pas1exe
         recdblist.printutf8(pas1exe)
         txt=txt+unicode(commands.getoutput(pas1exe.encode('utf-8')),'utf-8')