diff --git a/mythtv/programs/mythcommflag/ClassicCommDetector.cpp b/mythtv/programs/mythcommflag/ClassicCommDetector.cpp
index 800e83d..bb83323 100644
--- a/mythtv/programs/mythcommflag/ClassicCommDetector.cpp
+++ b/mythtv/programs/mythcommflag/ClassicCommDetector.cpp
@@ -245,13 +222,13 @@ void ClassicCommDetector::Init()
     decoderFoundAspectChanges = false;
 
     lastSentCommBreakMap.clear();
 
     // Check if close to 4:3
     if (fabs(((width*1.0)/height) - 1.333333) < 0.1)
         currentAspect = COMM_ASPECT_NORMAL;
 
     sceneChangeDetector = new ClassicSceneChangeDetector(width, height,
-        commDetectBorder, horizSpacing, vertSpacing);
+        commDetectBorder, fps);
     connect(
          sceneChangeDetector,
          SIGNAL(haveNewInformation(unsigned int,bool,float)),
diff --git a/mythtv/programs/mythcommflag/ClassicSceneChangeDetector.cpp b/mythtv/programs/mythcommflag/ClassicSceneChangeDetector.cpp
index c449353..ff096a5 100644
--- a/mythtv/programs/mythcommflag/ClassicSceneChangeDetector.cpp
+++ b/mythtv/programs/mythcommflag/ClassicSceneChangeDetector.cpp
@@ -6,40 +6,65 @@ using namespace std;
 
 ClassicSceneChangeDetector::ClassicSceneChangeDetector(unsigned int width,
         unsigned int height, unsigned int commdetectborder_in,
-        unsigned int xspacing_in, unsigned int yspacing_in):
+        unsigned int fps_in):
     SceneChangeDetectorBase(width,height),
-    frameNumber(0),
-    previousFrameWasSceneChange(false),
-    xspacing(xspacing_in),
-    yspacing(yspacing_in),
-    commdetectborder(commdetectborder_in)
+    commdetectborder(commdetectborder_in),
+    fps(fps_in),
+    prevSceneEnd(0),
+    thisSceneStart(0)
 {
     histogram = new Histogram;
     previousHistogram = new Histogram;
+    previousSceneHistogram = new Histogram;
 }
 
 void ClassicSceneChangeDetector::deleteLater(void)
 {
     delete histogram;
     delete previousHistogram;
+    delete previousSceneHistogram;
     SceneChangeDetectorBase::deleteLater();
 }
 
-void ClassicSceneChangeDetector::processFrame(unsigned char* frame)
+void ClassicSceneChangeDetector::processFrame(unsigned int frameNumber, unsigned char* frame)
 {
     histogram->generateFromImage(frame, width, height, commdetectborder,
                                  width-commdetectborder, commdetectborder,
-                                 height-commdetectborder, xspacing, yspacing);
+                                 height-commdetectborder, 1, 1);
     float similar = histogram->calculateSimilarityWith(*previousHistogram);
 
-    bool isSceneChange = (similar < .85 && !previousFrameWasSceneChange);
-
-    emit(haveNewInformation(frameNumber,isSceneChange,similar));
-    previousFrameWasSceneChange = isSceneChange;
-
-    std::swap(histogram,previousHistogram);
-    frameNumber++;
+    bool isSceneChange = similar < .85;
+    if (isSceneChange)
+    {
+        // If the last scene was recent we can consider it
+        if (frameNumber - prevSceneEnd <= fps * 30)
+        {
+            float prevSim = histogram->calculateSimilarityWith(*previousSceneHistogram);
+            if (prevSim >= 0.85)
+            {
+                // If this scene looks the same as the previous scene then there was no change
+                isSceneChange = false;
+                
+                // Undo what we previously said was a scene change
+                emit(haveNewInformation(prevSceneEnd, false, 1.25));
+            }
+        }
+        
+        if (frameNumber - thisSceneStart <= fps / 8)
+        {
+            // Supress change flags on rapidly changing scenery
+            isSceneChange = false;
+        }
+        else
+        {
+            std::swap(previousSceneHistogram, previousHistogram);
+            prevSceneEnd = thisSceneStart;
+            thisSceneStart = frameNumber;
+        }
+    }
+    std::swap(previousHistogram,histogram);
+    
+    emit(haveNewInformation(frameNumber, isSceneChange, similar));
 }
 
 /* vim: set expandtab tabstop=4 shiftwidth=4: */
