Inaccuracy in timing of visual stimuli

OS: Win 10
PsychoPy version: v2021.2.3
Standard Standalone? yes
What are you trying to achieve? Temporal accuracy in visual tasks.
I have a visual task that a square should last on the screen for a certain amount of time and them be replaced by another square. timing of these squares differ but usually they are a few hundred ms. As this is a timing project, they need to be very exact and accurate but it seems they are not.
I recorded the screen while my visual task was running with a resolution of 120 frames per second (I used Wodershare DemoCreater for recording the videos), then I counted the number of frames it takes for a square to be replaced by another one. And unfortunately, the timing is not very precise. I used Wodershare DemoCreater for recording the videos.
for example, when I run an isochronous sequence comprised of durations of 540 ms, each square took 68 frames, the video was recorded at 120 fps which means each frame is about 8.333 ms. So each square is lasting 566.666 ms instead of 540ms!
Then I tried to play 1,2,3,4 multiplied by 0.27 ms which means I should have had squares lasting for 0.27, 0.54, 0.81, and 1.08 ms. The result for them is 36,68,101,132 frames. It shows that the shorter the interval the less accurate the timing!
Do you think my method (recording screens and counting frames) might have been wrong or they are actually imprecise? If the latter is true, how can I improve it?
It’s noteworthy to mention that I even tried the experiment with no costume code and only with routines but the result is still what I said.

Hello ZHaled,

what is the refresh of your monitor?

You can’t display 0.27, 0.54, 0.81, and 1.08 ms on an ordinary display. Even with a gaming monitor running with 240 Hz, you can get faster than 4 ms. In addition, the advertised 4 ms are “usually” longer because pixel are overdriven which means that they glow longer that 4 ms and they are brighter than intended.

Despite of the software being able to render your videos with 120 fps, your hardware must be able to do so as well.

Best wishes Jens

Hi. Thank you very much for your answer. You are right. I checked my monitor’s refresh rate and it’s 60.003 Hz.
But how do you think this relates to the fact that the shorter the interval the more the difference between what is recorded and what it should be, i.e. shorter intervals show more error?

Do you really mean ms here? Or seconds?

Sorry these are seconds: 0.27, 0.54, 0.81, 1.08. which are equivalent to 270, 540, 810, and 1080 ms.

Hello Zhaleh,

Timing reported by software is not very reliable. If you want to check your timing, get a oscilloscope and a photo-diode and measure the timing. There various articles in Behavior Research Methods about this topic.

You might want to use frames instead of milliseconds to determine stimulus onsets and stimulus durations. PsychoPy offers this option, see here Presenting Stimuli — PsychoPy v2022.2.4. In this case you wouldn’t use a video for stimulus but present the stimuli as visual stimulus, e.g. as a picture if this suits your purpose.

Best wishes Jens