OSDN Git Service

fix-aspect option using ffmepg implementation almost finished.
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Fri, 18 Jun 2010 05:24:10 +0000 (05:24 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Fri, 18 Jun 2010 05:24:10 +0000 (05:24 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@624 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/ts2x264.py

index 0a9a56f..66485c7 100644 (file)
@@ -337,7 +337,7 @@ def encode_ffmpeg_kai(pin,pout,size,is24fps,quality,crf):
 def getMovieSize(pin):
     ffmpeg=configreader.getpath("ffmpeg")
     os.environ['LANG']="ja_JP.UTF-8"
-    exe=ffmpeg+u" \""+pin+"\" 2>&1"
+    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
@@ -355,6 +355,8 @@ def getMovieSize(pin):
             tX2=tX*tEX*10/tEY
             if tX2>10*int(tX2/10):
                 tX2=tX2/10+1
+            else:
+                tX2=tX2/10
             if sizeMaxX<tX:
                 sizeMaxX=tX2
                 sizeMaxY=tY
@@ -362,9 +364,9 @@ def getMovieSize(pin):
 def getMovieDAR(pin):
     ffmpeg=configreader.getpath("ffmpeg")
     os.environ['LANG']="ja_JP.UTF-8"
-    exe=ffmpeg+u" \""+pin+"\" 2>&1"
+    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+DAR\D+(\d+:\d+)\D+.*\Z")
+    rT=re.compile(u".*Stream.*#.*:.*\D+([\d]+x[\d]+)\D+.*DAR\D+(\d+:\d+)\D+.*\Z")
     sizeMaxX=0
     darx=0
     dary=0
@@ -388,9 +390,11 @@ def get16_9ffmpeg_s(pin,x,y):
         tDAR=getMovieDAR(pin)
         if (tDAR[0]==16 and tDAR[1]==9):
             return 0
+        elif tDAR==[0,0]:
+            return 0
         else:
             tSize=getMovieSize(pin)
-            tn=y-tSize[1]*x/tSize[0]
+            tn=x-tSize[1]*x/tSize[0]
             tn=tn/4
             tn=tn*2#偶数にするための処理
             return tn