psychopy.org | Reference | Downloads | Github

A bunch of issues with MovieStim3, and probably moviepy more generally

So first I wanted to mention I’m getting bad behavior that is like what is mentioned in these two threads, but also some additional issues:


My major issues arise when trying to loop videos or stop on a particular frame, especially if the video has audio associated with it. I’m getting behaviors where, on looping, the movie will have doubled audio. I’m also getting issues where I will try to get it to pause on a frame near the end and it will instead land on a black screen, or if I try to get it to loop without displaying a blank frame in between and it will still insert a black screen. I recently stopped trying to manually create a frame-counting system and instead started relying on MovieStim3’s getCurrentFrameTime(), but until then I was getting some severe desyncs with my manual frame counts and the movie’s playtime and occasional crashes if it went looking for a frame that didn’t exist.

Worst of all, these issues are inconsistent to reproduce and seem heavily tied to timing issues that vary from computer to computer based on the processor and RAM, as far as I can tell. You could not ask for a more maddening set of glitches. The only really consistent thing I’ve found is that if you try to seek(0) on a movie with audio, it is more likely to do something strange like double the audio or have it out of sync with the video. Even that isn’t deterministic.

Basically, I need a better way of figuring out where I am in the video, re-syncing the audio if needed, and being able to stop on a specific frame. Does anyone have ideas about how I could reach down into a moviestim object and get the info I need, or is this an issue that requires further development work?

I’d love to see MovieStim3 improve but your post doesn’t give much concrete stuff to work on. It would be great to take one problem at a time and fix it, rather than “soem additional issues”.

You can, of course delve into the code of the stimulus yourself - it’s all pure python code sitting right there. If there are bugs in our implementation then let’s work out where. If you can generate something that reliably causes a problem then lets look at it. If the issue is just certain movies then share them.

The problem is I’m not getting consistent behavior, there’s at least three different issues I’ve run into and I haven’t been able to find a way to make them happen consistently, which makes them very difficult to diagnose. Here’s the most concrete descriptions I can give:

  1. In my study, I load all of the videos at the start (so there are not long loading pauses between trials). Then, at the start of the trial, I display a video and immediately pause it. First of all, you have to initiate “play”, then “draw”, and then immediately “pause” in order to get it to display the first frame, which is a little bothersome. However, sometimes when you do this, it plays the entire audio for the whole video at once. The videos I’m using only have one sound in the middle and are otherwise silent, but I’ve had it start playing an entire audio track before the movie actually begins.

  2. I have been looping using seek() because I have found the Loop property to be unreliable (it will either crash or just not loop). Sometimes, when seeking back to the beginning of a video, without pausing, it will play the audio track “doubled up” and slightly asynchronous, leading to a strange echoey sort of effect. I have not been able to hunt this down at all, and it happens inconsistently, maybe once every three times I try to repeat a video and in no consistent pattern (so, sometimes it’ll do it first time I seek back, sometimes it’ll do the first one fine and then it’ll happen on the second or third, etc.)

  3. This is more of a feature request, but while I have a way to get the timestamp of the video, I don’t seem to have the tools to figure out what frame I’m on (despite the movie presumably being a series of frames), and I don’t have a way to relate the timestamp of the video to the timestamp of the audio stream so I can’t measure or detect desyncs. Desyncs are not common, they seem to crop up when a background process slows the video down a little bit, but I have no way to detect them. I haven’t been able to figure out how that would even work, but if you can give any hints that would be greatly appreciated.

1 Like