diff --git a/mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp b/mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp
index 489c547..fc50feb 100644
--- a/mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp
+++ b/mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp
@@ -65,6 +65,7 @@ const unsigned char MPEGStreamData::bit_sel[8] =
 MPEGStreamData::MPEGStreamData(int desiredProgram, bool cacheTables)
     : _sistandard("mpeg"),
       _have_CRC_bug(false),
+      _found_payload_start(false),
       _si_time_offset_cnt(0),
       _si_time_offset_indx(0),
       _eit_helper(NULL), _eit_rate(0.0f),
@@ -1054,6 +1055,8 @@ bool MPEGStreamData::ProcessTSPacket(const TSPacket& tspacket)
     if (tspacket.Scrambled())
         return true;
 
+    _found_payload_start |= (tspacket.HasPayload() && tspacket.PayloadStart());
+
     if (IsVideoPID(tspacket.PID()))
     {
         for (uint j = 0; j < _ts_av_listeners.size(); j++)
diff --git a/mythtv/libs/libmythtv/mpeg/mpegstreamdata.h b/mythtv/libs/libmythtv/mpeg/mpegstreamdata.h
index 94ad37d..3730426 100644
--- a/mythtv/libs/libmythtv/mpeg/mpegstreamdata.h
+++ b/mythtv/libs/libmythtv/mpeg/mpegstreamdata.h
@@ -307,6 +307,9 @@ class MTV_PUBLIC MPEGStreamData : public EITSource
     // Single program stuff, gets
     int DesiredProgram(void) const          { return _desired_program; }
     uint VideoPIDSingleProgram(void) const  { return _pid_video_single_program; }
+    bool FoundPayloadStart(void) const { return _found_payload_start; }
+    void ResetPayloadStart(void) { _found_payload_start = false; }
+
     QString GetRecordingType(void) const;
 
     const ProgramAssociationTable* PATSingleProgram(void) const
@@ -356,6 +359,7 @@ class MTV_PUBLIC MPEGStreamData : public EITSource
     QString                   _sistandard;
 
     bool                      _have_CRC_bug;
+    bool                      _found_payload_start;
 
     mutable QMutex            _si_time_lock;
     uint                      _si_time_offset_cnt;
diff --git a/mythtv/libs/libmythtv/recorders/dtvrecorder.cpp b/mythtv/libs/libmythtv/recorders/dtvrecorder.cpp
index 0c30b10..0dcebaf 100644
--- a/mythtv/libs/libmythtv/recorders/dtvrecorder.cpp
+++ b/mythtv/libs/libmythtv/recorders/dtvrecorder.cpp
@@ -277,7 +277,7 @@ void DTVRecorder::InitStreamData(void)
 void DTVRecorder::BufferedWrite(const TSPacket &tspacket)
 {
     // delay until first GOP to avoid decoder crash on res change
-    if (_wait_for_keyframe_option && _first_keyframe<0)
+    if (!_buffer_packets && _wait_for_keyframe_option && _first_keyframe<0)
         return;
 
     if (curRecording && timeOfFirstDataIsSet.testAndSetRelaxed(0,1))
@@ -403,12 +403,11 @@ static const uint frameRateMap[16] = {
  */
 bool DTVRecorder::FindMPEG2Keyframes(const TSPacket* tspacket)
 {
-    bool haveBufferedData = !_payload_buffer.empty();
     if (!tspacket->HasPayload()) // no payload to scan
-        return !haveBufferedData;
+        return _first_keyframe >= 0;
 
     if (!ringBuffer)
-        return !haveBufferedData;
+        return _first_keyframe >= 0;
 
     // if packet contains start of PES packet, start
     // looking for first byte of MPEG start code (3 bytes 0 0 1)
@@ -549,6 +548,13 @@ bool DTVRecorder::FindMPEG2Keyframes(const TSPacket* tspacket)
         _frames_seen_count++;
         if (!_wait_for_keyframe_option || _first_keyframe>=0)
             UpdateFramesWritten();
+        else
+        {
+            /* Found a frame that is not a keyframe, and we want to
+             * start on a keyframe */
+            _payload_buffer.clear();
+            _stream_data->ResetPayloadStart();
+        }
     }
 
     if ((aspectRatio > 0) && (aspectRatio != m_videoAspect))
@@ -572,7 +578,7 @@ bool DTVRecorder::FindMPEG2Keyframes(const TSPacket* tspacket)
         FrameRateChange(frameRate, _frames_written_count);
     }
 
-    return hasKeyFrame || (_payload_buffer.size() >= (188*50));
+    return _first_keyframe >= 0;
 }
 
 void DTVRecorder::HandleTimestamps(int stream_id, int64_t pts, int64_t dts)
@@ -762,16 +768,15 @@ void DTVRecorder::HandleKeyframe(uint64_t frameNum, int64_t extra)
  */
 bool DTVRecorder::FindH264Keyframes(const TSPacket *tspacket)
 {
+    if (!tspacket->HasPayload()) // no payload to scan
+        return _first_keyframe >= 0;
+
     if (!ringBuffer)
     {
         LOG(VB_GENERAL, LOG_ERR, LOC + "FindH264Keyframes: No ringbuffer");
-        return false;
+        return _first_keyframe >= 0;
     }
 
-    bool haveBufferedData = !_payload_buffer.empty();
-    if (!tspacket->HasPayload()) // no payload to scan
-        return !haveBufferedData;
-
     const bool payloadStart = tspacket->PayloadStart();
     if (payloadStart)
     {
@@ -790,7 +795,7 @@ bool DTVRecorder::FindH264Keyframes(const TSPacket *tspacket)
 
     // scan for PES packets and H.264 NAL units
     uint i = tspacket->AFCOffset();
-    for (; i < TSPacket::kSize; i++)
+    for (; i < TSPacket::kSize; ++i)
     {
         // special handling required when a new PES packet begins
         if (payloadStart && !_pes_synced)
@@ -879,7 +884,7 @@ bool DTVRecorder::FindH264Keyframes(const TSPacket *tspacket)
                 frameRate = m_h264_parser.frameRate();
             }
         }
-    } // for (; i < TSPacket::kSize; i++)
+    } // for (; i < TSPacket::kSize; ++i)
 
     if (hasKeyFrame)
     {
@@ -892,6 +897,13 @@ bool DTVRecorder::FindH264Keyframes(const TSPacket *tspacket)
         _frames_seen_count++;
         if (!_wait_for_keyframe_option || _first_keyframe >= 0)
             UpdateFramesWritten();
+        else
+        {
+            /* Found a frame that is not a keyframe, and we want to
+             * start on a keyframe */
+            _payload_buffer.clear();
+            _stream_data->ResetPayloadStart();
+        }
     }
 
     if ((aspectRatio > 0) && (aspectRatio != m_videoAspect))
