sudo apt install pkg-config
This is VERY important, since we want this build of opencv-python to make use of the libraries we have already installed. Portability is no issue here. pkg-config generates .pc files that CMake will look into. Without this, CMake will not know where FFMPEG libraries are or if they are installed.
git clone --depth 1 --branch [version] https://github.com/opencv/opencv.git
For example: 4.11.0
for version