Creating movies from IDL

For presentations or web-pages I often need to create movies from IDL showing, e.g., the evolution of a solar feature with time. This page explains how I do this.

You can make movies directly from IDL using the IDLffvideowrite object, and I give more information and an example on a separate webpage. The alternative is to write out individual frames, and then use a separate software package to put the frames together to a movie. I discuss Quicktime and iMovie for the Mac below.

Choosing a movie format (mp4 and webm)

The most common format is mp4 and this is generally recommended when you are making movies for presentations (Powerpoint, Keynote), but you have to be careful with the codec used. The best codec is "h.264" but IDL can not create a movie with it due to license restrictions. The default IDL codec is fine for presentations, but not if you want to embed your movie in a web browser.

The webm format is promoted by Google and it has the advantage of being royalty-free, thus movies can be created from IDL directly without any problem. The main disadvantage is that Apple's Safari browser does not support the format, so your webm movies embedded in a web page will not work.

I've created a webpage with the same movie created in webm and mp4 formats. You can use this to compare how embedded movies work with different browsers.

QuickTime and iMovie (Mac)

Modern Macs come with QuickTime X pre-installed, but it doesn't allow images to be combined into a movie. QuickTime Player 7 is an older version of QuickTime that Apple still distributes and is compatible with old movie formats. It also does not allow images to be combined into a movie. However, it can be upgraded to QuickTime 7 Pro and this does allow you to make movies. Unfortunately it seems it's no longer possible to buy the Pro registration keys (they're not listed on the Apple site). You could check with your IT department or colleagues if they have an old registration key that you could use (note the keys don't expire).

UPDATE (2018): it seems Apple doesn't allow you to upgrade to Pro even if you have a registration key. I think the only way to get Pro working is to install Quicktime 7 by using the Time Machine backup from a machine that does have Pro (not confirmed yet).

Another option is to try using the iMovie software that comes with modern Macs, but I haven't had any success in getting this to work.

My Quicktime method (for a Mac)

My method for creating a good movie is to write out individual image frames from IDL using plot objects. In particular note that any plot object, p, can be written to a png using:


The resolution=96 ensures the output image has the same size as the image displayed on your screen.

After I've created a set of images (I usually call them image0000.png, image0001.png, etc.), I then use QuickTime Pro (Mac) to read the images into a movie. I do the following steps:

  • Click on File -> Export...
  • Select 'Movie to MPEG-4' option, and click on the 'Options...' button.
  • Select File Format 'MP4', and Video Format 'H.264'.
  • Data Rate should be set around 2000 kbits/sec.
  • For 'Image Size' use 'Current'.

Embedding the movie in html

To embed the movie in a webpage, you need to use the html5 video container. I suggest going to one of my webpages and viewing the page source for the video on this page to see how it works.

The option "controls" will display play and stop buttons when the movie is played, while "loop" makes the movie automatically loop.

Page maintained by Dr Peter R Young.