Video to frames converting problem

3 views (last 30 days)
Manu Gowda
Manu Gowda on 25 Jan 2022
Commented: Manu Gowda on 26 Jan 2022
I was using code to convert video into frames, i was working but now i am using video recorded by go pro hero 10 so the size of video is high , because of that now that code is not working . if i crop and trim video n reduces the size its working.
what should i do to convert high size video into images
% import the video file
video = VideoReader('test.mp4');
% read the total number of frames
n = video.NumberOfFrames
% reading and writing the frames
for i = 1:n
frames=read(video,i);
%save the frames
imwrite(frames,['images' int2str(i), '.jpg']);
im(i)=image(frames);
end
  7 Comments
Walter Roberson
Walter Roberson on 26 Jan 2022
"crop video below certain level" -- if you are referring to number of frames, then that would be consistent with the fact that NumberOfFrames and NumFrames are unreliable on Windows, and that the (now obsolete) NumberOfFrames was never known properly for variable framerate files until you finished reading the video.
Even for fixed framerate files, you need to take NumberOfFrames was an estimation, as recorded framerates are typically estimates. For example "30 frames per second" is typically NTSC, which is talked about as 29.97 frames per second but is really
format long g
30/1.001
ans =
29.97002997003
and due to the way that frame rates are implemented as a ratio of two integers, round off typically occurs in the representation...
Manu Gowda
Manu Gowda on 26 Jan 2022
'crop the video' means, not reducing the no of frames (trimming the video) . It means i am croping the video so that number of frames and length of video is same but i am selecting particular region of intrest by croping.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!