Issues with Movie2Avi - matlab

I'm trying to make a movie in the following way:
x=linspaces(1,10,100);
For i=1:100
plot(x,sin(x))
M(i)=getframe;
end
movie2avi(M,'MOVIE01');
I get a response:
Warning: Cannot locate Indeo5 compressor, using 'None' as the compression type.
it makes the movie but I cannot open it ( gives an error)
I'm using windows 7 64 bit operation system and matlab 2012b
I've tryed the compression types in the documentation but recieved an error for all of them

From the docs:
On some Windows systems, including all 64-bit systems, the default Indeo® 5 codec is not available. MATLAB issues a warning, and creates an uncompressed file.
It would be better to use VideoWriter, which I believe you should have in 2012b.

Related

Programmatically find COM and LPT address in Matlab

I am using Matlab to program an experiment.
In particular, I am using these lines of code to read and send triggers to an external device:
ioObj = io64;
status = io64(ioObj);
io64(ioObj,portWriteAddress,0);
I have found the value for 'portWriteAddress by navigating to:
Device manager -> Ports -> LPT1 -> Resources. Then, in Resources there is an entry called I/O Range/ Settings with a code like 02S7 - 02SS (something like that).
Then I have converted it from Hex to Dec and put it in the line above.
THE PROBLEM IS: I am running this experiment on several different computers. Is there a way to programmatically find this range (or address) information fromMatlab?
Thank you all for your time.
Gluce
P.S.
The OS that I am using is Windows 7 (it should be soon updated to windows 10).
The computers are running either Matlab 2015b or 2016b.

Extracting audio from video files

I just received a 30 day trial of the Computer Vision System Toolbox, and I just tested it out. I found this code online that separates video from audio:
file='movie.AVI';
file1='targetfile.wav';
hmfr= video.MultimediaFileReader(file,'AudioOutputPort',true,'VideoOutputPort',false);
hmfw = video.MultimediaFileWriter(file1,'AudioInputPort',true,'FileFormat','WAV');
while ~isDone(hmfr)
audioFrame = step(hmfr);
step(hmfw,audioFrame);
end
close(hmfw);
close(hmfr);
but I can't run it, I only get the error:
Undefined variable "video" or class "video.MultimediaFileReader".
I'm not quite sure what this means, does it refer to my code or the computer vision system toolbox? I checked, I have all the requirements and the add-on manager says it's properly installed, so I'm not quite sure why I get this error.
I think your task is quite easier than you think it is. It can be done without any reliance on toolboxes.
That's how:-
1. Read your video file and get its sample rate using audioread.
2. Then use audiowrite to write it as an audio file.
[input_file, Fs] = audioread('movie.AVI');
audiowrite('target_file.WAV', input_file, Fs);
%If your path is set to default then MATLAB may give you 'Permission Denied' Error.
%Change the path or give different full path like: 'D:\target_file.WAV' while audiowriting

Matlab: Error using VideoFileReader/setup

I'm using this code:
h = vision.VideoFileReader('num2.avi')
h =
System: vision.VideoFileReader
Properties:
Filename: '/Users/LoFe/Documents/BME/Work/Work/Work/num2.avi'
PlayCount: Inf
ImageColorSpace: 'RGB'
VideoOutputDataType: 'single'
It is working well, but when I want to call step on it, i get this:
while ~isDone(h)
hFrame = step(h);
end
Error using VideoFileReader/setup
Could not open the specified file.
Error in
/Applications/MATLAB_R2013a.app/toolbox/matlab/system/+matlab/+system/+mixin
/FiniteSource.p>FiniteSource.isDone
(line 39)
I'm using MATLAB 2013a, on OS X (Mavericks), what should I do? It is working fine on Windows 7.
As we discussed in the comments, the codec that was used to encode the video is may not supported on your Mac. For MATLAB, the supported codecs that the CVST video reader can read in are different between Mac and Windows.
As such, try re-encoding your video into a format that is native to the Mac, like a QuickTime movie file, or an MP4 file. HandBrake is a perfect tool to do this for you.
Also, perhaps try using MATLAB's native VideoReader class to see if you can read the file and extract video frames. Take a look at its documentation for more details: http://mathworks.com/help/matlab/ref/videoreader-class.html.
However, it looks like you have resolved the error, as converting it to a QuickTime movie file worked.
Glad I could help!

Truezip returning unsupported compression method error when extracting large files

Truezip 6 and 7 returning error message "compression method 9 is not supported" when extracting any files greater then 2GB that were compressed using windows compressing method.
(This is achieve by highlighting the file that is 2GB or bigger and then right clicking on the mouse -> send to->Compressed (zipped) folder).
using Truezip 7 code below:
TFile srcFile = new TFile(src, incPath);
TFile dstFile = new TFile(dst);
TFile.cp_rp(srcFile, dstFile, TArchiveDetector.NULL);
produces the error "compression method 9 is not supported" when it hits the "..truezip.zip.RawZipFile.getInputStream". Is there a way to fix this? or a method to overcome this issue?
This only happens when using windows zipped method, however when using 7Zip to compress files that is greater then 2GB and then using truezip to extract isn't a problem.
Method 9 is an extended Deflater method with a bigger dictionary. As the exception says, it isn't supported because the JRE doesn't support it. It seems to be new that the Windows Explorer is using this method.

Reading a movie file in Matlab

I am trying to read a movie in avi format. But it's giving me the following error:
xyloObj = mmreader('1.avi',[1 5]);
??? Initialization failed. (No combination of intermediate filters could be found to make the connection.)
Error in ==>
mmreader.mmreader>mmreader.init at 423
obj.MMReaderImpl = audiovideo.mmreader(fullName);
Error in ==>
mmreader.mmreader>mmreader.mmreader at 133
obj.init(fileName);
Kindly help me
The likely source of the error is that you are missing the proper codec required to read the given AVI file. Apparently, this can often happen when using 64-bit versions of MATLAB on 64-bit Windows platforms. There are a number of solutions you can try given in this technical support documentation from the MathWorks.
First, can you play it with another application (such as VLC player, Windows Media Player, QuickTime, etc.) on your computer?
If yes, go to gnovice's link.
If no, go get the GSpot codec information tool which is very useful for determining which codec you need. Download the codec and make it work with a video player, then Matlab.
This pdf explains how to solve your problem. Or just use:
vid = aviread('Vid261.avi');
vi = frame2im(vid(1)) ;