Substantial audio lag using MovieStim3

I am trying to present mp4 files (about 10 minutes in length) for a fMRI experiment. The code that I have is working, and the movie stimulus successfully comes up and is played. However, the video lags about 3 seconds behind the audio. Is there a way to fix this? I’m not sure what is causing the delay, and can’t seem to find a solution online. For reference, I’m using MovieStim3 with psychopy v2023.2.0. The FrameRate is 60 (which matches my graphics card). Thank you for your help!

What OS are you using, and how are the movie files encoded?

MovieStim3 isn’t particularly efficient as a movie player, unfortunately. It’s good for short clips but when it has to load a longer clip into memory it can introduce some weird behavior. You could try switching to MovieStim or vlcMovieStim and see if either of them work better, or see if there’s any media encoding that runs better (e.g., .h264 encoding, lower resolution or framerate, lower audio sample rate, etc.)

Thank you, that is helpful information! I will try those suggestions. I primarily chose MovieStim3 because it gives more accurate timing information compared to MovieStim. Do you know of any potential work-arounds to get more accurate frame timing information using MovieStim? Sorry for asking a potentially basic question, it’s my first time using PsychoPy to present movie stimuli in an fMRI experiment.

The ffpyplayer engine for MovieStim is the recommended approach and the only one the core team are now working on. It has by far the best performance so please use that and let us know if there are any issues we need to fix with that solution

thanks