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.
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.
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:
the problem appeared out of nowhere,
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 .
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.
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!
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.
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.
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.
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.