Matlab users and working for the Video Processing toolbox you have great trick for read any format video using in Matlab. Now you can experiment and video for your results using this trick which I have given over here. As you are facing this problem that when you try to read video using this AVIREAD command for read video you will get error that use decompress video, now you not have to use other software for decompress and also not have to use Avi format of video. Because by this trick you can read some format of video on you Matlab such are .MPG, .AVI and so on.How To Use Aviread in Matlab & Problem Using Aviread
As user of Matlab and using video precessing toolbox of Matlab you can read video using Matlab by Matlab command Aviread. Below you can see how to use Aviread in Matlab.I=aviread('Yourvideo Name (Without Format) ');
Suppose you having video stored in your Matlab Work folder named as "video.avi" and you want to read this video then you write Matlab code like
I=aviread('video'); where I is the name of variable in which video get stored.
But this command having some problem in short while you run this code then you will getting error as shown below ::::
??? Error using ==> readavi
Unable to locate decompressor to decompress video stream
Error in ==> aviread at 64
X = readavi(info.Filename,-1);
It mean that your video is not decompress one so you have to decompress that video by using any software then after you can run you code and it will give you answer. And it only supports .Avi formats only.
Now I would like to give the full solution for read this video using Matlab. And it's really one of the best approach for read and process video in Matlab.
Requirement For read Video In Matlab
For read video in Matlab some requirement which are as follow :1). You have to use Matlab 7.4 or higher version of it.
2). Your video be stored on Matlab Work folder with proper name and format .avi or .mpg.
If you not having this format video then download total video converter and convert video in this format and save this video in Matlab Work folder in you C:/ drive.
How To Read Any Video using Matlab
After completing this now paste below code to your matlab screen.obj=mmreader('Video File Name With format');
a=read(obj);
frames=get(obj,'numberOfFrames');
for k = 1 : frames-1
I(k).cdata = a(:,:,:,k);
I(k).colormap = [];
end
At red line you have to provide your video which stored in work folder of Matlab with Video File Name With format. So now your video get stored in I variable now you can use it and use for further processing steps. Here you can see one demo for the same so watch and enjoy your study !!!






20 comments: