Read .avi file on Matlab

50 Ansichten (letzte 30 Tage)
Learner
Learner am 11 Sep. 2019
Bearbeitet: Walter Roberson am 12 Sep. 2019
Dear community,
I am running Matlab R2019a and I have tried the following commands to read .avi files but neither work. Specifically:
1) Command: vision.VideoFileReader
workspace;
matlab.video.read.UseHardwareAcceleration('on');
filename='Droplet1_Route1_6.0V_16.12.avi';
videoFReader = vision.VideoFileReader(filename);
videoPlayer = vision.VideoPlayer;
while ~isDone(videoFReader)
videoFrame = videoFReader();
videoPlayer(videoFrame);
pause(0.1)
end
release(videoofReader);
release(videoPlayer);
Error:
>> trial_video_read
Error using vision.VideoFileReader
Invalid input file.
2) Command: videoReader
fontSize = 22;
video_input= VideoReader('Droplet1_Route1_6.0V_16.12.avi');
Error:
Error using VideoReader/initReader (line 729)
The file requires the following codec(s) to be installed on your system:
cvid
Error in audiovideo.internal.IVideoReader (line 148)
initReader(obj, fileName, currentTime);
Error in VideoReader (line 98)
obj@audiovideo.internal.IVideoReader(varargin{:});
Error in video_frames (line 2)
video_input= VideoReader('Droplet1_Route1_6.0V_16.12.avi');
VideoReader works with .mp4 files but why doesn't it work with .avi?
I would appreciate any help.
Thank you in advance for your time,
Best regards

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 11 Sep. 2019
Bearbeitet: Walter Roberson am 12 Sep. 2019
  2 Kommentare
Learner
Learner am 12 Sep. 2019
Bearbeitet: Learner am 12 Sep. 2019
So it is essentially not possible to read .avi video files with matlab x64?
Walter Roberson
Walter Roberson am 12 Sep. 2019
Bearbeitet: Walter Roberson am 12 Sep. 2019
.avi is a container format, not a particular video compression method. A number of companies designed video compression / decompression methods ("codec"), and several hundred of them even bothered to register with a central clearing house. You can find one list of publicly known codecs at https://www.fourcc.org/codecs.php
In order to use any particular .avi file, you have to have installed a driver for that particular codec on your system. This is not a matter of MATLAB, this is at the operating system level.
There were a lot of companies struggling for market share of AVI codecs in the early 201x's . Most of them got outcompeted by better or faster or cheaper codecs. A lot of the companies never got around to making 64 bit versions. A fair number of the companies no longer survive.
In a few cases, such as the Indeo3 and Indeo5 codecs, the company still survives but has decided that their older codecs were substantially worse than current codecs, and so have decided to deliberately not make 64 bit versions, hoping that their old codecs will eventually die off (because supporting an old bad codec takes a lot of resources and is frustrating all around.) The Indeo3 and Indeo5 codecs, for example, were designed in such a way that they can never support more than 2 gigabytes (because it uses 32 bit counters), and the company recognizes that they are a technical dead-end and refuses to make a 64 bit version.
I see some hints that the CInepak codec was only ever made in a 32 bit version, and so cannot be used by (any) 64 bit program (not a MATLAB specific issue.) I do see that https://www.fourcc.org/downloads/cinepak-codec-for-wi-24/ offers a download for 64 bit Windows Vista, so you could try, but I would not at all be surprised if it turned out that the installer was 64 bit but the codec itself is restricted to 32 bit.
The problem is not MATLAB; the technical issues involved are outside the scope of any 64 bit Windows program.
The recommendation in these kinds of cases is to use a 32 bit program to read the .avi and write it out again using a codec that is supported in 64 bit systems. It could still be a .avi file, just a different encoder / decoder within the AVI container format.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by