%% Read Video Frames Using Frame Index
% Create a video reader object and read one or more video frames using the frame indices.
% Create a VideoReader object for the example movie file xylophone.mp4.

v = VideoReader('xylophone.mp4');

%
% Read only the first video frame.

frame = read(v,1);

%
% Read only the last video frame.

frame = read(v,Inf);

%
% Read frames 5 through 10.

frames = read(v,[5 10]);

%
% Read from the 50th frame to the end of the video file.

frames = read(v,[50 Inf]);

% Copyright 2015 The MathWorks, Inc.