animation.Animation.save
matplotlib.animation.Animation.save
-
Animation.save(filename, writer=None, fps=None, dpi=None, codec=None, bitrate=None, extra_args=None, metadata=None, extra_anim=None, savefig_kwargs=None)
-
Saves a movie file by drawing every frame.
Parameters: filename : str
The output filename, e.g.,
mymovie.mp4
writer :
MovieWriter
or str, optionalA
MovieWriter
instance to use or a key that identifies a class to use, such as ‘ffmpeg’ or ‘mencoder’. IfNone
, defaults torcParams['animation.writer']
fps : number, optional
frames per second in the movie. Defaults to None, which will use the animation’s specified interval to set the frames per second.
dpi : number, optional
Controls the dots per inch for the movie frames. This combined with the figure’s size in inches controls the size of the movie. If None, defaults to
rcparam['savefig.dpi']
codec : str, optional
The video codec to be used. Not all codecs are supported by a given
MovieWriter
. IfNone
, default torcParams['animation.codec']
bitrate : number, optional
Specifies the number of bits used per second in the compressed movie, in kilobits per second. A higher number means a higher quality movie, but at the cost of increased file size. If
None
, defaults torcParam['animation.bitrate']
extra_args : list, optional
List of extra string arguments to be passed to the underlying movie utility. If
None
, defaults torcParams['animation.extra_args']
metadata : dict, optional
Dictionary of keys and values for metadata to include in the output file. Some keys that may be of use include: title, artist, genre, subject, copyright, srcform, comment.
extra_anim : list, optional
Additional
Animation
objects that should be included in the saved movie file. These need to be from the samematplotlib.Figure
instance. Also, animation frames will just be simply combined, so there should be a 1:1 correspondence between the frames from the different animations.savefig_kwargs : dict, optional
Is a dictionary containing keyword arguments to be passed on to the ‘savefig’ command which is called repeatedly to save the individual frames.
Notes
fps, codec, bitrate, extra_args, metadata are used to construct a
MovieWriter
instance and can only be passed ifwriter
is a string. If they are passed as non-None
andwriter
is aMovieWriter
, aRuntimeError
will be raised.
© 2012–2017 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
http://matplotlib.org/2.0.2/api/_as_gen/matplotlib.animation.Animation.save.html