7
$\begingroup$

I am generating an animation using:

anim = ListPlot[X];
Export["anim.mov", anim, ImageResolution -> 800, Antialiasing -> True];

The anim.mov file obtained this way does not have the same quality as the animation which we can see on Mathematica itself by the ListAnimate[anim] command. Can anyone suggest how to improve the quality of the exported file so that it looks similar to that we get to see on Mathematica window.

$\endgroup$
  • 2
    $\begingroup$ Not the answer you are looking for, but my experience is that Mathematica is horrible at exporting movies. I make animations using it all the time, but my workflow is to export image files for each frame into a folder, then use some other software (I like ffmpeg) to combine them into a movie file. $\endgroup$ – Jason B. Oct 2 '14 at 8:02
  • 5
    $\begingroup$ @JasonB is right - you may want to have a look at this answer where I discuss some other file formats for movie export, and at this answer for how to export image sequences to create the movie externally. However, you can get better result from within Mathematica, too, if you rasterize the image frames at the resolution you like before exporting them. That is discussed here. $\endgroup$ – Jens Oct 5 '14 at 19:16
7
$\begingroup$

I tried this in MMA 10.01 (Mac) with a simple example from the documentation:

anim = Table[Plot[Sin[n x], {x, 0, 10}], {n, 5}]

It doesn't look terrible but I agree that the anti-aliasing is clearly better in MMA (I had previously modified my anti-aliasing quality settings via Preferences/Appearance/Graphics).

A possible reason for this is that MMA's default codec for the exported animation (at least on the Mac) is "Cinepak". Cinepak is one of the very earliest QuickTime codecs dating from 1992 and appears to struggle with anti-aliased lines. I got the best results by exporting to QuickTime using the "Apple Intermediate Codec" ("Animation" also works well).

Export["anim.mov", anim, ImageResolution -> 800, 
Antialiasing -> True, "VideoEncoding" -> "Apple Intermediate Codec"]

You can then re-compress and export this to another format, if necessary, using QuickTime itself or ffmpeg (which recognizes both codecs).

$\endgroup$
  • $\begingroup$ Wow, this looks fun! Just curious, this output now seems to play quickly, almost instant. Is there a way to make this movie slowly(by setting time intervals)? $\endgroup$ – Chen Stats Yu Oct 5 '14 at 15:42
  • 1
    $\begingroup$ Yes, take a look at the examples at the bottom of How to Import/Export Animations where it's shown how you can include a Manipulate expression inside the Export expression. You can do the same with ListAnimate. By adding the AnimationRate option you can then specify the duration of the exported animation, for example, AnimationRate -> .5. $\endgroup$ – kintopp Oct 5 '14 at 16:06
  • $\begingroup$ Instead of ffmpeg one might also use Handbrake which has a very intuitive GUI and decent presets. $\endgroup$ – Sascha Jan 19 '16 at 9:12
  • 1
    $\begingroup$ You can also use "FrameRate" with Export to specify number of frames to show per second. $\endgroup$ – Sumit Jan 19 '16 at 9:26
  • $\begingroup$ @Sumit To explort a list of Plots as a video, how can I set 2 seconds for each Frame? Tried to use FrameRate -> 0.5, which is invalid. $\endgroup$ – Chen Stats Yu Aug 31 '18 at 2:34

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.