MovieStim3 >1 s load time, Windows 10 (new problem in old script)

Hi PsychoPy community!

Thank you in advance for your help!

I have a script that has been running without issues since 2019 until recently. In the past few weeks, there is a 1.4-1.6 s load time for each movie stim that had never happen before. The load times do not vary based on file sizes. I am quite baffled, since nothing has changed (i.e. no new hardware/software changes, other than windows updates, which I know sometimes may break things).

The videos are .mov files, I tried to use mp4, wmv, none of the other file format helped. Videos play fine on Windows Media Player without the load time issue.

I am using psychopy v3.2.4 on a Windows 10 computer (itā€™s a beefy VR/gaming computer that is only 1.5 years old). I tried upgrading psychopy to the newest version, but the experiment wonā€™t run there.

Any idea what went wrong, and how I can fix this?

Thank you so much!

Hi VR_COACH,

Iā€™ve experienced the EXACT same thing, Iā€™ve posted here before, tried a million things, and no solution thus far. Only thing Iā€™ve been able to find that helps is by using ā€œconstantā€ instead of ā€œset every repeatā€ in the movie routine. Although that might not be viable for you, it helps with the load times. Otherwise, no solution. This problem has halted all of my data collections. Really could use some help with this, too.

Hi Falexs, I am so glad I am not the only one! If I am using coder, where and what would I set as constant? Thank you!!

If that doesnā€™t work, I am going to try a windows 10 system restore to see if it was some windows update that caused the issue. Will report in.

I was using builder. So the difference between ā€œconstantā€ and ā€œset every repeatā€ in the code would be where the code for the video was located, either at the beginning or in the loop of that trial, respectively. I compared them both, thatā€™s the only difference I could spot.
I really think its some weird Windows update bug too. This is because:

  1. the problem appeared out of nowhere,
  2. I have 3 quite capable computers that have loading time issues but another in which the experiments work fine even though the latter is less powerful .
  3. Iā€™ve tried everything I could think of just to come to the conclusion that moviepy3 has trouble loading videos mid experiment for some computers but not others.

I was thinking of doing that too or installing ubuntu. Please do let me know how things turn out for you.

Turns out I did not have restore points going back far enough to roll back the updates (sigh).
So I tried everything I can think of on the system:

  • reinstalled PsychoPy v3.2.4
  • updated Windows, graphic card driver, etc
  • installed PsychoPy v2021.1.4, got the experiment to run (turns out Textbox was what was broken) but video still have the same time lag.

In the end, I loaded all of the videos into variables, something like this:

for row in csvFile:
globals()[row[ā€˜Variableā€™]]=visual.MovieStim3(win, media_dir + row[ā€˜Dirā€™] + slash + row[ā€˜Fileā€™], size=szMov, flipVert=False, flipHoriz=False, loop=False,pos=(0.0, 50.0))

Then just called the variables based on what stimuli needs to be presented.

This added about 3 minutes load time (I have 144 videos) on the front end of running the script, but it is presenting without any delays now!

(Still grumpy about how and why it happened though!)

1 Like

For kicks, could you try VlcMovieStim instead of MovieStim3? It uses VLC to load/decode the movies rather than ffmpeg and the performance is probably better than ffmpeg @mdc spent a fair bit of time optimizing it for 2021.2

Iā€™m afraid I have no idea why a Windows update would slow tings down though! :disappointed:

Hi Jon, many thanks for the feedback.
Unfortunately, I always get this error message AttributeError: module 'vlc' has no attribute 'CallbackDecorators. Iā€™ve tried different things, including changing the script itself (of the vlcmoviestim.py), but thereā€™s always something to give off an error. The only playback backend that does run is moviepy, but unfortunately has the loading problem. Whether it is a 400kb 3s movie or a 75mb 1m movie, it takes upwards of 3s per trial to update the component. Only one computer Iā€™ve tested this in doesnā€™t have this problem (ironically, the less capable/powerful on paper), and I canā€™t figure out why. And yes, this is already in version 2021.1.

Hello,

Ensure that the version of python-vlc installed is 3.0.11115 if using Windows, newer versions are buggy and older versions may be incompatible.

Hi,

Thank you. I just did. Reinstalled the newer, then again the older (3.0.11115) version as you recommended. Unfortunately, the same error prevails:
Files\PsychoPy\lib\site-packages\psychopy\visual\vlcmoviestim.py", line 163, in <module> @vlc.CallbackDecorators.VideoDisplayCb AttributeError: module 'vlc' has no attribute 'CallbackDecorators'

This is very strange since it works on my platform with that configuration. Might be loading the wrong version from somewhere, but Iā€™m not too sure at this point.

So Iā€™ve figured out the error. Turns out I had a vlc folder in my site-packages folder that I had to remove because Psychopy was fetching the functions from there and not the vlc.py as it should. Now it runs, and does not have loading times. However, it crashes after 2 seconds of movie playtime without any error message.

There is some weirdness with vlcmoviestim on Windows to be sure. Iā€™ve had the same ā€œcallbackdecoratorsā€ issue and bottom line no matter what I do with environment variables it keeps crashing. I will try Falexsā€™s solution for that as well.

Separately Iā€™m wondering if the newer version of MoviePy I mentioned in this github issue might address the original problem as well. There seem to have been some changes to memory management in the most recent versions that certainly affect how things go on MacOS, but itā€™s possible they will help Windows as well.

1 Like

Thanks Jonathan. Iā€™ve actually tried to use the newer version of moviepy (the one you mentioned) but no difference.
I believe that the memory issue I think is linked to Psychopy itself. For instance, even in a different experiment, where I have multiple images (not movies!) refreshing every frame, Psychopy has trouble keeping up. For instance, while it should print 60 times a second the following command:

print(frameN)

It only actually prints about 6-8 times each second. Only if I leave the images at ā€œconstantā€ does it print the 60 times it should.
Loading external files seems to be slowing down Psychopy recently. And after weeks of trying different things I cant figure out why. It has stopped all my data collections. :frowning:

Thanks for pointing these issues out. Iā€™m not sure why file access speeds have changed so dramatically offline in since previous releases on your machines. Weā€™ll need to investigate this further, so I created an issue here.

These issues are likely not PsychoPy per se since we use external libraries to load images and the regression is likely happening there. However, it could be a problem related to caching or OpenGL that weā€™ll need to look into.

1 Like