OSDN Git Service

implement interlaced encode option(alpha ver).
[rec10/rec10-git.git] / rec10 / trunk / src / ts2x264.py
index c131ea9..503fd0d 100644 (file)
@@ -80,7 +80,7 @@ def encode_sar(pin,pout,size,is24fps,quality,crf,deinterlace=1):
     x264=configreader.getpath("x264")
     encvf=""
     txt=""
-    encvf="-vf yadif=0,pp=l5"
+    encvf="-sws 9 -vf yadif=0,pp=l5"
     harddup=",hqdn3d=2:1:2,unsharp=l3x3:0.75:c3x3:0.75,harddup"
     ofps="-ofps 30000/1001"
     fps="-fps 30000/1001"
@@ -105,15 +105,8 @@ def encode_sar(pin,pout,size,is24fps,quality,crf,deinterlace=1):
         fps="-fps 30000/1001"
         x264fps="--fps 24000/1001"
         x264tune="--tune animation"
-        encvf="-vf pullup,softskip"
+        encvf="-sws 9 -vf pullup,softskip"
         harddup=",pp=l5,unsharp=l3x3:0.75:c3x3:0.75,hqdn3d=2:1:2,harddup"
-    if deinterlace==0:
-        ofps="-ofps 60000/1001"
-        fps="-fps 60000/1001"
-        x264fps="--fps 60000/1001"
-        x264tune="--tune animation --tff --nal-hrd vbr"
-        encvf="-vf hqdn3d=2:1:2"
-        harddup=",harddup"
     if size == "HD":
         tsize=get_par_size(pin,720)
         encvf = encvf + ",scale=-3:720::0:3"+harddup
@@ -144,6 +137,14 @@ def encode_sar(pin,pout,size,is24fps,quality,crf,deinterlace=1):
         encvf = encvf + ",scale=-3:720::0:3"+harddup
         x264streamsize=str(tsize[0])+u"x720"
         x264_bitrate="2500"
+    if deinterlace==0:
+        ofps="-ofps 30000/1001"
+        fps="-fps 30000/1001"
+        x264fps="--fps 30000/1001"
+        x264tune="--tune animation --tff --nal-hrd vbr"
+        encvf="-vf hqdn3d=2:1:2"
+        harddup=",harddup"
+        encvf=encvf+harddup
     if quality==1:
         x264preset=u"--preset ultrafast"
     elif quality==2:
@@ -166,7 +167,7 @@ def encode_sar(pin,pout,size,is24fps,quality,crf,deinterlace=1):
     random.jumpahead(10)
     streampath=os.path.join(os.path.dirname(pin),str(random.randint(10000, 999999)))
     os.system(u"mkfifo "+streampath)
-    encexe=mencoder+u" \""+pin+u"\" -vfm ffmpeg -quiet -sws 9 "+encvf+u",format=i420 "+fps+" "+ofps+" -oac mp3lame -ovc raw -of rawvideo -o \""+streampath+"\" &"
+    encexe=mencoder+u" \""+pin+u"\" -vfm ffmpeg -quiet "+encvf+u",format=i420 "+fps+" "+ofps+" -oac mp3lame -ovc raw -of rawvideo -o \""+streampath+"\" &"
     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
     encexe=u"nice -n 19 " +encexe
     recdblist.printutf8(encexe)