This is an issue I have been facing recently. What worked for me is copying the ffmpeg related DLL to the application folder. Depending on your configuration, you need to copy opencv_ffmpeg245d.dll for debug or opencv_ffmpeg245.dll for release.
Let me know if that works for you!
Best regards, Andrei C.