Clicks in Video (with sound) display

Hi everyone,

I am performing an EEG experiment using Psychtoolbox to display the stimuli. In short, I play 500 stimuli of a female speaker pronouncing /ba/ after each other. So, it is a video+sound. Sometimes, around 12 times out of 500, we hear a click or distorted piece of sound. This is not favourable as we are trying to record an MMN (a signal do deviant sounds).

This is my code to play the video:

 windowrect = [];
screenid = max(Screen('Screens'));
win = Screen('OpenWindow', screenid, 0, windowrect);

 if currentStimulus == 1 && currentReaction == 0
    STDmovie = Screen('OpenMovie', win, STDmoviename);
    %tBeforeTrigger = GetSecs()-startSecs
             if is_EEG_present 
    Screen('PlayMovie', STDmovie, 1);
    while 1
        tex = Screen('GetMovieImage', win, STDmovie);
        if tex>= 0
            [pressed, firstPress]=KbQueueCheck(deviceIndex);
            timeSecs = firstPress(find(firstPress)); 
            if pressed
                if is_EEG_present 
                KeyName = KbName(min(find(firstPress))); 
                TimePressed = timeSecs - startSecs;
                fprintf('"%s" typed at time %.3f seconds\n', KeyName, TimePressed);
                AllKeysPressed = [AllKeysPressed, KeyName];
                AllTimePressed = [AllTimePressed, TimePressed];

        else tex<= 0;
            % We're done, break out of loop:
        %tBeforeVideo = GetSecs()-startSecs
        Screen('DrawTexture', win, tex);
        Screen('Flip', win);
        Screen('Close', tex);
    Screen('PlayMovie', STDmovie, 0);
    Screen('CloseMovie', STDmovie);  

We noticed this info multiple times in the command window:
“PTB-INFO: Movie playback had to drop 3 (or 5 or 9 or 2… in other commands) frames of movie 0 to keep playback in sync.”

Could our distorted sounds/click have anything to so with this info? And does anyone know how we could avoid this error/bug?

Thank you for your advice and tips,
have a great weekend,

Please post your paid support authentication token for up to 30 minutes of advice. This may or may not be solvable, depending on many factors, but certainly not for free, and possibly also not within 30 minutes of my work time, so followup payments would be required.

Also all information about PTB output during runs is missing, as is info about operating system and version, hardware etc.