Problems with Screen('AddFrameToMovie')


I am having problems recording a random dot stimuli that I present on a screen using Psychtoolbox. (Matlab 7.7.0 R2008b, PTB 3.0.9)

The stimuli that I am using presents a small set of dots (say 10) each frame at 60Hz. Every frame, a different set of dots with different positions is presented.

I can record a movie using 'CreateMovie', 'AddFrameToMovie' and 'FinalizeMovie'.

For example:

moviePtr = Screen('CreateMovie', curWindow, 'temp.mp4', 192, 192,60);
Screen('AddFrameToMovie', curWindow, apRect(df,:);
Screen('FinalizeMovie', moviePtr);

However, the frames that are recorded do not seem to represent what is shown on the screen. Specifically, 'AddFrameToMovie' seems to add a frame with the current dots but also with all dots that were previously presented. So for example, frame 1 has ten dots, frame 2 has twenty dots (ten dots from the first frame and ten new dots). Frame 3 has 30 dots, and so on. This continues until the 60th frame, after which the function starts back at 10 dots.

Does 'AddFrameToMovie' do something similar to 'GetImage'? I have tried using Screen('GetImage', curWindow, apRect(df,:)); to see what is shown at each point that I use 'AddFrameToMovie'. The matrix returned always gives me 10 dots instead of more than 10.

Does anyone know why 'AddFrameToMovie' does not add a frame with just 10 dots each time?

Thank you,

Edmund Lam