diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index d8f89b8f8076f1b8009aec6da552ab4be4e846a2..2ab730190c9611eacb189f27df639c3fd33f03ba 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -478,8 +478,11 @@ static int ogg_get_headers(AVFormatContext *s)
         if (os->codec && os->codec->nb_header &&
             os->nb_header < os->codec->nb_header) {
             av_log(s, AV_LOG_ERROR,
-                   "Headers mismatch for stream %d\n", i);
-            return AVERROR_INVALIDDATA;
+                   "Headers mismatch for stream %d: "
+                   "expected %d received %d.\n",
+                   i, os->codec->nb_header, os->nb_header);
+            if (s->error_recognition & AV_EF_EXPLODE)
+                return AVERROR_INVALIDDATA;
         }
         if (os->start_granule != OGG_NOGRANULE_VALUE)
             os->lastpts = s->streams[i]->start_time =