Exporting random dot motion stimuli as mp4 files

Hi,

I’m trying to export random dot motion stimuli from PsychoPy as mp4-files, so that I can use them as videos for an online study. In doing this I have been following guidance from this previous post. Specifically, I have created a trial with a Random Dot Kinematogram and the following code component (simple example attached):

Begin experiment: from moviepy.editor import ImageSequenceClip
Every frame: win.getMovieFrame(buffer=‘back’)
End routine: win.saveMovieFrames(‘DotStim.mp4’)

However, when running this I get an mp4 file showing only a blank grey screen. I’ve been playing around a bit with moving the code above in the full script as some users have suggested this may be the result of it being in the wrong place relative to win.flip, but the result always seems to be the same. I’d be really grateful for any tips on how I might solve this!

OS (e.g. Win10): Windows 10 Pro
PsychoPy version (e.g. 1.84.x): 3.2.4createDotStim.psyexp (5.7 KB)

Should anyone need this in the future: solution was to add ‘dots.draw()’ to the ‘Each Frame’ tab of the code component!