not long ago, opencv’s support for ffmpeg was raised from 4.x to 5.x. that alone was a drag and took willpower. try ffmpeg 5.x. opencv should check ffmpeg library versions during compilation and warn about version mismatches.
generally, ffmpeg should refrain from bumping their ABI so often. nobody’s got time to chase a moving target.