diff --git a/libavformat/utils.c b/libavformat/utils.c
index d543461c8146acf5b138b3ef0327ab80b5812ddc..0b7b5ee40265d9dc9057a95d2841cb9b7550b269 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1936,7 +1936,7 @@ int av_find_stream_info(AVFormatContext *ic)
                 }
             }
         }else if(st->codec->codec_type == CODEC_TYPE_AUDIO) {
-            if (st->codec->codec_id == CODEC_ID_NONE) {
+            if (st->codec->codec_id == CODEC_ID_NONE && probe_data[st->index].buf_size > 0) {
                 codec_identified[st->index] = set_codec_from_probe_data(st, &(probe_data[st->index]), 0);
                 if (codec_identified[st->index]) {
                     st->need_parsing = AVSTREAM_PARSE_FULL;