Setting frames from mid video
Show older comments
I need to take 300 frames from the middle of a huge video (20000 frames) to do further manipulation. I got the following from the xylophone example but it only takes frames from the start of the video; I need to set a smaller video from frames 3701:4000:
Clip1 = VideoReader('C:\Users\(username)\Videos\Day3.4.avi'); %xylophone.mp4');
nFrames = 500; %Clip1.NumberOfFrames;
vidHeight = Clip1.Height;
vidWidth = Clip1.Width;
%%Movie Structure
mov(1:nFrames) = ...
struct('cdata',zeros(vidHeight,vidWidth, 3,'uint8'),...
'colormap',[]);
%%Reading frames
for k = 1 : nFrames
mov(k).cdata = read(Clip1,k);
end
hf = figure;
set(hf, 'position', [150 150 vidWidth vidHeight])
Any help would be greatly appriciated.
Accepted Answer
More Answers (0)
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!