The good old GIF
animation format allows us to set the duration of each individual frame in the animation separately. This is especially useful if some frames in the animation sequence are to remain static for an extended period of time, because such delays don't increase the file size of the GIF
. Here is an example:
frames = Table[
Graphics[
Text[Style["Slow Down", FontFamily -> "Futura", FontColor -> Blue,
FontSize -> 48], {0, y}], Background -> Cyan,
PlotRange -> {{-1, 1}, {.1, 1.5}}], {y, 1.2, .2, -.1}];
Export["slowDownMovie.gif", frames,
"DisplayDurations" -> Append[Range[Length[frames] - 1]/20, 2],
"AnimationRepetitions" -> Infinity]
Even though the last frames are very long in duration, that has no effect on the file size.
Of course one thing GIF
doesn't have is a playback control, which allows you to pause and rewind a movie. To combine these two features, it would be nice if there were a movie export format in which one can set individual frame delays (variable frame rate), instead of a global frame rate. The problem with a global frame rate is that you have to duplicate frames if you want them to stay on the screen longer.
I know that the QuickTime
movie format officially supports embedding image sequences and giving each image a separate display duration. This is an old feature of the QuickTime
container structure that doesn't appear to be used much. Many other formats seem to support it too.
Another motivation: Many people nowadays make movies of slide presentations, which is often quite nice. But sometimes it's also wasteful, if you don't need audio and have just a sequence of stills. The above image-sequence approach (with playhead and rewind) would be a more efficient way of running such presentations with pre-set timing.
So my question is: are any of the available movie export formats in Mathematica able to accept an option analogous to the "DisplayDurations" option that GIF
has?
I know how to make such image sequences for QuickTime
on the Mac, but only with the help of external function calls using the QTKit
(built-in) library. I couldn't find any documented options for this in the export help. If it turns out that there is no platform-independent way of doing this from Mathematica, I'd also be interested in OS-dependent solutions, and I'll post my own approach later.
ListAnimate
controling the display rate does not have to be a scalar. For example,ListAnimate[Table[Graphics[{Hue[RandomReal[]], Disk[{0, 0}, n]}, PlotRange -> 15], {n, 10}],{1, 5, 1, 10, 1, 1, 1, 10, 1, 1}]
works. Similarly, the optionAnimationRate
can be set as a list (although this throws a an error message that needs to suppressed withQuiet
) as inListAnimate[Range[10], AnimationRate -> {.1, .5, .1, .5}]
. $\endgroup$ListAnimate
output to.mov
format, it's blank. Export works if I delete the list offps
. $\endgroup$Export
either. $\endgroup$