diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 96361ac794..43b557faaf 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1233,54 +1233,7 @@ OBJS-$(CONFIG_XMA_PARSER)              += xma_parser.o
 OBJS-$(CONFIG_XWD_PARSER)              += xwd_parser.o
 
 # bitstream filters
-OBJS-$(CONFIG_AAC_ADTSTOASC_BSF)          += aac_adtstoasc_bsf.o
-OBJS-$(CONFIG_AV1_METADATA_BSF)           += av1_metadata_bsf.o
-OBJS-$(CONFIG_AV1_FRAME_MERGE_BSF)        += av1_frame_merge_bsf.o
-OBJS-$(CONFIG_AV1_FRAME_SPLIT_BSF)        += av1_frame_split_bsf.o
-OBJS-$(CONFIG_CHOMP_BSF)                  += chomp_bsf.o
-OBJS-$(CONFIG_DUMP_EXTRADATA_BSF)         += dump_extradata_bsf.o
-OBJS-$(CONFIG_DCA_CORE_BSF)               += dca_core_bsf.o
-OBJS-$(CONFIG_DTS2PTS_BSF)                += dts2pts_bsf.o
-OBJS-$(CONFIG_DV_ERROR_MARKER_BSF)        += dv_error_marker_bsf.o
-OBJS-$(CONFIG_EAC3_CORE_BSF)              += eac3_core_bsf.o
-OBJS-$(CONFIG_EXTRACT_EXTRADATA_BSF)      += extract_extradata_bsf.o    \
-                                             av1_parse.o h2645_parse.o
-OBJS-$(CONFIG_FILTER_UNITS_BSF)           += filter_units_bsf.o
-OBJS-$(CONFIG_H264_METADATA_BSF)          += h264_metadata_bsf.o h264_levels.o \
-                                             h2645data.o
-OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF)       += h264_mp4toannexb_bsf.o
-OBJS-$(CONFIG_H264_REDUNDANT_PPS_BSF)     += h264_redundant_pps_bsf.o
-OBJS-$(CONFIG_HAPQA_EXTRACT_BSF)          += hapqa_extract_bsf.o hap.o
-OBJS-$(CONFIG_HEVC_METADATA_BSF)          += h265_metadata_bsf.o h265_profile_level.o \
-                                             h2645data.o
-OBJS-$(CONFIG_HEVC_MP4TOANNEXB_BSF)       += hevc_mp4toannexb_bsf.o
-OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF)        += imx_dump_header_bsf.o
-OBJS-$(CONFIG_MEDIA100_TO_MJPEGB_BSF)     += media100_to_mjpegb_bsf.o
-OBJS-$(CONFIG_MJPEG2JPEG_BSF)             += mjpeg2jpeg_bsf.o
-OBJS-$(CONFIG_MJPEGA_DUMP_HEADER_BSF)     += mjpega_dump_header_bsf.o
-OBJS-$(CONFIG_MPEG4_UNPACK_BFRAMES_BSF)   += mpeg4_unpack_bframes_bsf.o
-OBJS-$(CONFIG_MOV2TEXTSUB_BSF)            += movsub_bsf.o
-OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF)  += mp3_header_decompress_bsf.o \
-                                             mpegaudiotabs.o
-OBJS-$(CONFIG_MPEG2_METADATA_BSF)         += mpeg2_metadata_bsf.o
-OBJS-$(CONFIG_NOISE_BSF)                  += noise_bsf.o
-OBJS-$(CONFIG_NULL_BSF)                   += null_bsf.o
-OBJS-$(CONFIG_OPUS_METADATA_BSF)          += opus_metadata_bsf.o
-OBJS-$(CONFIG_PCM_RECHUNK_BSF)            += pcm_rechunk_bsf.o
-OBJS-$(CONFIG_PGS_FRAME_MERGE_BSF)        += pgs_frame_merge_bsf.o
-OBJS-$(CONFIG_PRORES_METADATA_BSF)        += prores_metadata_bsf.o
-OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF)       += remove_extradata_bsf.o av1_parse.o
-OBJS-$(CONFIG_SETTS_BSF)                  += setts_bsf.o
-OBJS-$(CONFIG_TEXT2MOVSUB_BSF)            += movsub_bsf.o
-OBJS-$(CONFIG_TRACE_HEADERS_BSF)          += trace_headers_bsf.o
-OBJS-$(CONFIG_TRUEHD_CORE_BSF)            += truehd_core_bsf.o mlp_parse.o mlp.o
-OBJS-$(CONFIG_VP9_METADATA_BSF)           += vp9_metadata_bsf.o
-OBJS-$(CONFIG_VP9_RAW_REORDER_BSF)        += vp9_raw_reorder_bsf.o
-OBJS-$(CONFIG_VP9_SUPERFRAME_BSF)         += vp9_superframe_bsf.o
-OBJS-$(CONFIG_VP9_SUPERFRAME_SPLIT_BSF)   += vp9_superframe_split_bsf.o
-OBJS-$(CONFIG_VVC_METADATA_BSF)           += h266_metadata_bsf.o
-OBJS-$(CONFIG_VVC_MP4TOANNEXB_BSF)        += vvc_mp4toannexb_bsf.o
-OBJS-$(CONFIG_EVC_FRAME_MERGE_BSF)        += evc_frame_merge_bsf.o
+include $(SRC_PATH)/libavcodec/bsf/Makefile
 
 # thread libraries
 OBJS-$(HAVE_LIBC_MSVCRT)               += file_open.o
