Hello there,
I’m using VlcMovieStim to display videos in my experiment, but this seems to cause Psychopy to crash the whole experiment by chance. Out of the last 5 attempts it crashed 2 times at the point in the experiment where the movie was supposed to start. When it crashes, the experiment exits without producing any error message about what the issue was, it just exits with the code 3221225477.
Here some information about the environment I’m working in:
- Psychopy version 2022.2.5
- Python 3.8.10
- Windows system 10.0.17763
- Processor Intel Xeon E5-1620
- RAM 16GB
I’m working in the Coder. This is how I intialize and load my video.
mov = visual.VlcMovieStim(win,
size=(1920, 1080),
flipVert=False)
mov.loadMovie(_thisDir+'\\pathto.mp4')
I then start the video and send EEG triggers via a parallel port throughout the video presentation.
# function for sending a trigger with a specific value
def trigger(wert=0):
port.setData(wert)
core.wait(0.001)
port.setData(0)
#### Performance Run ####
mov.play()
# send trigger
win.callOnFlip(trigger, start_performance)
print(f"Trigger {start_performance}")
lastTriggeredFrame=0
while mov.status != constants.FINISHED:
mov.draw()
currentFrame = mov.getCurrentFrameNumber()
if (currentFrame in trigger_dict) and (currentFrame != lastTriggeredFrame):
win.callOnFlip(trigger, trigger_dict[currentFrame])
lastTriggeredFrame = currentFrame
print(f"Trigger {trigger_dict[currentFrame]}")
# save timestamps
thisExp.addData('trigger', trigger_dict[currentFrame])
thisExp.timestampOnFlip(win, 'trigger.timestamp')
thisExp.nextEntry()
win.flip()
# process keyboard input
if testing:
if event.getKeys('space'): # quit routine
break
# send trigger
win.callOnFlip(trigger, end)
print(f"Trigger {end}")
# stop the movie
mov.stop()
The print statement of the first call to the trigger function works but it does not seem to continue with displaying the first frame of the video. First it displays a grey background and then crashes completely.
I tried using both MovieStim2 and MovieStim3 instead but they both produce significantly worse video playback performance where the audio lags for multiple seconds at the end of the clip.
Do you have an idea what could cause these issues and how I could adapt the code?
Is there another way to play large HD video files (6GB) that works for you?
Thanks in advance!