Package psychopy :: Module visual :: Class MovieStim
[frames] | no frames]

Class MovieStim

source code


A stimulus class for playing movies (mpeg, avi, etc...) in PsychoPy.

examples:

mov = visual.MovieStim(myWin, 'testMovie.mp4', fliVert=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.

Instance Methods
 
__init__(self, win, filename='', units='pix', size=None, pos=(0.0, 0.0), ori=0.0, flipVert=False, flipHoriz=False, opacity=1.0)
:Parameters:
source code
 
setOpacity(self, newOpacity, operation='')
Sets the opacity of the movie to newOpacity
source code
 
setMovie(self, filename)
See ~MovieStim.loadMovie (the functions are identical).
source code
 
loadMovie(self, filename)
Load a movie from file
source code
 
pause(self)
Pause the current point in the movie (sound will stop, current frame will not advance
source code
 
play(self)
Continue a paused movie from current position
source code
 
seek(self, timestamp)
Seek to a particular timestamp in the movie.
source code
 
draw(self, win=None)
Draw the current frame to a particular visual.Window (or to the default win for this object if not specified).
source code

Inherited from _BaseVisualStim: setColor, setContr, setDKL, setDepth, setLMS, setOri, setPos, setRGB, setSize, setUseShaders

Method Details

__init__(self, win, filename='', units='pix', size=None, pos=(0.0, 0.0), ori=0.0, flipVert=False, flipHoriz=False, opacity=1.0)
(Constructor)

source code 

:Parameters:

    win :
        a :class:`~psychopy.visual.Window` object (required)
    filename :
        a string giving the relative or absolute path to the movie. Can be any movie that 
        AVbin can read (e.g. mpeg, DivX)
    units : **None**, 'norm', 'cm', 'deg' or 'pix'  
        If None then the current units of the :class:`~psychopy.visual.Window` will be used. 
        See :ref:`units` for explanation of other options.
    pos :
        position of the centre of the movie, given in the units specified                
    flipVert : True or *False*
        If True then the movie will be top-bottom flipped                
    flipHoriz : True or *False*
        If True then the movie will be right-left flipped            
    ori :
        Orientation of the stimulus in degrees                
    size :
        Size of the stimulus in units given. If not specified then the movie will take its
        original dimensions.                
    opacity :
        the movie can be made transparent by reducing this

Overrides: _BaseVisualStim.__init__

setOpacity(self, newOpacity, operation='')

source code 

Sets the opacity of the movie to newOpacity

Over-rides _BaseVisualStim.setOpacity

Overrides: _BaseVisualStim.setOpacity

setMovie(self, filename)

source code 
See ~MovieStim.loadMovie (the functions are identical). This form is provided for syntactic consistency with other visual stimuli.

loadMovie(self, filename)

source code 

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).

Parameters:
  • filename, string - The name of the file, including path if necessary

seek(self, timestamp)

source code 
Seek to a particular timestamp in the movie. NB this does not seem very robust as at version 1.62 and may cause crashes!

draw(self, win=None)

source code 

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

Overrides: _BaseVisualStim.draw