Reputation: 39
I have a code to extract frames from a video.The code is given below
addpath('E:\project\coding\wrk_ongoing\Images');
obj = mmreader('ace.mp4');
vid = read(obj);
frames = obj.NumberOfFrames; %Read the Total number of frames and displyed in command window
ST='.jpg';
cd frames
for x = 1:5 % extracting the 5 frames from video
Sx=num2str(x);
Strc=strcat(Sx,ST);
Vid=vid(:,:,:,x);
imwrite(Vid,Strc);
end
cd ..
This code works only for some videos.I tested for different videos with .mp4 extension.Some of them works well. But input videos shows error as
??? Error using ==> vid2frame at 6 Initialization failed. (No combination of intermediate filters could be found to make the connection.)
how can I solve this ?
Upvotes: 0
Views: 314
Reputation: 104464
That error is due to your video file itself. From the looks of it, MATLAB has a problem reading that file probably because the file is badly encoded or the video was encoded with a codec that is not supported by MATLAB or does not exist on your computer.. See this question for a similar problem: no combination of intermediate filters could be found
This has nothing to do with MATLAB, but the error was what you encountered and the answer was to essentially re-encode the video file in a format that is compatible with your operating system and MATLAB.
Good luck!
Upvotes: 2