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 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?

share|improve this question
    
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 –  lalmei Jun 10 at 13:03

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer
    
Yes this is exactly what I was aiming for. Thank you! –  user3683367 Jun 10 at 13:21
    
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. –  lalmei Jun 11 at 15:20

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.