diff --git a/libavfilter/af_ashowinfo.c b/libavfilter/af_ashowinfo.c
index a91d7ac25c233459113fbe5ff0602ab308c5eb64..5f0e2549ff58cd872c5768dae71de56422ad015b 100644
--- a/libavfilter/af_ashowinfo.c
+++ b/libavfilter/af_ashowinfo.c
@@ -36,6 +36,8 @@
 #include "libavutil/replaygain.h"
 #include "libavutil/samplefmt.h"
 
+#include "libavcodec/avcodec.h"
+
 #include "audio.h"
 #include "avfilter.h"
 #include "internal.h"
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 5c4163090936fc9a4452d4f00b131342036f0d56..57aa86d6b1b708cfbcf5315fbda6cdc2b8bdc907 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -40,7 +40,6 @@
 #include "libavutil/samplefmt.h"
 #include "libavutil/pixfmt.h"
 #include "libavutil/rational.h"
-#include "libavcodec/avcodec.h"
 
 #include <stddef.h>