Index: mythtv/libs/libmythtv/avformatdecoder.cpp
===================================================================
--- mythtv.orig/libs/libmythtv/avformatdecoder.cpp	2008-12-13 08:15:15.000000000 -0800
+++ mythtv/libs/libmythtv/avformatdecoder.cpp	2008-12-13 15:02:25.000000000 -0800
@@ -2726,8 +2726,14 @@
         uint32_t bytes_used = h264_kf_seq->AddBytes(buf, buf_end - buf, 0);
         buf += bytes_used;
 
-        if (!h264_kf_seq->HasStateChanged() || !h264_kf_seq->IsOnKeyframe())
+        if (!h264_kf_seq->HasStateChanged()) 
             continue;
+        if (!h264_kf_seq->IsOnKeyframe())
+        {
+            if(h264_kf_seq->IsOnFrame())
+                framesRead++;
+            continue;
+        }
 
         float aspect_ratio;
         if (context->sample_aspect_ratio.num == 0)
@@ -2772,9 +2778,15 @@
                         .arg(avFPS).arg(seqFPS));
             }
         }
-
+        if (keyframedist > 1)
+        {
+            keyframedist = 1;
+            positionMapType = MARK_GOP_BYFRAME;
+            GetNVP()->SetKeyframeDistance(keyframedist);
+        }
         HandleGopStart(pkt);
         pkt->flags |= PKT_FLAG_KEY;
+        framesRead++;
     }
 }
 
@@ -3600,7 +3612,11 @@
                 continue;
             }
 
-            framesRead++;
+            if (context->codec_id != CODEC_ID_H264)
+            {
+                //H264PreProcessPkt will update this for us
+                framesRead++;
+            }
             justAfterChange = false;
 
             if (exitafterdecoded)
