The compile command I use is as follows:
gcc demuxing_decoding.c -o demuxing_decoding -g -I ./ffmpeg-5.0.1/include -L ./ffmpeg-5.0.1/lib/ \
-l avcodec -l avutil -l avformat -l swresample -lm -Wl,-rpath=./ffmpeg-5.0.1/lib/
The directory ./ffmpeg-5.0.1/lib/ clearly has the library libswresample.so.4, but it is suggested that the dynamic library cannot be found.
It is best to have no choice. You can only follow the method commonly used on the Internet: /etc/ld Add the directory where the library libswresample.so.4 is located in .so.conf, and execute the command ldconfig.