Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What formats can matplotlib animations be saved as?

I've been learning matplotlib's animation package, and all of the examples seem to save the file as .mp4. The documentation doesn't mention any other specific formats. Are there other file formats that matplotlib can use to save the animation? If so, what are they?

like image 275
Dan Avatar asked Mar 21 '14 23:03

Dan


1 Answers

That depends on the writer argument of the .save() method:

writer is either an instance of MovieWriter or a string key that identifies a class to use, such as ‘ffmpeg’ or ‘mencoder’. If nothing is passed, the value of the rcparam animation.writer is used.

Matplotlib uses an external process(that you need to have installed) to join the frames. If you are using for example 'ffmpeg' you can find the supported format/codecs with:

ffmpeg -formats
ffmpeg -codecs

In the listing you will see that some codecs are marked with an E meaning encoding is supported in this format.

like image 53
elyase Avatar answered Sep 27 '22 22:09

elyase