Hi everybody
I simply want to play a short avi video (between 800ms and 2s) without sound, from start to end.
I use psychopy v1.83.03 with windows7
and my english is poor
I tried with movieStim but sometimes it freezes at the end of the movie, and sometimes not. when I run the script several times consecutively without change, some times it freezes without logic.
here is my code
from __future__ import division
from psychopy import visual, core, event
import time
win = visual.Window(fullscr=True)
mov = visual.MovieStim(win, '2000ms8R_ll.avi')#, size=(1920,1080),2000ms8R_ll.avi800ms8L.avi
# flipVert=False, flipHoriz=False, loop=False)
img=visual.ImageStim(win,"CXL_xl.jpg")
print('orig movie size=%s' % mov.size)
print('duration=%.2fs' % mov.duration)
globalClock = core.Clock()
start=globalClock.getTime()
temps=globalClock.getTime()-start
while globalClock.getTime()-start<=mov.duration:
temps=globalClock.getTime()-start
print temps
mov.draw()
win.flip()
print "exit loop"
win.flip()
print "videok"
output when it works
...
1.90218114352
1.93437808027
1.96849734988
exit loop
videok
output when it doesn’t works
...
1.89641100856
1.92962157529
1.96301975623
1.9966506016
With MovieStim2 i only have the first frame,but the loop stops at good time
from psychopy import visual, core, event
import time
win = visual.Window(fullscr=True)
mov = visual.MovieStim2(win, '2000ms8R_ll.avi')#, size=(1920,1080),2000ms8R_ll.avi800ms8L.avi
# flipVert=False, flipHoriz=False, loop=False)
img=visual.ImageStim(win,"CXL_xl.jpg")
print('orig movie size=%s' % mov.size)
print('duration=%.2fs' % mov.duration)
globalClock = core.Clock()
start=globalClock.getTime()
temps=globalClock.getTime()-start
mov.play()
win.flip()
mov.draw()
while globalClock.getTime()-start<=mov.duration:
temps=globalClock.getTime()-start
print temps
mov.draw()
win.flip()
print "exit loop"
win.flip()
print "videok"
with movieStim3 i have this error
Traceback (most recent call last):
File "F:\Work\Work\Jenny\tests videos\test_moviestm3.py", line 22, in <module>
mov.draw()
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.03-py2.7.egg\psychopy\visual\movie3.py", line 369, in draw
GL.glPopClientAttrib(GL.GL_CLIENT_ALL_ATTRIB_BITS)
TypeError: this function takes 0 arguments (1 given)
2.7183 WARNING Monitor specification not
I have problems with demo too
demo MovieStim.py :
Traceback (most recent call last):
File "C:\Users\simon\Desktop\MovieStim.py", line 11, in <module>
mov.draw()
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.03-py2.7.egg\psychopy\visual\movie3.py", line 369, in draw
GL.glPopClientAttrib(GL.GL_CLIENT_ALL_ATTRIB_BITS)
TypeError: this function takes 0 arguments (1 given)
with demo movieStim2.py,It starts to play without action keys but stop quickly.
Sometimes after 57 loops, sometimes after 19
I tried to replace “while mov.status != visual.FINISHED:” with “while 1”–> it show only the first frame
If SomeOne has simple code to play an avi from start to end without pause, without sound, i will be eternaly gratefull.
here is an example of video : https://amubox.univ-amu.fr/index.php/s/ivFIf8zizShN8D5
thanks