"Invalid movie handle provided" error message

I have a script that just plays videos back to back based off of the “Play Movies Without Gaps” script in PTB’s Movie Demos. I am having a weird issue though where the script consistently picks one movie iteration to quit out of the script midway with an “Invalid movie handle provided” message. Which iteration/movie clip it finds invalid is not consistent. Furthermore, if I take the movie clip and play it through simpleMovieDemo, it plays just fine. In the moment, I can delete the video clip out of the queued clips and then the script will skip it and continue working as normal, but if I reload any of the parameters of the script, it will choose another video handle to quit out over. Again, I’m pretty sure this isn’t an issue with my actual stimuli itself. Does anyone know what it could be?

Ubuntu Linux 22.04
Matlab R2022b
PsychToolBox Version: 3.0.19 - Flavor: Debian package - psychtoolbox-3
Code: playMoviesWithoutGapDemo1.m
Error message: “Invalid movie handle provided”

Don’t know, I’m on vacation, no equipment or desire to look at this. But maybe play with the 0.5 seconds threshold wrt. pts in that script or check if pts does something weird in the failing case? If the movies are very short, maybe 0.5 is too long.

Or try the PlayMoviesWithoutGapDemo2.m method, which works if all your movies are of the same image size and encoding, and just differ in content.

Hi Mario! Thank you so much for your response! I knew you were on vacation for the next couple weeks and so I didn’t expect to hear from you—as such, I am incredibly grateful for your input and I apologize for disrupting your break. Just following up to confirm that this does seem to be a video loading issue. My videos are only about 3 seconds long as so the 0.5s threshold does seem to be too short. I changed it to 0.25s and the problem resolved itself. Thank you again!