-
diff --git a/mythtv/programs/mythcommflag/ClassicSceneChangeDetector.h b/mythtv/programs/mythcommflag/ClassicSceneChangeDetector.h
index f4d2200..43a9687 100644
--- a/mythtv/programs/mythcommflag/ClassicSceneChangeDetector.h
+++ b/mythtv/programs/mythcommflag/ClassicSceneChangeDetector.h
@@ -9,11 +9,10 @@ class ClassicSceneChangeDetector : public SceneChangeDetectorBase
 {
   public:
     ClassicSceneChangeDetector(unsigned int width, unsigned int height,
-        unsigned int commdetectborder, unsigned int xspacing,
-        unsigned int yspacing);
+        unsigned int commdetectborder, unsigned int fps);
     virtual void deleteLater(void);
 
-    void processFrame(unsigned char* frame);
+    void processFrame(unsigned int frameNumber, unsigned char* frame);
 
   private:
     ~ClassicSceneChangeDetector() {}
@@ -21,10 +20,10 @@ class ClassicSceneChangeDetector : public SceneChangeDetectorBase
   private:
     Histogram* histogram;
     Histogram* previousHistogram;
-    unsigned int frameNumber;
-    bool previousFrameWasSceneChange;
-    unsigned int xspacing, yspacing;
+    Histogram* previousSceneHistogram;
     unsigned int commdetectborder;
+    unsigned int fps;
+    unsigned int prevSceneEnd, thisSceneStart;
 };
 
 #endif
diff --git a/mythtv/programs/mythcommflag/Histogram.cpp b/mythtv/programs/mythcommflag/Histogram.cpp
index 12d2a9a..849f23b 100644
--- a/mythtv/programs/mythcommflag/Histogram.cpp
+++ b/mythtv/programs/mythcommflag/Histogram.cpp
@@ -70,18 +70,35 @@ unsigned int Histogram::getThresholdForPercentageOfPixels(float percentage)
 
 float Histogram::calculateSimilarityWith(const Histogram& other) const
 {
-    long similar = 0;
-
-    for(unsigned int i = 0; i < 256; i++)
+    const int proximity = 5;
+    long similarity = 0;
+
+    similarity += std::min(data[0],
+                           other.data[0]);
+    similarity += std::min(data[0] + data[1],
+                           other.data[0] + other.data[1]);
+    similarity += std::min(data[0] + data[1] + data[2],
+                           other.data[0] + other.data[1] + other.data[2]);
+    
+    for(unsigned int i = 0; i <= 256 - proximity; i++)
     {
-        if (data[i] < other.data[i])
-            similar += data[i];
-        else
-            similar += other.data[i];
+        unsigned int mine = 0, others = 0;
+        for (int j = 0; j < proximity; ++j)
+        {
+            mine += data[i+j];
+            others += other.data[i+j];
+        }
+        similarity += std::min(mine, others);
     }
-
-    //Using c style cast for old gcc compatibility.
-    return static_cast<float>(similar) / static_cast<float>(numberOfSamples);
+    
+    similarity += std::min(data[253] + data[254] + data[255],
+                           other.data[253] + other.data[254] + other.data[255]);
+    similarity += std::min(data[254] + data[255],
+                           other.data[254] + other.data[255]);
+    similarity += std::min(data[255],
+                           other.data[255]);
+    
+    return similarity / static_cast<float>(numberOfSamples * proximity);
 }
 
 /* vim: set expandtab tabstop=4 shiftwidth=4: */
diff --git a/mythtv/programs/mythcommflag/SceneChangeDetectorBase.h b/mythtv/programs/mythcommflag/SceneChangeDetectorBase.h
index 67296d5..338c80a 100644
--- a/mythtv/programs/mythcommflag/SceneChangeDetectorBase.h
+++ b/mythtv/programs/mythcommflag/SceneChangeDetectorBase.h
@@ -11,7 +11,7 @@ class SceneChangeDetectorBase : public QObject
     SceneChangeDetectorBase(unsigned int w, unsigned int h) :
         width(w), height(h) {}
 
-    virtual void processFrame(unsigned char *frame) = 0;
+    virtual void processFrame(unsigned int frameNumber, unsigned char *frame) = 0;
 
   signals:
     void haveNewInformation(unsigned int framenum, bool scenechange,
