Why can I read a video file in MATLAB R2015b (32 bit), but not in R2017b?
3 views (last 30 days)
Show older comments
MathWorks Support Team
on 22 Nov 2017
Commented: Walter Roberson
on 22 Mar 2018
I have an AVI file that I can successfully read in 32 bit releases of MATLAB, such as R2015b.
However, when I try to read the file in R2017b, I get the error message shown below:
>> v = VideoReader('myfile.avi')
Error using VideoReader/init (line 619)
The file requires the following codec(s) to be installed on your system:
cvid
Error in VideoReader (line 172)
obj.init(fileName);
How can I read this video into MATLAB R2017b?
Accepted Answer
MathWorks Support Team
on 22 Nov 2017
As the error message notes, this is due to the fact that MATLAB is unable to access the 'cvid' codec, also known as Cinepak.
This codec is a 32 bit codec, and is thus only accessible to 32 bit applications.
As a troubleshooting step, it is helpful to verify that it is reproduced by Windows Media Player. Typically, 64 bit Windows installations will have both versions of Windows Media Player. If the 32 bit version can read this file, but the 64 bit version cannot, it is likely related to this particular codec.
Note that the 32 bit version of Windows Media Player can be found in 'C:\Program Files (x86)', while the 64 bit version is in 'C:\Program Files'.
As a workaround, the user can convert the video to a format that is readable from both 32 bit and 64 bit MATLAB. The code snippet below shows one way to do this:
v = VideoReader(source);
v2 = VideoWriter(dest);
open(v2)
while v.hasFrame
currFrame = readFrame(v);
writeVideo(v2,currFrame);
end
close(v2);
1 Comment
Walter Roberson
on 22 Mar 2018
The script given would have to be executed on a 32 bit version of MATLAB, which implies R2015b or earlier. You will not be able to do the conversion inside MATLAB R2016a or later (other than by telling it to run an external program to do the conversion.)
More Answers (0)
See Also
Categories
Find more on Audio and Video Data 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!