diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 40a983baeb01388b63d1e6e858e149fda24cff67..a3d5e8e835c0edc846a402fb592116647d82ef58 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -784,7 +784,8 @@ static int mpegts_push_data(MpegTSFilter *filter,
                     code = pes->header[3] | 0x100;
                     av_dlog(pes->stream, "pid=%x pes_code=%#x\n", pes->pid, code);
 
-                    if ((pes->st && pes->st->discard == AVDISCARD_ALL) ||
+                    if ((pes->st && pes->st->discard == AVDISCARD_ALL &&
+                         (!pes->sub_st || pes->sub_st->discard == AVDISCARD_ALL)) ||
                         code == 0x1be) /* padding_stream */
                         goto skip;