OSDN Git Service

implement interlaced encode option(alpha ver).
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Sun, 18 Jul 2010 04:45:26 +0000 (04:45 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Sun, 18 Jul 2010 04:45:26 +0000 (04:45 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@649 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/ts2x264.py

index 503fd0d..e2c1975 100644 (file)
@@ -138,13 +138,15 @@ def encode_sar(pin,pout,size,is24fps,quality,crf,deinterlace=1):
         x264streamsize=str(tsize[0])+u"x720"
         x264_bitrate="2500"
     if deinterlace==0:
+        tsize=getMovieBaseSize(pin)
         ofps="-ofps 30000/1001"
         fps="-fps 30000/1001"
         x264fps="--fps 30000/1001"
-        x264tune="--tune animation --tff --nal-hrd vbr"
+        x264tune=x264tune+" --tff --nal-hrd vbr"
         encvf="-vf hqdn3d=2:1:2"
         harddup=",harddup"
         encvf=encvf+harddup
+        x264streamsize=str(tsize[0])+u"x"+str(tsize[1])
     if quality==1:
         x264preset=u"--preset ultrafast"
     elif quality==2:
@@ -267,36 +269,7 @@ def encode_ffmpeg_sar(pin,pout,size,is24fps,quality,crf,deinterlace=1):
     except:
         ""
     recdblist.addCommandLog(pin, u"FFmpeg動画エンコード", exe, txt)
-def getMovieSize(pin):
-    ffmpeg=configreader.getpath("ffmpeg")
-    os.environ['LANG']="ja_JP.UTF-8"
-    exe=ffmpeg+u" -i \""+pin+"\" 2>&1"
-    txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8')
-    rT=re.compile(u".*Stream.*#.*:.*\D+([\d]+x[\d]+)\D+PAR\D+(\d+:\d+)\D+.*\Z")
-    sizeMaxX=0
-    sizeMaxY=0
-    txtls=txts.split("\n")
-    for t in txtls:
-        rM=rT.match(t)
-        if rM:
-            sizetxt=rM.group(1)
-            partxt=rM.group(2)
-            tX=int(sizetxt.split("x")[0])
-            tY=int(sizetxt.split("x")[1])
-            tEX=int(partxt.split(":")[0])
-            tEY=int(partxt.split(":")[1])
-            if tX==1920 and tY==1080:
-                tEX=1
-                tEY=1
-            tX2=tX*tEX*10/tEY
-            if tX2>10*int(tX2/10):
-                tX2=tX2/10+1
-            else:
-                tX2=tX2/10
-            if sizeMaxX<tX2:
-                sizeMaxX=tX2
-                sizeMaxY=tY
-    return [sizeMaxX,sizeMaxY]
+
 def getMovieBaseSize(pin):
     ffmpeg=configreader.getpath("ffmpeg")
     os.environ['LANG']="ja_JP.UTF-8"
@@ -376,21 +349,6 @@ def getMovieDAR(pin):
                     darx=tEX
                     dary=tEY
     return [darx,dary]
-def get16_9ffmpeg_s(pin,x,y):
-    try:
-        tDAR=getMovieDAR(pin)
-        if (tDAR[0]==16 and tDAR[1]==9):
-            return 0
-        elif tDAR==[0,0]:
-            return 0
-        else:
-            tSize=getMovieSize(pin)
-            tn=x-tSize[1]*x/tSize[0]
-            tn=tn/4
-            tn=tn*2#偶数にするための処理
-            return tn
-    except:
-        return 0
 def get_par_size(pin,y):
     tSize=getMovieBaseSize(pin)
     tX=tSize[0]*10*y/tSize[1]