Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'd like to make a exportable film (in some format like .avi or .mp4, something playable on most computers) where each frame is a Graphics3D output. For example, we might generate frames in the following way:

polytopeSize = 3;

numFrames = 10;  
frameSet = Table[Graphics3D[Table[Translate[Scale[PolyhedronData["Dodecahedron", "Faces"], polytopeSize], RandomReal[{0, 5}, 3]], {i, 1, 5}]], {k, 1, numFrames}];

I'd like to be able to set a time delay individually for each frame:

frameSetTimeDelaysInSeconds = RandomReal[{0,1}, numFrames];

Is this possible?

share|improve this question
1  
See this question for a solution for non-GIF files. –  cormullion Nov 11 '13 at 11:24

2 Answers 2

Here's an idea that could be worth exploring:

table = Flatten[
  MapThread[
    Table[#1, {Round@#2}] &, {frameSet, 30 * frameSetTimeDelaysInSeconds}]];

Export["frameset.mov", table]

This just duplicates frames for as many times as necessary - inelegant, I suppose, but it might do.

share|improve this answer

The hyperlink from cormullion is cormullion is ideal.

A table of "DisplayDurations" can be used for animated gifs.

AVI's tend to be very large and you can use other software to compress. MOV/QT files are reasonable.

Here is away to have variable frame durations by padding frames:

framerate = 15;
framnum = Round[framerate frameSetTimeDelaysInSeconds]
film = Join @@ MapThread[Table[#1, {#2}] &, {frameSet, framnum}];

You can then export:

Export["yourfilename.avi", film,"FrameRate" -> framerate]

This will be a large file.

For quicktime:

Export["yourfilename.mov", film,  "FrameRate" -> framerate]

I note the default frame rate for quicktime is 15fps...I just illustrate potential to change (play with).

An example is here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.