Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Make a movie from images saved in a folder (to avoid getframe)?

Subject: Make a movie from images saved in a folder (to avoid getframe)?

From: Camille Couzi

Date: 30 Nov, 2011 08:29:09

Message: 1 of 2

Hello,
I am currently dealing with a little problem that seems recurrent (I have read many messages about that, but no apparent solution...):
I am trying to make a movie from images. currently I am plotting them and then using aviobj and getframe.
 It works well and produces the movie, but as I am doing that over a loop of hundred of images I don't want to see those images on my screen, only the final product (the movie).

I have a though of a possible workarround: would it be possible to produce my images, save them in a temporary folder (in .jpg, or png, or even .fig extension), then call some function X to produce the movie from those images, and then delete the temporary folder?
What could be this function X?
And most importantly: would it allow to avoid the display of the images?

Thanks in advance for your help...
Camille.

Subject: Make a movie from images saved in a folder (to avoid getframe)?

From: Oliver Woodford

Date: 30 Nov, 2011 09:40:09

Message: 2 of 2

"Camille Couzi" wrote:
> Hello,
> I am currently dealing with a little problem that seems recurrent (I have read many messages about that, but no apparent solution...):
> I am trying to make a movie from images. currently I am plotting them and then using aviobj and getframe.
> It works well and produces the movie, but as I am doing that over a loop of hundred of images I don't want to see those images on my screen, only the final product (the movie).
>
> I have a though of a possible workarround: would it be possible to produce my images, save them in a temporary folder (in .jpg, or png, or even .fig extension), then call some function X to produce the movie from those images, and then delete the temporary folder?
> What could be this function X?
> And most importantly: would it allow to avoid the display of the images?
>
> Thanks in advance for your help...
> Camille.

Camille,

This MATLAB Answer may be of interest:
http://www.mathworks.com/matlabcentral/answers/5781-how-can-i-render-and-export-many-figures-without-the-figures-grabbing-the-window-focus-all-the-time
You can also set the figure's visible property to off.

I think it is a good approach to save your figures as png images first (lossless compression), then create a video out of them afterwards. It is much more flexible: if you want to change the video compression rate, or crop the images, or select a subset of frames it's very easy to do.

You could write a function to do the images to video conversion in MATLAB, but currently MATLAB's support for codecs when writing video files is very poor, so I would recommend using an external application to do this instead. With an external application you can use a more advanced codec, e.g. H.264, and get a higher quality video or smaller file size. On Windows you can get "Windows Live Movie Maker" for free. There are bound to be other free packages available too.

Oliver

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us