diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 197aeac5b2293773ab5cb31062dda9308e926dd6..b32ca7d94f3381d84053833bd33ddd01f82aa1a0 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -224,6 +224,11 @@ void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags)
 
         next = url_ftell(s->pb) + tlen;
 
+        if (tflags & ID3v2_FLAG_DATALEN) {
+            get_be32(s->pb);
+            tlen -= 4;
+        }
+
         if (tflags & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) {
             av_log(s, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %s.\n", tag);
             url_fskip(s->pb, tlen);