Wednesday, January 22, 2014

Matplotlib animations mac os x (using built in codecs)

Mac OS X (Mavericks) comes with a bunch of built in codecs listed here that people can play with the bundled quicktime application. If you can give people animations in these formats/codecs they don't have to do any work to play them on their mac.

In order to get matplotlib saving animations in these formats you need to do:

  1. Install ffmpeg for mac. I grab Mac binaries from here. You may need 7zX for mac to unzip the file.
  2. Place the binary in a suitable local path and make sure you add the path.
  3. When you call matplotlib.animate pass the arguments extra_args=['-vcodec', 'libxvid']
This should produce a video file that is playable by QT on any standard install of Mac OS X

No comments:

Post a Comment