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
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
webpage. The movie will generally not work
through a web browser but it should be fine for a
Powerpoint or Keynote presentation,
The alternative is to write out individual frames, and then use a
separate software package to put the frames together to a
movie. You used to be able to do this with QuickTime on the Mac,
but not any more. My recommendation is to use ffmpeg.
Choosing a movie format (mp4 and webm)
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
Using ffmpeg (Mac)
The ffmpeg package is not installed on Macs by default, and
so you'll need to install it separately. I used Homebrew for
After you've written your image frames from IDL into files
image0000.png, image0001.png, etc., then you can create an mp4
> ffmpeg -r 15 -i image%04d.png -vcodec libx264 -pix_fmt
yuv420p -crf 20 movie.mp4
Using "image*.png" seems to fail, so use %04d instead (%03d
if you're using image000.png).
The option "-r 15" sets the frame rate to 15.
"-vcodec libx264" will give you a movie in the standard h.264
mp4 format, which means the movie should play on any web
The option "-pix_fmt yuv420p" sets the pixel format to
3 colors and 12 bits per pixel (no need to change this!).
option "-crf" controls the "lossiness" of the movie: 0 is
lossless, 17 is "visually lossless", 23 is default, and 51 is
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
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.