Hello everybody,
I created a loop in Psychopy 1.85.2 that shows a video in each iteration. For a few iterations, it seems to work fine. However, when I include all videos (106), I run into memory error problems each time.
The code is Python. The video object is created with the Psychopy function ‘visual.MovieStim3’. I am not entirely sure about the video objects being the issue here. But because I thought they were, I tried to delete the video objects after their presentation using the following snippets, but it did not work:
del video._mov
video._unload()
win.clearBuffer()
This is the video snippet from within the loop:
# play the video video = visual.MovieStim3(win, filename = trialArray[trial], size=(1920,1200), flipVert=False, flipHoriz=False, loop=False, opacity=(1.0)) current_time = trial_clock.getTime() while trial_clock.getTime() < current_time + 6.6: video.draw() win.flip() # start registering potential keypresses keypress_video = event.getKeys(keyList=None, modifiers=False, timeStamped=trial_clock) if keypress_video != []: keypresses.append(keypress_video) # include the escape key as a way to exit the experiment. if keypress_video[0][0] == 'escape': print ('Sie haben das Experiment verlassen.') sys.exit() else: pass else: pass video_duration = trial_clock.getTime() - current_time video.stop()
I sometimes get this error message: “Fatal Python error: (pygame parachute) Segmentation Fault”
But otherwise, I mostly get this one:
or this: “Traceback (most recent call last):
File “K:\Mitarbeiter\Juliane\1_PaGiPoP\experiment\02_Lab-study\2019-05-17_script-for-lab-study\pagipop_rating_04-test.py”, line 292, in
runTrial()
File “K:\Mitarbeiter\Juliane\1_PaGiPoP\experiment\02_Lab-study\2019-05-17_script-for-lab-study\pagipop_rating_04-test.py”, line 150, in runTrial
video.draw()
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\visual\movie3.py”, line 380, in draw
self._updateFrameTexture() # will check if it’s needed
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\visual\movie3.py”, line 305, in _updateFrameTexture
self._numpyFrame = self._mov.get_frame(self._nextFrameT)
File “”, line 2, in get_frame
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\decorators.py”, line 89, in wrapper
return f(*new_a, **new_kw)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\Clip.py”, line 95, in get_frame
return self.make_frame(t)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\video\io\VideoFileClip.py”, line 103, in
self.make_frame = lambda t: self.reader.get_frame(t)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\video\io\ffmpeg_reader.py”, line 179, in get_frame
result = self.read_frame()
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\video\io\ffmpeg_reader.py”, line 147, in read_frame
result = np.fromstring(s, dtype=‘uint8’)
MemoryError
portaudio error in Pa_AbortStream: Wait timed out”