Author: duncan
Date: Fri Jan 19 20:11:42 2007
New Revision: 9004

Modified:
   branches/rel-1/freevo/src/commdetectcore.py

Log:
[ 1639805 ] Commercial Detection tweaks
Changed the commercial detection to be less forgiving (air on the side of 
caution) and removed a useless if check
Patch from Justin Wetherell applied


Modified: branches/rel-1/freevo/src/commdetectcore.py
==============================================================================
--- branches/rel-1/freevo/src/commdetectcore.py (original)
+++ branches/rel-1/freevo/src/commdetectcore.py Fri Jan 19 20:11:42 2007
@@ -53,7 +53,7 @@
         self.edlList=[]
         videoCodec='-ovc lavc'
         nosound='-nosound'
-        videoFilter='-vf blackframe=98:48'
+        videoFilter='-vf blackframe'
         output='-o /dev/null'
         grep='| grep vf_blackframe'
         outfile='> /tmp/blackframes.txt'
@@ -115,30 +115,28 @@
         startFrameTime=0
         endFrame=None
         for bframe in self.blackframes:
-            if bframe.time!=0:
-               #Throw out first black frame
-               if (startFrameTime==0):
-                  #Commerical break
-                  startFrame=bframe
+            if (startFrameTime==0):
+               #Commerical break
+               startFrame=bframe
+               startFrameTime=bframe.time
+            else:
+               if 
((bframe.time==startFrameTime)or(bframe.time==(startFrameTime-1))):
+                  #Same commercial break
                   startFrameTime=bframe.time
+                  endFrame=bframe
                else:
-                  if 
((bframe.time==startFrameTime)or(bframe.time==(startFrameTime-1))):
-                     #Same commercial break
-                     startFrameTime=bframe.time
-                     endFrame=bframe
-                  else:
-                     #New commercial break
-                     if not endFrame:
-                        #Sometimes a blackframe is thrown in the beginning
-                        endFrame=startFrame
-                     if ((endFrame.seconds-startFrame.seconds)>0):
-                        newEdl = self.edl()
-                        newEdl.startSkipTime=startFrame.seconds
-                        newEdl.endSkipTime=endFrame.seconds
-                        self.edlList.append(newEdl)
-                     startFrame=None
-                     startFrameTime=0
-                     endFrame=None
+                  #New commercial break
+                  if not endFrame:
+                     #Sometimes a blackframe is thrown in the beginning
+                     endFrame=startFrame
+                  if ((endFrame.seconds-startFrame.seconds)>0):
+                     newEdl = self.edl()
+                     newEdl.startSkipTime=startFrame.seconds
+                     newEdl.endSkipTime=endFrame.seconds
+                     self.edlList.append(newEdl)
+                  startFrame=None
+                  startFrameTime=0
+                  endFrame=None
         if ((len(self.edlList)==0)and(startFrame and endFrame)):
            #Only one commercial
            newEdl = self.edl()

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to