Unable to determine the codec required.
86 views (last 30 days)
I am using 2013a version of matlab and windows xp.When i run the code of videoreader i get this error.So what type of codec needs to be installed.
obj.reader = vision.VideoFileReader('atrium.avi');
obj.videoPlayer = vision.VideoPlayer();
obj.maskPlayer = vision.VideoPlayer();
obj.detector = vision.ForegroundDetector('NumGaussians', 3, 'NumTrainingFrames', 40, 'MinimumBackgroundRatio', 0.7);
obj.blobAnalyser = vision.BlobAnalysis('BoundingBoxOutputPort', true,'AreaOutputPort', true, 'CentroidOutputPort', true,'MinimumBlobArea', 400);
Walter Roberson on 23 May 2015
Edited: Walter Roberson on 23 May 2015
info = mmfileinfo('atrium.avi');
and if the command is found in your version of MATLAB (it was scheduled to be removed) then look at the VideoCompression field of the output of it.
Let us know what the results are.
See also https://www.raymond.cc/blog/determine-audio-video-codec-required-to-play-downloaded-movies/ and find a tool for your computer that will tell you which codec was used.
Note: if the codec shows up as Indeo5 then it is not readable with any 64 bit version of MATLAB (which is due to decisions made by the manufacturers of the Indeo5 codec)
Mrutyunjaya Hiremath on 23 Apr 2020
Edited: Mrutyunjaya Hiremath on 24 Apr 2020
To solve the problem, I installed 'Media Player Codec Pack' and use the following code.
vidObj = VideoReader('VideoFile.mp4');
currFrame = read(vidObj, 10);
vidFrames = read(vidObj,[100 Inf]);
vidFrames = read(vidObj,[18 27]);
The above problem solved in 2014b with 'readFrame' and 'hasFrame' functions.
currAxes = axes;
vidFrame = readFrame(vidObj);
image(vidFrame, 'Parent', currAxes);
currAxes.Visible = 'off';