diff --git a/libavformat/utils.c b/libavformat/utils.c
index 855992e2aa4bda82a010ffef4b74643e8b9192ce..43991765df7f9d4a014ef44e24eadd5c9aea6ab8 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -607,6 +607,9 @@ static int init_input(AVFormatContext *s, const char *filename)
     int ret;
     AVProbeData pd = {filename, NULL, 0};
 
+    if(s->iformat && !strlen(filename))
+        return 0;
+
     if (s->pb) {
         s->flags |= AVFMT_FLAG_CUSTOM_IO;
         if (!s->iformat)