2
$\begingroup$

I have a huge simulation and tried to export it as a video file (or .gif). However regardlessly what I specify under the Framerate option the video its just running for 4 seconds (too fast). When I set the framerate to one the video just consists of one picture and if I set it to 100 the video is fluid but still only 4 seconds long. Do I have to set another flag in the animation? While trying to present you some working example I came up with the following short lines:

data = Import["http://pastebin.com/raw.php?i=4Tuv8UKv", {"Data", All, {2, 3}}];
Animate[Graphics[Circle[data[[t]]],
      ImageSize -> {500, 200}, PlotRange -> {{0, 100}, {-5, 5}}, 
       Axes -> True], {t, Range[1, 1000]}, AnimationRate -> 1, 
       AnimationRunning -> False]

Export["test.mov", %, "FrameRate" -> 25]

So I thought that with setting the animation rate to 1 and the framerate to 25 I would get a 1000/25=40 seconds long video. Why is that not happening? Do I have to specify my frames somehow?

$\endgroup$
  • $\begingroup$ I wouldn't export animate, but just the list of frames. In other words, just replace Animate with Table, and remove the animate options. You can then export the list of frames as you do above $\endgroup$ – lalmei Jun 10 '14 at 13:03
5
$\begingroup$

Might as well write my comment as an answer.

Exporting a list of frames as a movie usually gives you much more control on the smoothness of the animation you are making.
since you have 1000 frames, if we export 1000 frames as a 25 fps, we get a 40 second movie.

   data = Import[
       "http://pastebin.com/raw.php?i=4Tuv8UKv", {"Data", All, {2, 3}}];
   mymov = Table[
        Graphics[Circle[data[[t]]], ImageSize -> {500, 200}, 
        PlotRange -> {{0, 100}, {-5, 5}}, Axes -> True], {t, 
         Range[1, 1000]}];
   Export["test.mov", mymov, "FrameRate" -> 25]

enter image description here

$\endgroup$
  • $\begingroup$ Yes this is exactly what I was aiming for. Thank you! $\endgroup$ – MaxJ Jun 10 '14 at 13:21
  • $\begingroup$ Also I tend to use ListAnimate instead of Animate in the same way, it allows me to render the images first, in cases there is a mistake or error so I don't get stuck in an animate loop. $\endgroup$ – lalmei Jun 11 '14 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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