@@ -909,7 +921,6 @@ bool DTVRecorder::FindH264Keyframes(const TSPacket *tspacket)
 
     if (frameRate != 0 && frameRate != m_frameRate)
     {
-
         LOG(VB_RECORD, LOG_INFO, LOC +
             QString("FindH264Keyframes: timescale: %1, tick: %2, framerate: %3")
                       .arg( m_h264_parser.GetTimeScale() )
@@ -919,7 +930,7 @@ bool DTVRecorder::FindH264Keyframes(const TSPacket *tspacket)
         FrameRateChange(frameRate, _frames_written_count);
     }
 
-    return hasKeyFrame || (_payload_buffer.size() >= (188*50));
+    return _seen_sps;
 }
 
 /** \fn DTVRecorder::HandleH264Keyframe(void)
@@ -1149,8 +1160,9 @@ void DTVRecorder::HandlePAT(const ProgramAssociationTable *_pat)
 
     if (!pmtpid)
     {
-        LOG(VB_RECORD, LOG_ERR, LOC + "SetPAT(): "
-            "Ignoring PAT not containing our desired program...");
+        LOG(VB_RECORD, LOG_ERR, LOC +
+            QString("SetPAT(): Ignoring PAT not containing our desired "
+                    "program (%1)...").arg(progNum));
         return;
     }
 
@@ -1287,13 +1299,13 @@ bool DTVRecorder::ProcessVideoTSPacket(const TSPacket &tspacket)
     // Check for keyframes and count frames
     if (streamType == StreamID::H264Video)
     {
-        _buffer_packets = !FindH264Keyframes(&tspacket);
-        if (_wait_for_keyframe_option && !_seen_sps)
-            return true;
+        _buffer_packets = !FindH264Keyframes(&tspacket) &&
+                          _stream_data->FoundPayloadStart();
     }
     else
     {
-        _buffer_packets = !FindMPEG2Keyframes(&tspacket);
+        _buffer_packets = !FindMPEG2Keyframes(&tspacket) &&
+                          _stream_data->FoundPayloadStart();
     }
 
     return ProcessAVTSPacket(tspacket);
@@ -1311,6 +1323,10 @@ bool DTVRecorder::ProcessAudioTSPacket(const TSPacket &tspacket)
 /// Common code for processing either audio or video packets
 bool DTVRecorder::ProcessAVTSPacket(const TSPacket &tspacket)
 {
+    // Sync recording start to first keyframe
+    if (!_buffer_packets && _wait_for_keyframe_option && _first_keyframe < 0)
+        return true;
+
     const uint pid = tspacket.PID();
 
     if (pid != 0x1fff)
@@ -1328,10 +1344,6 @@ bool DTVRecorder::ProcessAVTSPacket(const TSPacket &tspacket)
                 .arg(erate,5,'f',2));
     }
 
-    // Sync recording start to first keyframe
-    if (_wait_for_keyframe_option && _first_keyframe < 0)
-        return true;
-
     // Sync streams to the first Payload Unit Start Indicator
     // _after_ first keyframe iff _wait_for_keyframe_option is true
     if (!(_pid_status[pid] & kPayloadStartSeen) && tspacket.HasPayload())
