How to present movies in PTB3?

Hello,

I am trying to present a 1 second movie-clip (.avi format). I am using a loop to present the movie according to the PTB best practice.
BUT - the movie presentation takes 1.5 seconds (even though the length of the clip is 1 second exactly).
Any ideas why this happens and how can I present the clip for 1 second exactly?

This is the part of my code displaying the movie:


movie = Screen('OpenMovie', window, fileName);
Screen('PlayMovie', movie, 1);
while 1
tex = Screen('GetMovieImage', window, movie);
if tex<=0
break;
end;
Screen('DrawTexture', window, tex);
Screen('Flip', window);
Screen('Close', tex);
end;
Screen('PlayMovie', movie, 0);
Screen('CloseMovie', movie);

Thank you!
Heres a few things which may or may not help.

When you say you are using "best practice" I'm not sure what you mean. You seem to be using a similar strategy to that shown in SimpleMovieDemo. In this demo it it states:

% This bare-bones demo plays a single movie whose name has to be provided -

% including the full filesystem path to the movie - exactly once, then

% exits. This is the most minimalistic way of doing it. For a more complex

% demo see PlayMoviesDemo. The remaining demos show more advanced concepts

% like proper timing etc.


So it sounds like you are using a very basic strategy, which might not have good timing. So, I'm not sure if this is best practice.

You might want to have a look at the other movie demos in PTB. Which show more advanced / different ways to do movie playback. This might help with timing.

One thing I notice is you are not specifying a time at which you want your texture flipped to the screen. This really is not best practice. You really should specify a time you want the flip to occur to get good timing, else you are leaving a lot to chance. Numerous PTB demos show how to do this.

Anyhow, there are a few things you can try. Report back if you are still having issues. I rarely use movie playback. Others might have a better knowledge. 

P