Motion detected problem python

I made an application with Tkinder using the OpenCV library on MP4 recordings from a security camera. The video sometimes progresses very slowly when the frame rate is high, and sometimes it doesn’t detect any moving parts at all. However, there is no problem with short videos. It works as I want. It’s more stable, and although it has graphics card support, I can’t use it with high performance. Can you help me?