Hi everyone!
I am very new to coding and have not done it in a while so I am struggling with the code to upload and play an avi movie. So far I have tried these two codes but I don't even know if I'm on the right track. Any help would be greatly appreciated!
Code 1:
readerobj=mmreader('video.avi')
vidFrames=read(readerobj);
numFrames=get(readerobj,'numberOfFrames');
for k=1:numFrames
mov(k).cdata=vidFrames(:,:,:,k);
mov(k).colormap=[];
end
hf=figure
set(hf,'position', [150 150 readerobj.Width readerobj.Height])
movie(hf, mov, 1, readerobj.FrameRate)
Code 2:
[movie movieduration fps] = Screen('OpenMovie', win,'C:/Documents and Settings/Student/My Documents/MATLAB/Claire code/video.avi' );
framecount = movieduration * fps;
Screen('PlayMovie', movie, 1, 0 , 1.0);
[movietexture pts] = Screen('GetMovieImage', win, movie, 1);
tsize=40;
Screen('TextSize', win, tsize);
Thanks for your help in advance!
Claire
I am very new to coding and have not done it in a while so I am struggling with the code to upload and play an avi movie. So far I have tried these two codes but I don't even know if I'm on the right track. Any help would be greatly appreciated!
Code 1:
readerobj=mmreader('video.avi')
vidFrames=read(readerobj);
numFrames=get(readerobj,'numberOfFrames');
for k=1:numFrames
mov(k).cdata=vidFrames(:,:,:,k);
mov(k).colormap=[];
end
hf=figure
set(hf,'position', [150 150 readerobj.Width readerobj.Height])
movie(hf, mov, 1, readerobj.FrameRate)
Code 2:
[movie movieduration fps] = Screen('OpenMovie', win,'C:/Documents and Settings/Student/My Documents/MATLAB/Claire code/video.avi' );
framecount = movieduration * fps;
Screen('PlayMovie', movie, 1, 0 , 1.0);
[movietexture pts] = Screen('GetMovieImage', win, movie, 1);
tsize=40;
Screen('TextSize', win, tsize);
Thanks for your help in advance!
Claire