我一直在学习matplotlib的动画包,而且所有的例子似乎都将文件保存为.mp4
。 documentation没有提及任何其他特定格式。 matplotlib 是否可以使用其他文件格式来保存动画?如果有,它们是什么?
最佳答案
这取决于 .save()
method 的 writer
参数:
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 使用外部进程(您需要安装)来连接框架。例如,如果您使用的是 'ffmpeg'
,您可以找到支持的格式/编解码器:
ffmpeg -formats
ffmpeg -codecs
在 list 中,您会看到一些编解码器标有 E,表示此格式支持编码。
关于python - matplotlib动画可以保存成什么格式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22571044/