diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index db697e40e1..53de4ac997 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1988,8 +1988,10 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet) break; } if (i == ts->nb_prg && ts->nb_prg > 0) { - av_log(ts->stream, AV_LOG_DEBUG, "All programs have pmt, headers found\n"); - ts->stream->ctx_flags &= ~AVFMTCTX_NOHEADER; + if (ts->stream->nb_streams > 1 || pos > 100000) { + av_log(ts->stream, AV_LOG_DEBUG, "All programs have pmt, headers found\n"); + ts->stream->ctx_flags &= ~AVFMTCTX_NOHEADER; + } } }