Preload audio-visual movie

If this template helps then use it. If not then just delete and start from scratch.

**OS Win10
**PsychoPy version v2020.1.3

Hello everyone,
I am trying to load a lot of small audio-visual movies in order to perform a psychophysical experiment online.
If I call a movie in the trial, the sound is not well delivered (it is not smooth at all).
Do you have any suggestion on how to solve this problem?
Since the movie is very short, I thought that it could be a problem of loading… Does somebody know how to preload all the movies stimuli before starting the trials?

Best,
Alessandra

Hi Alessandra,

Have you found any solution to this problem? I have the same problem.

Best regards,
Lucia

Please could you describe your issue more specifically? How many movies do you have as separate components? How many different movies does each participant see?

Thank you very much for your response!

In my experiment, there are two players interacting, and depending on what each one does influences the other (connected through a server). The main routine is based on a video (“car_approaching”) and depending on when the participant presses (or the other participant presses) a specific video follows (Routine called “car_turning”), and at the end, feedback appears with a text describing their performance.
image

At the beginning, in the movie component of the first routine, I set the video up using “movie file : $crash” so that the video would change depending on the $crash variable (variable located in the excel file placed in the “trials” loop).
image
However, there was some desynchronization when each video started on each computer (milliseconds but perceptible, and in my experiment, it is very important that both videos for both players start at the same time). To try to see if the problem was related to the videos I tried different strategies:

  • I changed the duration from seconds to frames because it seems to be more accurate.
  • First I tried to use all the time the same video (‘car_crash_4.mp4’) in both routines (and leave them as “constant”) and in this case it worked perfectly (but the loop didn’t work).
  • I have also tried to leave the first video “constant” and the second one changing depending on when they press and it also seems to work fine. The only problem, in both cases, is that I don’t know why the loop to repeat this process several times doesn’t work.

It runs one routine (cross + video + video + feedback), the next cross appears and then the experiment stops and the following error appears:

1.4527     WARNING     We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use ['sounddevice', 'PTB', 'pyo', 'pygame'] (in that order).
Traceback (most recent call last):
  File "C:\Users\Lucia\Desktop\Chicken's game\WORKING\MRI_Chicken_Bscanner_FR_lastrun.py", line 786, in <module>
    mov.setAutoDraw(True)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\movie3.py", line 512, in setAutoDraw
    self.play(log=False)  # set to play in case stopped
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\movie3.py", line 228, in play
    self._videoClock.reset(-self.getCurrentFrameTime())
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\movie3.py", line 301, in getCurrentFrameTime
    return self._nextFrameT - self._frameInterval
TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'
Exception ignored in: <bound method MovieStim3.__del__ of <psychopy.visual.movie3.MovieStim3 object at 0x0000026639520390>>
Traceback (most recent call last):
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\movie3.py", line 499, in __del__
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\movie3.py", line 476, in _unload
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\basevisual.py", line 1020, in clearTextures
OSError: exception: access violation reading 0x0000000000000000
##### Experiment ended. #####

The video ‘car_crash_4.mp4’ is not really heavy (1.20 MB), so I don’t think it should take long to load.

There are two problems when the first video is set to “constant”, it works (but when I change it to “set every repeat” there is a delay, no matter if I use the excel file or a code component to load the video in the “cross” component. But using “constant” the loop doesn’t work! So I could either leave the first video as “constant” and use the same (if it can be repeated using the loop, and not use the excel file) or preload the videos somehow (but I don’t know how to do it correctly).