Opencv source code compilation problem on Ubuntu22.04 system

The Ubuntu22.04 system cannot install libavresample-dev; so when compiling the source code, FFMPEG: avresample: NO. How can I solve this problem. In addition, I would like to ask you which version of Ubuntu you recommend?

Are you sure this is your issue, did you have pkg-config installed before you insalled the FFmpeg libs? Whats your output from CMake for FFmpeg?