movie2avi by MATLAB R2011a

Hi everybody,
I am using the following sample codes in the Mathworks to generate an avi movie by MATLAB R2011a on MAC OS X 10.6.7. However, there is nothing in the movie but blank when I open it either with QuickTime Player or Divx Player. Would any one please give me some suggestions? Thanks so much.
_|nFrames = 20;
% Preallocate movie structure. mov(1:nFrames) = struct('cdata', [],... 'colormap', []);
% Create movie. Z = peaks; surf(Z); axis tight set(gca,'nextplot','replacechildren'); for k = 1:nFrames surf(sin(2*pi*k/20)*Z,Z) mov(k) = getframe(gcf); end
% Create AVI file. movie2avi(mov, 'myPeaks.avi', 'compression', 'None');|__ITALIC TEXT_
Best, Qian

댓글 수: 1

Xin
Xin 2012년 8월 2일
I have same issue with 2012a version of matlab

댓글을 달려면 로그인하십시오.

답변 (2개)

Qianqian
Qianqian 2011년 9월 19일

0 개 추천

I can generate the movie in mpg formate by mpgwrite now, but still cannot solve the problem with Movie2Avi.
Jorrit M
Jorrit M 2011년 9월 19일

0 개 추천

I generally find it easier to use VideoWriter instead. It also allows you a more detailed control:
%create the object:
writerObj = VideoWriter([PathName FileName]);
%set properties:
writerObj.FrameRate = intFrameRate;
writerObj.Quality = intQuality;
%write movie
open(writerObj);
writeVideo(writerObj,mov);
% close the handle
close(writerObj);

댓글 수: 3

Qianqian
Qianqian 2011년 9월 19일
Hi Jorrit,
Thanks for your attention. I just tried VideoWriter, but it has the same problem with Movie2Avi. The size of the movie is normal, but no images inside. I will use mpgwrite at this time, even though there aren't enough properties needed. Thanks anyway.
Jorrit M
Jorrit M 2011년 9월 20일
Have you tried playing your movie with movie()? If that works, it's a problem with your avi-writer, otherwise there's something wrong with your image-to-frame assignment.
amit pathania
amit pathania 2012년 4월 19일
i tried both methods and I was able to record the video too.But,I was trying to make project on motion detection,in which I wanted to record the video whenever there is any motion.But Whenever I am trying to record the video freezes in GUI axis.Can you help me to increase the speed?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

질문:

2011년 9월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by