title: Convert Video to Image Sequence MATLAB
body: <p>i am trying to convert a video to image sequences, and at mathworks i saw the code like this</p>
  
  <p>Read and play back the movie file xylophone.mp4.</p>
  
  <pre><code>xyloObj = VideoReader('xylophone.mp4');
  
  nFrames = xyloObj.NumberOfFrames;
  vidHeight = xyloObj.Height;
  vidWidth = xyloObj.Width;
  </code></pre>
  
  <p>Preallocate the movie structure.</p>
  
  <pre><code>mov(1:nFrames) = ...
      struct('cdata',zeros(vidHeight,vidWidth, 3,'uint8'),...
             'colormap',[]);
  </code></pre>
  
  <p>Read one frame at a time.</p>
  
  <pre><code>for k = 1 : nFrames
      mov(k).cdata = read(xyloObj,k);
  end
  </code></pre>
  
  <p>while i am trying this code, it requires a very long time to compile it. Is there any way to read all frame without looping so i can make it faster?</p>