Re: MATLAB avi file compressions



Matt wrote:


bump

Matt wrote:


I can play the movie in Windows Media Player. However, if I
email
the movie to myself and try to play it in Windows Media Player,
it
does not work. I can play any movie in Powerpoint except for
those
that I generate in MATLAB. I've tried using all of the codecs
specified by MATLAB help but the movie still will not play in
powerpoint. I will try turning off the hardware acceleration
on
my
graphics card. Thanks for your input.

Matt



Screwdriver223 wrote:


SNIP> Can't play movies in Powerpoint.

Can you play the movie outside Powerpoint (say, in Windows
Media
Player)? If not, try using a different codec (help
movie2avi).
If
you can play it outside Powerpoint, but only see a black
rectangle
when you try to play it in the presentation, turn off the
hardware
acceleration on your graphics card. This is a Powerpoint
bug.



The avi codecs don't seem to be present in the base Windows install
anymore.

Recommend you try mpeg.

Consider the following demo code:

% Movie Demonstration

% create some image data
[X Y Z] = sphere(25);
sz = size(Z);
C = rand(sz(1),sz(2),3);

% stitch data to wrap color around sphere
C(:,end,:) = C(:,1,:);

% render an image
figure('color',[0 0 0]);
sp = surf(X,Y,Z,C,'FaceColor','interp',...
'FaceLighting','phong');
material shiny
axis off vis3d
cl = camlight('right');
camzoom(1.5)
set(sp,'edgecolor','none');
drawnow

% setup the rotation vector for the movie
view_vect_yaw = [-180:3:180];
sz_vect = size(view_vect_yaw);

% "lights, camera, action!"
for f = 1:sz_vect(2)
% set the view, reset light position and render
view([view_vect_yaw(f) 15]);
camlight(cl,'right')
drawnow
% grab a frame
m(f) = getframe(gcf);
end
% % format frames as mpeg and write to file
mpgwrite(m,C,'my_movie.mpg',...
[1, 0, 1, 0, 10, 1, 1, 1]);

% ..or write to an avi file
% movie2avi(m,'my_movie.avi','compression','none','fps',5)

% end of code

This codes utilizes mpgwrite.dll which is available in the File
Exchange. You might find that these files are vastly more compact
than .avi and mpeg is an ISO format so most machines will be able to
view your movies without having to root around for the correct avi
codec.

You just download the .dll and drop it into your working directory.

hth,
Scott
.



Relevant Pages