                 } else if (typ == 0x1B) {
                     // ITU-T Rec. H.264 and ISO/IEC 14496-10 (lower bit-rate video)
                     if(_audioOnly == false) {
-                        _avcId = sid;
-                        CONFIG::LOGGING {
-                            Log.debug("TS: Selected video PID: " + _avcId);
+                        if(_avcId != sid) {
+                            _avcId = sid;
+                            CONFIG::LOGGING {
+                                Log.debug("TS: Selected video PID: " + _avcId);
+                            }
                         }
                     } else {
                         CONFIG::LOGGING {

                read += sel + 5;
            }

            CONFIG::LOGGING {
                if (audioList.length) {
                    Log.debug("TS: Found " + audioList.length + " audio tracks");
                }
            }
            // provide audio track List to audio select callback. this callback will return the selected audio track
            var audioPID : int;
            _audioFound = (audioList.length > 0);
            var audioTrack : AudioTrack = _callback_audioselect(audioList);
            if (audioTrack) {
                audioPID = audioTrack.id;
                _audioIsAAC = audioTrack.isAAC;
                _audioSelected = true;
                CONFIG::LOGGING {
                    Log.debug("TS: selected " + (_audioIsAAC ? "AAC" : "MP3") + " PID: " + audioPID);
                }
            } else {
                audioPID = -1;
                _audioSelected = false;
                CONFIG::LOGGING {
                    Log.debug("TS: no audio selected");
                }
            }
            // in case audio PID change, flush any partially parsed audio PES packet
            if (audioPID != _audioId) {
                _curAudioPES = null;
                _adtsFrameOverflow = null;
                _audioId = audioPID;
            }
            return len + pointerField;
        };

                    pes.data.readBytes(pps, 0, frame.length);
                    ppsvect.push(pps);
                } else if (frame.type == 6) {

					//unescape Emulation Prevention bytes
					Nalu.unescapeStream(pes.data,frame.start,frame.start + frame.length);

					// We already know it's 6, so skip first byte
					pes.data.position = frame.start + 1;

					// we need at least 12 bytes to retrieve Caption length
					if(pes.data.bytesAvailable > 12) {

						// get the SEI payload type
						var payload_type : uint = 0;
						var payload_size : uint = 0;
