Video playback stutters and MovieStim never reaches finished
OpenSesame version
4.0.13
Operating system
Windows 11
Backend
PsychoPy
Expected behavior
The experiment should play video stimuli (23 seconds long) with accurate timing for a video-based eye-tracking experiment. The videos should smoothly without (or minimal) dropped frames and reliable synchronization between video stimuli and gaze recording.
Actual behavior (what goes wrong)
Under Windows, video playback stutters, PsychoPy reports dropped frames, movie.status never changes to finished and the last video frame often remains on screen indefinitely, leading the screen to freeze.
What did you try already?
I first created a minimal experiment in OpenSesame with only one video and without EyeLink, images, loops, logging or any inline processing except video playback. But the problem still occurs. My current hypothesis is thus that the problem is not due to the experiment in OpenSesame itself.
I tested a standalone PsychoPy script without OpenSesame. There videos open correctly, video duration is detected correctly, playback reaches the end and script exits normally. Yet, PsychoPy repeatedly reports Video catchup needed..., Max reportNDroppedFrames reached... or Multiple dropped frames have occurred. So the dropped-frame warnings also seem to occur outside OpenSesame.
I tested a simple PsychoPy script displaying only an empty window. window.flip() remained stable at approximately 59.93 Hz, so general display timing seems to functioning correctly.
No obvious OpenGL errors were reported. (Intel UHD Graphics 770, OpenGL 4.6).
movie.duration returns the correct duration of stimuli videos, so PsychoPy seems to read the MP4 metadata correctly.
I created a minimal script that waits until
movie.status == FINISHED
But this condition is never reached, even though the video visibly reached its final frame.
I also attempted to replace the MoviePy backend inside MovieStim3 with ffpyplayer, while trying to keep the public API as close as possible to the original implementation. The current implementation uses MediaPlayer for decoding, manual frame extraction, NumPy frame conversion, manual OpenGL texture upload, while the original MovieStim3 drawing pipeline is largely preserved. Yet, this solution seems very prone to errors to me.
Those are the video properties: MPEG-4, H.264, 30 fps, Duration: 23.0 s, Variable bitrate (~2.1 Mbps). The videos play within the experiment without stuttering on macOS.
At this point, I believe the issue is not caused by my experiment logic as the same behaviour/ errors also occur with a minimal PsychoPy script outside OpenSesame.
Has anyone an idea how I get the videos to run smoothly and reliably on the Windows system with most accurate timing? Has anyone replaced the MoviePy backend in MovieStim3 with ffpyplayer, or is there an existing implementation that could serve as a reference?