psychopy.org | Reference | Downloads | Github

Simple movieStim results in many dropped frames

I have a few simple mp4 videos. The videos are each created from 120 .png images with ffmpeg at 60 fps, at a size of around 2.5mb.

I pre load a number of visual.videoStim3 which I then assign to an array.

video = visual.MovieStim3(WIN, 
            os.path.join(VIDEO_PATH, stimulus), 
            units='pixels', 
            size = (100,100),
            pos = [0,0], 
            loop = True, 
        )
stimuli.append(video)

Then, for a given trial I access the video and present it as such:

video = sitmuli[curTrial]
while video.status != constants.FINISHED:
    video.draw()
    WIN.flip()

This results in visually noticable dropped frames/laggy video. The following output is generated showing the dropped frames. What can be causing these laggy frames?

I have tried this code on two separate systems and it gives a similar result in both. What can I do to combat dropped frames? The systems are 8 and 16GB memory respectively with nothing else running concurrently.

20.5015         WARNING         0.6987386000109836: Video catchup needed, advancing self._nextFrameT from 0.016666666666666666 to 0.03333333333333333
20.5016         WARNING         0.6987661000457592: Video catchup needed, advancing self._nextFrameT from 0.03333333333333333 to 0.05
20.5016         WARNING         0.6987795000313781: Video catchup needed, advancing self._nextFrameT from 0.05 to 0.06666666666666667
20.5016         WARNING         0.6988079000147991: Video catchup needed, advancing self._nextFrameT from 0.06666666666666667 to 0.08333333333333333
20.5016         WARNING         0.6988189000403509: Video catchup needed, advancing self._nextFrameT from 0.08333333333333333 to 0.09999999999999999
20.5016         WARNING         0.698829900007695: Video catchup needed, advancing self._nextFrameT from 0.09999999999999999 to 0.11666666666666665
20.5016         WARNING         0.6988406000309624: Video catchup needed, advancing self._nextFrameT from 0.11666666666666665 to 0.13333333333333333
20.5017         WARNING         0.6988510999944992: Video catchup needed, advancing self._nextFrameT from 0.13333333333333333 to 0.15
20.5017         WARNING         0.698861200013198: Video catchup needed, advancing self._nextFrameT from 0.15 to 0.16666666666666666
20.5017         WARNING         0.6988711000303738: Video catchup needed, advancing self._nextFrameT from 0.16666666666666666 to 0.18333333333333332
20.5017         WARNING         Max reportNDroppedFrames reached, will not log any more dropped frames

Try using visual.VlcMovieStim, which seems to often work better.