psychopy.org | Reference | Downloads | Github

Movie doesn't play

I am new here and don’t have experience about Psychopy before. I am trying to add video stimulus in my task, but when I try to add the .mp4 video by using MovieStim3, the video doesn’t play. The code shown below:

from psychopy import visual,event

win = visual.Window(
        size = [800,800],
        units = "pix",
        fullscr = False,
        color = [0,0,0],# [1,1,1]=white [0,0,0]=grey
        monitor="testMonitor")

  mov = visual.MovieStim3(
        win=win,
        filename = "Countdown.mp4",
        flipVert=False)

mov.draw()
win.flip()
event.waitKeys()
win.close()

** I haven’t built the whole module yet. I want to make sure my video module works well first, and then add multiple modules together. But I have been stuck here for a while now, thanks for your help!!

Hello, in the future, please do this to make your code readable (I’ve already edited your post above), as often issues with code are due to indentation problems, and we can’t see these when code is posted as normal text:

But in answer to your question, check out the movie demos under the demos menu in the Coder view of PsychoPy. In essence, you need to actively play a movie, by drawing each of its frames. At best above, the code would just draw the first image from the movie and then pause, waiting for a key. You need instead to create a loop, and call mov.draw() and win.flip() repeatedly until the movie is finished.

Thank you so much for your help! The demos menu is a very good resource!