Wolfram Blog
Andrew Moylan

Mathematica Q&A: Creating Movie Files

July 15, 2011 — Andrew Moylan, Technical Communication & Strategy

Got questions about Mathematica? The Wolfram Blog has answers! We’ll regularly answer selected questions from users around the web. You can submit your question directly to the Q&A Team using this form.

Here is this week’s question:

How can I create and export movies and animations in Mathematica?

This is something we do often—just about every movie or animation on the Wolfram Blog is created in Mathematica.

If you are creating a movie that you want to include in a web page or send to someone as a standalone file, then the easiest and most interactive option is probably to distribute the movie in Computable Document Format (CDF). To do this, create an interactive animation using a function like Animate or ListAnimate:

Creating an interactive animation using a function like Animate or ListAnimate

The resulting animation can be saved as a CDF (File -> Save As -> Computable Document (.cdf)) and embedded live in a web page or distributed like any other file. Anyone with the Wolfram CDF Player can open and interact with the animation. The unique advantage of CDF is that you can very easily include additional interactive elements with your animation, such as controls generated by Manipulate:

Easily include additional interactive elements with your animation, such as controls generated by Manipulate

If you want to create a regular movie in a file format such as QuickTime, then the first step is to prepare each frame of the animation. Here’s a function frame[t] generating one frame of animation at time t:

Generating one frame of animation at time t

Visualizing this count as a function of the complex parameter c

The function bounditerations[c, t] counts the number of times that repeated applications of the complex function zz^t + c (starting from z = 0) stay inside the region |z|<2. The function frame[t] visualizes this count as a function of the complex parameter c: the horizontal axis is Re[c] and the vertical axis is Im[c].

When t = 2, you’ll probably recognize the result as the famous Mandelbrot set:

Creating movie files input 5

Creating movie files output 5

Different values of t give interesting visualizations of other sets:

Creating movie files input 6

Creating movie files output 6

You can animate this visualization by building up a set of frames, say from t = 2 to t = 4:

Animate this visualization by building up a set of frames

(That line takes a few minutes to run on my computer. You could make it faster by taking advantage of new C compilation techniques in Mathematica 8.)

Once you have the list of frames, a simple Export command suffices to create the movie:

Creating movie files input 8

Creating movie files output 8

Here is the resulting movie, uploaded to YouTube:

This movie was created using the QuickTime format, but you can also use others, such as AVI, GIF, or SWF.

Click here to download this post as a CDF.

If you have a question you’d like answered in this blog, you can submit it to the Q&A Team using this form. For daily bite-sized Mathematica tips, follow our @MathematicaTip Twitter feed.

Posted in: Mathematica Q&A
Leave a Comment

6 Comments


Barrett

Is this possible to do with sync sound?

Posted by Barrett    July 16, 2011 at 6:29 am
Ted Ersek

Ok, so how would I make a video like your screen-casts? I mean one the shows the mouse pointer, use of scroll bars and has verbal discussion.

Posted by Ted Ersek    July 16, 2011 at 11:42 am
Samuel Chen

@Ted, if you use a mac, screenflow is the program that I use to make podcasts. Basically, it records what is on your screen – pointer movements, slides, movies that you are showing. It even records or mutes the voice input.

Posted by Samuel Chen    July 19, 2011 at 9:35 am
Stefan

I second Barrett’s comment, can you add a Sound object to go with your video?
Also, can you specify the frame rate?

Posted by Stefan    July 19, 2011 at 2:23 pm
David Reiss

Another tool that can be used to create screencasts is Snapz Pro X. I have used this quite often for Mathematica demos.

Posted by David Reiss    September 5, 2011 at 9:01 pm
Frank Scherbaum

Any new developments regarding the sound issue?

Posted by Frank Scherbaum    January 25, 2014 at 6:08 am


Leave a comment

Loading...

Or continue as a guest (your comment will be held for moderation):