close all
clear
clc

%% --- Cargo video --------------------------------------------------------
file_name = 'Man with glasses walking green screen royalty free in Full Hd.mp4';
v = VideoReader(file_name);

nFrames = v.NumberOfFrames;
vidHeight = v.Height;
vidWidth = v.Width;

%% -- Visualizo un frame --------------------------------------------------
frame = read(v,100);
figure; imshow(frame);

%% --- Get all frames -----------------------------------------------------
mov(1:nFrames) = struct('cdata',zeros(vidHeight,vidWidth, 3,'uint8'),'colormap',[]);
for k = 1 : nFrames
    mov(k).cdata = read(v,k);
end
       
%% --- Playback - opción 1 ------------------------------------------------
hf = figure;
set(hf, 'position', [50 50 vidWidth vidHeight])
movie(hf, mov, 1, v.FrameRate);

%% --- Playback - optción 2 ------------------------------------------------
currAxes = axes;
for ii = 1:nFrames
    vidFrame = read(v,ii);
    image(vidFrame, 'Parent', currAxes);
    set(currAxes,'Visible','off');
    pause(1/v.FrameRate);
end
