diff --git a/libavformat/avio.c b/libavformat/avio.c
index fd40f9ce43..5e1acba31b 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -25,7 +25,6 @@
 #include "libavutil/time.h"
 #include "libavutil/avassert.h"
 #include "os_support.h"
-#include "avformat.h"
 #include "internal.h"
 #if CONFIG_NETWORK
 #include "network.h"
diff --git a/libavformat/bluray.c b/libavformat/bluray.c
index 635c4f1b87..1845551c34 100644
--- a/libavformat/bluray.c
+++ b/libavformat/bluray.c
@@ -23,7 +23,6 @@
 #include <libbluray/bluray.h>
 
 #include "libavutil/avstring.h"
-#include "libavformat/avformat.h"
 #include "libavformat/url.h"
 #include "libavutil/opt.h"
 
diff --git a/libavformat/concat.c b/libavformat/concat.c
index 825e43a7fa..e1d57de557 100644
--- a/libavformat/concat.c
+++ b/libavformat/concat.c
@@ -21,13 +21,15 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <string.h>
+
 #include "config_components.h"
 
 #include "libavutil/avstring.h"
 #include "libavutil/bprint.h"
+#include "libavutil/error.h"
 #include "libavutil/mem.h"
 
-#include "avformat.h"
 #include "avio_internal.h"
 #include "url.h"
 
diff --git a/libavformat/crypto.c b/libavformat/crypto.c
index 1d4514e0f2..75b00020bc 100644
--- a/libavformat/crypto.c
+++ b/libavformat/crypto.c
@@ -19,11 +19,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "avformat.h"
 #include "libavutil/aes.h"
 #include "libavutil/avstring.h"
 #include "libavutil/opt.h"
-#include "internal.h"
 #include "url.h"
 
 // encourage reads of 4096 bytes - 1 block is always retained.
diff --git a/libavformat/hlsproto.c b/libavformat/hlsproto.c
index 6a2765bbe9..4db61dee30 100644
--- a/libavformat/hlsproto.c
+++ b/libavformat/hlsproto.c
@@ -27,7 +27,6 @@
 
 #include "libavutil/avstring.h"
 #include "libavutil/time.h"
-#include "avformat.h"
 #include "avio_internal.h"
 #include "internal.h"
 #include "url.h"
diff --git a/libavformat/httpauth.c b/libavformat/httpauth.c
index 0a98ff80a5..9780928357 100644
--- a/libavformat/httpauth.c
+++ b/libavformat/httpauth.c
@@ -26,7 +26,6 @@
 #include "libavutil/random_seed.h"
 #include "libavutil/md5.h"
 #include "urldecode.h"
-#include "avformat.h"
 
 static void handle_basic_params(HTTPAuthState *state, const char *key,
                                 int key_len, char **dest, int *dest_len)
diff --git a/libavformat/libsmbclient.c b/libavformat/libsmbclient.c
index 3285868957..f81fff2dfc 100644
--- a/libavformat/libsmbclient.c
+++ b/libavformat/libsmbclient.c
@@ -21,8 +21,6 @@
 #include <libsmbclient.h>
 #include "libavutil/avstring.h"
 #include "libavutil/opt.h"
-#include "avformat.h"
-#include "internal.h"
 #include "url.h"
 
 typedef struct {
diff --git a/libavformat/md5proto.c b/libavformat/md5proto.c
index 14cefe719c..653bf10e66 100644
--- a/libavformat/md5proto.c
+++ b/libavformat/md5proto.c
@@ -23,7 +23,6 @@
 #include "libavutil/md5.h"
 #include "libavutil/mem.h"
 #include "libavutil/error.h"
-#include "avformat.h"
 #include "avio.h"
 #include "internal.h"
 #include "url.h"
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index b970901d01..cac361047a 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -28,7 +28,6 @@
 #include "libavutil/avstring.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
-#include "avio_internal.h"
 #include "rtp.h"
 #include "rtpproto.h"
 #include "url.h"
diff --git a/libavformat/srtpproto.c b/libavformat/srtpproto.c
index 13e2245015..61669e05ad 100644
--- a/libavformat/srtpproto.c
+++ b/libavformat/srtpproto.c
@@ -21,10 +21,8 @@
 
 #include "libavutil/opt.h"
 #include "avformat.h"
-#include "avio_internal.h"
 #include "url.h"
 
-#include "internal.h"
 #include "rtpdec.h"
 #include "srtp.h"
 
diff --git a/libavformat/subfile.c b/libavformat/subfile.c
index 2936c79e06..633a9e3c62 100644
--- a/libavformat/subfile.c
+++ b/libavformat/subfile.c
@@ -20,7 +20,6 @@
 
 #include "libavutil/avstring.h"
 #include "libavutil/opt.h"
-#include "avformat.h"
 #include "url.h"
 
 typedef struct SubfileContext {
diff --git a/libavformat/teeproto.c b/libavformat/teeproto.c
index 7dd5065f4b..33877ed808 100644
--- a/libavformat/teeproto.c
+++ b/libavformat/teeproto.c
@@ -19,10 +19,15 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <string.h>
+
 #include "libavutil/avstring.h"
-#include "avformat.h"
-#include "avio_internal.h"
+#include "libavutil/dict.h"
+#include "libavutil/error.h"
+#include "libavutil/mem.h"
+#include "avio.h"
 #include "tee_common.h"
+#include "url.h"
 
 typedef struct ChildContext {
     URLContext *url_context;
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 909213a467..d9514f5026 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -28,12 +28,10 @@
 #define _BSD_SOURCE     /* Needed for using struct ip_mreq with recent glibc */
 
 #include "avformat.h"
-#include "avio_internal.h"
 #include "libavutil/avassert.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/fifo.h"
 #include "libavutil/intreadwrite.h"
-#include "libavutil/avstring.h"
 #include "libavutil/opt.h"
 #include "libavutil/log.h"
 #include "libavutil/time.h"
diff --git a/libavformat/url.c b/libavformat/url.c
index f53fdf59d8..d5dd6a4666 100644
--- a/libavformat/url.c
+++ b/libavformat/url.c
@@ -19,16 +19,18 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <string.h>
 
-#include "avformat.h"
-#include "internal.h"
 #include "config.h"
+#include "avio.h"
 #include "url.h"
 #if CONFIG_NETWORK
 #include "network.h"
 #endif
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
+#include "libavutil/error.h"
+#include "libavutil/mem.h"
 
 /**
  * @file
