psychopy.org | Reference | Downloads | Github

MovieStim3 play method does not work

I am trying to use the MovieStim3 class to create a stimulus which will play a .mp4 movie, but I can’t seem to get it to work. When I call the play method nothing happens. Here is an example of the code I am using.

from psychopy.visual import Window, MovieStim3

# create the window and stimulus object
w = Window(screen=0, size=[1280,720], units='pix')
f = '<path/to/movie>'
s = MovieStim3(w, f, volume=0, size=w.size, units='pix') 

#play the movie
s.play() # this call returns but nothing  happens

I can play the video by manually drawing each frame and flipping the window.

n_frames = 613 # I happen to know the video is made of 613 frames
for iframe in range(n_frames):
    s.draw()
    w.flip()

What gives? I have attached an example of the video I am trying to play (I guess mp4 videos are not a supported format), and I am using PsychoPy version 2021.1.3

Hello,

you might want to check whether you used the proper format, see here. MP4 is just a container. In addition, PsychoPy offers different movie-backends. You might want to try these.

Best wishes Jens