diff --git a/libavcodec/bsf/Makefile b/libavcodec/bsf/Makefile
new file mode 100644
index 0000000000..21a39adc4b
--- /dev/null
+++ b/libavcodec/bsf/Makefile
@@ -0,0 +1,57 @@
+clean::
+	$(RM) $(CLEANSUFFIXES:%=libavcodec/bsf/%)
+
+OBJS_BSF-$(CONFIG_AAC_ADTSTOASC_BSF)          += bsf/aac_adtstoasc.o
+OBJS_BSF-$(CONFIG_AV1_METADATA_BSF)           += bsf/av1_metadata.o
+OBJS_BSF-$(CONFIG_AV1_FRAME_MERGE_BSF)        += bsf/av1_frame_merge.o
+OBJS_BSF-$(CONFIG_AV1_FRAME_SPLIT_BSF)        += bsf/av1_frame_split.o
+OBJS_BSF-$(CONFIG_CHOMP_BSF)                  += bsf/chomp.o
+OBJS_BSF-$(CONFIG_DUMP_EXTRADATA_BSF)         += bsf/dump_extradata.o
+OBJS_BSF-$(CONFIG_DCA_CORE_BSF)               += bsf/dca_core.o
+OBJS_BSF-$(CONFIG_DTS2PTS_BSF)                += bsf/dts2pts.o
+OBJS_BSF-$(CONFIG_DV_ERROR_MARKER_BSF)        += bsf/dv_error_marker.o
+OBJS_BSF-$(CONFIG_EAC3_CORE_BSF)              += bsf/eac3_core.o
+OBJS_BSF-$(CONFIG_EXTRACT_EXTRADATA_BSF)      += bsf/extract_extradata.o    \
+                                                 av1_parse.o h2645_parse.o
+OBJS_BSF-$(CONFIG_FILTER_UNITS_BSF)           += bsf/filter_units.o
+OBJS_BSF-$(CONFIG_H264_METADATA_BSF)          += bsf/h264_metadata.o        \
+                                                 h264_levels.o  h2645data.o
+OBJS_BSF-$(CONFIG_H264_MP4TOANNEXB_BSF)       += bsf/h264_mp4toannexb.o
+OBJS_BSF-$(CONFIG_H264_REDUNDANT_PPS_BSF)     += bsf/h264_redundant_pps.o
+OBJS_BSF-$(CONFIG_HAPQA_EXTRACT_BSF)          += bsf/hapqa_extract.o    \
+                                                 hap.o
+OBJS_BSF-$(CONFIG_HEVC_METADATA_BSF)          += bsf/h265_metadata.o        \
+                                                 h265_profile_level.o h2645data.o
+OBJS_BSF-$(CONFIG_HEVC_MP4TOANNEXB_BSF)       += bsf/hevc_mp4toannexb.o
+OBJS_BSF-$(CONFIG_IMX_DUMP_HEADER_BSF)        += bsf/imx_dump_header.o
+OBJS_BSF-$(CONFIG_MEDIA100_TO_MJPEGB_BSF)     += bsf/media100_to_mjpegb.o
+OBJS_BSF-$(CONFIG_MJPEG2JPEG_BSF)             += bsf/mjpeg2jpeg.o
+OBJS_BSF-$(CONFIG_MJPEGA_DUMP_HEADER_BSF)     += bsf/mjpega_dump_header.o
+OBJS_BSF-$(CONFIG_MPEG4_UNPACK_BFRAMES_BSF)   += bsf/mpeg4_unpack_bframes.o
+OBJS_BSF-$(CONFIG_MOV2TEXTSUB_BSF)            += bsf/movsub.o
+OBJS_BSF-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF)  += bsf/mp3_header_decompress.o \
+                                                 mpegaudiotabs.o
+OBJS_BSF-$(CONFIG_MPEG2_METADATA_BSF)         += bsf/mpeg2_metadata.o
+OBJS_BSF-$(CONFIG_NOISE_BSF)                  += bsf/noise.o
+OBJS_BSF-$(CONFIG_NULL_BSF)                   += bsf/null.o
+OBJS_BSF-$(CONFIG_OPUS_METADATA_BSF)          += bsf/opus_metadata.o
+OBJS_BSF-$(CONFIG_PCM_RECHUNK_BSF)            += bsf/pcm_rechunk.o
+OBJS_BSF-$(CONFIG_PGS_FRAME_MERGE_BSF)        += bsf/pgs_frame_merge.o
+OBJS_BSF-$(CONFIG_PRORES_METADATA_BSF)        += bsf/prores_metadata.o
+OBJS_BSF-$(CONFIG_REMOVE_EXTRADATA_BSF)       += bsf/remove_extradata.o av1_parse.o
+OBJS_BSF-$(CONFIG_SETTS_BSF)                  += bsf/setts.o
+OBJS_BSF-$(CONFIG_TEXT2MOVSUB_BSF)            += bsf/movsub.o
+OBJS_BSF-$(CONFIG_TRACE_HEADERS_BSF)          += bsf/trace_headers.o
+OBJS_BSF-$(CONFIG_TRUEHD_CORE_BSF)            += bsf/truehd_core.o mlp_parse.o mlp.o
+OBJS_BSF-$(CONFIG_VP9_METADATA_BSF)           += bsf/vp9_metadata.o
+OBJS_BSF-$(CONFIG_VP9_RAW_REORDER_BSF)        += bsf/vp9_raw_reorder.o
+OBJS_BSF-$(CONFIG_VP9_SUPERFRAME_BSF)         += bsf/vp9_superframe.o
+OBJS_BSF-$(CONFIG_VP9_SUPERFRAME_SPLIT_BSF)   += bsf/vp9_superframe_split.o
+OBJS_BSF-$(CONFIG_VVC_METADATA_BSF)           += bsf/h266_metadata.o
+OBJS_BSF-$(CONFIG_VVC_MP4TOANNEXB_BSF)        += bsf/vvc_mp4toannexb.o
+OBJS_BSF-$(CONFIG_EVC_FRAME_MERGE_BSF)        += bsf/evc_frame_merge.o
+
+# add libavcodec/ to include path for bsfs
+$(addprefix libavcodec/, $(sort $(filter bsf/%,$(OBJS_BSF-yes)))): CPPFLAGS += -I$(SRC_PATH)/libavcodec/
+
+OBJS += $(OBJS_BSF-yes)
diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/bsf/aac_adtstoasc.c
similarity index 100%
rename from libavcodec/aac_adtstoasc_bsf.c
rename to libavcodec/bsf/aac_adtstoasc.c
diff --git a/libavcodec/av1_frame_merge_bsf.c b/libavcodec/bsf/av1_frame_merge.c
similarity index 100%
rename from libavcodec/av1_frame_merge_bsf.c
rename to libavcodec/bsf/av1_frame_merge.c
diff --git a/libavcodec/av1_frame_split_bsf.c b/libavcodec/bsf/av1_frame_split.c
similarity index 100%
rename from libavcodec/av1_frame_split_bsf.c
rename to libavcodec/bsf/av1_frame_split.c
diff --git a/libavcodec/av1_metadata_bsf.c b/libavcodec/bsf/av1_metadata.c
similarity index 100%
rename from libavcodec/av1_metadata_bsf.c
rename to libavcodec/bsf/av1_metadata.c
diff --git a/libavcodec/chomp_bsf.c b/libavcodec/bsf/chomp.c
similarity index 100%
rename from libavcodec/chomp_bsf.c
rename to libavcodec/bsf/chomp.c
diff --git a/libavcodec/dca_core_bsf.c b/libavcodec/bsf/dca_core.c
similarity index 100%
rename from libavcodec/dca_core_bsf.c
rename to libavcodec/bsf/dca_core.c
diff --git a/libavcodec/dts2pts_bsf.c b/libavcodec/bsf/dts2pts.c
similarity index 100%
rename from libavcodec/dts2pts_bsf.c
rename to libavcodec/bsf/dts2pts.c
diff --git a/libavcodec/dump_extradata_bsf.c b/libavcodec/bsf/dump_extradata.c
similarity index 100%
rename from libavcodec/dump_extradata_bsf.c
rename to libavcodec/bsf/dump_extradata.c
diff --git a/libavcodec/dv_error_marker_bsf.c b/libavcodec/bsf/dv_error_marker.c
similarity index 100%
rename from libavcodec/dv_error_marker_bsf.c
rename to libavcodec/bsf/dv_error_marker.c
diff --git a/libavcodec/eac3_core_bsf.c b/libavcodec/bsf/eac3_core.c
similarity index 100%
rename from libavcodec/eac3_core_bsf.c
rename to libavcodec/bsf/eac3_core.c
diff --git a/libavcodec/evc_frame_merge_bsf.c b/libavcodec/bsf/evc_frame_merge.c
similarity index 100%
rename from libavcodec/evc_frame_merge_bsf.c
rename to libavcodec/bsf/evc_frame_merge.c
diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/bsf/extract_extradata.c
similarity index 100%
rename from libavcodec/extract_extradata_bsf.c
rename to libavcodec/bsf/extract_extradata.c
diff --git a/libavcodec/filter_units_bsf.c b/libavcodec/bsf/filter_units.c
similarity index 100%
rename from libavcodec/filter_units_bsf.c
rename to libavcodec/bsf/filter_units.c
diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/bsf/h264_metadata.c
similarity index 100%
rename from libavcodec/h264_metadata_bsf.c
rename to libavcodec/bsf/h264_metadata.c
diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/bsf/h264_mp4toannexb.c
similarity index 100%
rename from libavcodec/h264_mp4toannexb_bsf.c
rename to libavcodec/bsf/h264_mp4toannexb.c
diff --git a/libavcodec/h264_redundant_pps_bsf.c b/libavcodec/bsf/h264_redundant_pps.c
similarity index 100%
rename from libavcodec/h264_redundant_pps_bsf.c
rename to libavcodec/bsf/h264_redundant_pps.c
diff --git a/libavcodec/h265_metadata_bsf.c b/libavcodec/bsf/h265_metadata.c
similarity index 100%
rename from libavcodec/h265_metadata_bsf.c
rename to libavcodec/bsf/h265_metadata.c
diff --git a/libavcodec/h266_metadata_bsf.c b/libavcodec/bsf/h266_metadata.c
similarity index 100%
rename from libavcodec/h266_metadata_bsf.c
rename to libavcodec/bsf/h266_metadata.c
diff --git a/libavcodec/hapqa_extract_bsf.c b/libavcodec/bsf/hapqa_extract.c
similarity index 100%
rename from libavcodec/hapqa_extract_bsf.c
rename to libavcodec/bsf/hapqa_extract.c
diff --git a/libavcodec/hevc_mp4toannexb_bsf.c b/libavcodec/bsf/hevc_mp4toannexb.c
similarity index 100%
rename from libavcodec/hevc_mp4toannexb_bsf.c
rename to libavcodec/bsf/hevc_mp4toannexb.c
diff --git a/libavcodec/imx_dump_header_bsf.c b/libavcodec/bsf/imx_dump_header.c
similarity index 100%
rename from libavcodec/imx_dump_header_bsf.c
rename to libavcodec/bsf/imx_dump_header.c
diff --git a/libavcodec/media100_to_mjpegb_bsf.c b/libavcodec/bsf/media100_to_mjpegb.c
similarity index 100%
rename from libavcodec/media100_to_mjpegb_bsf.c
rename to libavcodec/bsf/media100_to_mjpegb.c
diff --git a/libavcodec/mjpeg2jpeg_bsf.c b/libavcodec/bsf/mjpeg2jpeg.c
similarity index 100%
rename from libavcodec/mjpeg2jpeg_bsf.c
rename to libavcodec/bsf/mjpeg2jpeg.c
diff --git a/libavcodec/mjpega_dump_header_bsf.c b/libavcodec/bsf/mjpega_dump_header.c
similarity index 100%
rename from libavcodec/mjpega_dump_header_bsf.c
rename to libavcodec/bsf/mjpega_dump_header.c
diff --git a/libavcodec/movsub_bsf.c b/libavcodec/bsf/movsub.c
similarity index 100%
rename from libavcodec/movsub_bsf.c
rename to libavcodec/bsf/movsub.c
diff --git a/libavcodec/mp3_header_decompress_bsf.c b/libavcodec/bsf/mp3_header_decompress.c
similarity index 100%
rename from libavcodec/mp3_header_decompress_bsf.c
rename to libavcodec/bsf/mp3_header_decompress.c
diff --git a/libavcodec/mpeg2_metadata_bsf.c b/libavcodec/bsf/mpeg2_metadata.c
similarity index 100%
rename from libavcodec/mpeg2_metadata_bsf.c
rename to libavcodec/bsf/mpeg2_metadata.c
diff --git a/libavcodec/mpeg4_unpack_bframes_bsf.c b/libavcodec/bsf/mpeg4_unpack_bframes.c
similarity index 100%
rename from libavcodec/mpeg4_unpack_bframes_bsf.c
rename to libavcodec/bsf/mpeg4_unpack_bframes.c
diff --git a/libavcodec/noise_bsf.c b/libavcodec/bsf/noise.c
similarity index 100%
rename from libavcodec/noise_bsf.c
rename to libavcodec/bsf/noise.c
diff --git a/libavcodec/null_bsf.c b/libavcodec/bsf/null.c
similarity index 100%
rename from libavcodec/null_bsf.c
rename to libavcodec/bsf/null.c
diff --git a/libavcodec/opus_metadata_bsf.c b/libavcodec/bsf/opus_metadata.c
similarity index 100%
rename from libavcodec/opus_metadata_bsf.c
rename to libavcodec/bsf/opus_metadata.c
diff --git a/libavcodec/pcm_rechunk_bsf.c b/libavcodec/bsf/pcm_rechunk.c
similarity index 100%
rename from libavcodec/pcm_rechunk_bsf.c
rename to libavcodec/bsf/pcm_rechunk.c
diff --git a/libavcodec/pgs_frame_merge_bsf.c b/libavcodec/bsf/pgs_frame_merge.c
similarity index 100%
rename from libavcodec/pgs_frame_merge_bsf.c
rename to libavcodec/bsf/pgs_frame_merge.c
diff --git a/libavcodec/prores_metadata_bsf.c b/libavcodec/bsf/prores_metadata.c
similarity index 100%
rename from libavcodec/prores_metadata_bsf.c
rename to libavcodec/bsf/prores_metadata.c
diff --git a/libavcodec/remove_extradata_bsf.c b/libavcodec/bsf/remove_extradata.c
similarity index 100%
rename from libavcodec/remove_extradata_bsf.c
rename to libavcodec/bsf/remove_extradata.c
diff --git a/libavcodec/setts_bsf.c b/libavcodec/bsf/setts.c
similarity index 100%
rename from libavcodec/setts_bsf.c
rename to libavcodec/bsf/setts.c
diff --git a/libavcodec/trace_headers_bsf.c b/libavcodec/bsf/trace_headers.c
similarity index 100%
rename from libavcodec/trace_headers_bsf.c
rename to libavcodec/bsf/trace_headers.c
diff --git a/libavcodec/truehd_core_bsf.c b/libavcodec/bsf/truehd_core.c
similarity index 100%
rename from libavcodec/truehd_core_bsf.c
rename to libavcodec/bsf/truehd_core.c
diff --git a/libavcodec/vp9_metadata_bsf.c b/libavcodec/bsf/vp9_metadata.c
similarity index 100%
rename from libavcodec/vp9_metadata_bsf.c
rename to libavcodec/bsf/vp9_metadata.c
diff --git a/libavcodec/vp9_raw_reorder_bsf.c b/libavcodec/bsf/vp9_raw_reorder.c
similarity index 100%
rename from libavcodec/vp9_raw_reorder_bsf.c
rename to libavcodec/bsf/vp9_raw_reorder.c
diff --git a/libavcodec/vp9_superframe_bsf.c b/libavcodec/bsf/vp9_superframe.c
similarity index 100%
rename from libavcodec/vp9_superframe_bsf.c
rename to libavcodec/bsf/vp9_superframe.c
diff --git a/libavcodec/vp9_superframe_split_bsf.c b/libavcodec/bsf/vp9_superframe_split.c
similarity index 100%
rename from libavcodec/vp9_superframe_split_bsf.c
rename to libavcodec/bsf/vp9_superframe_split.c
diff --git a/libavcodec/vvc_mp4toannexb_bsf.c b/libavcodec/bsf/vvc_mp4toannexb.c
similarity index 100%
rename from libavcodec/vvc_mp4toannexb_bsf.c
rename to libavcodec/bsf/vvc_mp4toannexb.c
