Frame drop causing video lag and timing issue

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): v3.1.5
Standard Standalone? (y/n) If not then what?: yes

What are you trying to achieve?:

Recording the reaction time of participants starting from a particular frame in a movie stimulus

What specifically went wrong when you tried that?:

The movie stimulus lags and plays longer (and sometimes even shorter!) than it is supposed to. Its duration is inconstant between trials. At best, it varied by 20 ms, making me question the reliability of my reaction times. Additionally, the stopping time of the movie is not recorded.

What did you try to make it work?:

I tried changing the format of my videos (H.264, H.265, MPEG-4, and WMV), their size (HD, FHD, 4K) and frame rate (30 and 60 fps). I tried using videos with the same size as my display resolution since it was the solution to a similar problem (Video stimulus unusually slow). I tested my experiment with different videos from different sources, on different computers (some with dedicated graphics cards), and on different monitors. None of these things worked.

Since the stopping time of the movie was not recorded, I calculated the duration of my videos by subtracting their starting time to that of the fixation cross following the video. I believe the problem is due to another issue with tStopRefresh (https://github.com/psychopy/psychopy/issues/2329). To bypass it, I also recorded tStopRefresh at the frame before the last one (so the time at the beginning of the last frame’s refresh). The results were the same.

I finally tried adding a static screen period for pre-loading the videos, even though from my understanding the videos were already pre-loaded by default.​ It did not work either.

There is no error message. I only got dropped frames warnings for certain setups.