Multiple movies

Dear all,

I would like to display multiple different movies (but same length) concurrently. I simply extended the SimpleMovieDemo.m by repeating the critical sentences like below and it worked. Is this the best way? (I don’t think so.) Is there any way to increase processing speed? I wonder if there is anything to make the code efficient. I would appreciate any help and comment. Thank you,

moviename1 = [ pwd '/movie/1.mov' ];
moviename2 = [ pwd '/movie/2.mov' ];
...

% Open movie file: 1350 x 1080
movie1 = Screen('OpenMovie', win, moviename1);
movie2 = Screen('OpenMovie', win, moviename2);
....

% Start playback engine:
Screen('PlayMovie', movie1, 1);
Screen('PlayMovie', movie2, 1);
...

% Playback loop: Runs until end of movie or keypress:
while ~KbCheck
    % Wait for next movie frame, retrieve texture handle to it
    tex1 = Screen('GetMovieImage', win, movie1);
    tex2 = Screen('GetMovieImage', win, movie2);
    ...
    % Draw the new texture immediately to screen:
    Screen('DrawTexture', win, tex1,[],[0,0,1350/2,1080/2]);
    Screen('DrawTexture', win, tex2,[],[0+1350/2,0,1350/2+1350/2,1080/2]);
    ...
 end
 % and then release texture, stop, and close the movie.

Your solution is close. A more efficient version is demonstrated in PlayDualMoviesDemo.m. It avoids blocking waits in Screen(‘GetMovieImage’), but uses polling, so you don’t get into a situation where, e.g., movie1 has a new image ready, but movie2 doesn’t yet and then display of the new image from movie1 is blocked on waiting for a new image from movie2 - which might cause stutter, depending on the specific timing of the movies.

Thank you! I didn’t notice PlayDualMoviesDemo.m.
:heart: