A stimulus class for playing movies (mpeg, avi, etc...) in PsychoPy.
mov = visual.MovieStim(myWin, 'testMovie.mp4', flipVert=False) print mov.duration print mov.format.width, mov.format.height #give the original size of the movie in pixels mov.draw() #draw the current frame (automagically determined)
See MovieStim.py for demo.
mov.contains() and mov.overlaps() will work only if the containing visual.Window() has units=’pix’.
Draw the current frame to a particular visual.Window (or to the default win for this object if not specified). The current position in the movie will be determined automatically.
This method should be called on every frame that the movie is meant to appear
Load a movie from file
Brings up a warning if avbin is not found on the computer. After the file is loaded MovieStim.duration is updated with the movie duration (in seconds).
Pause the current point in the movie (sound will stop, current frame will not advance). If play() is called again both will restart.
Continue a paused movie from current position
Seek to a particular timestamp in the movie. NB this does not seem very robust as at version 1.62 and may cause crashes!
Add or remove a stimulus from the list of stimuli that will be automatically drawn on each flip
Not yet implemented for MovieStim
If set to True then the movie will be flipped horizontally (left-to-right). Note that this is relative to the original, not relative to the current state.
If set to True then the movie will be flipped vertically (top-to-bottom). Note that this is relative to the original, not relative to the current state.
See ~MovieStim.loadMovie (the functions are identical). This form is provided for syntactic consistency with other visual stimuli.
Stop the current point in the movie (sound will stop, current frame will not advance). Once stopped the movie cannot be restarted - it must be loaded again. Use pause() if you may need to restart the movie.