Parameters ---------- fps : int, default: 5 Movie frame rate (per second). codec : str or None, default: :rc:`animation.codec` The codec to use. bitrate : int, default: :rc:`animation.bitrate` The bitrate of the movie, in k
(self, fps=5, codec=None, bitrate=None, extra_args=None,
metadata=None)
| 256 | supported_formats = ["rgba"] |
| 257 | |
| 258 | def __init__(self, fps=5, codec=None, bitrate=None, extra_args=None, |
| 259 | metadata=None): |
| 260 | """ |
| 261 | Parameters |
| 262 | ---------- |
| 263 | fps : int, default: 5 |
| 264 | Movie frame rate (per second). |
| 265 | codec : str or None, default: :rc:`animation.codec` |
| 266 | The codec to use. |
| 267 | bitrate : int, default: :rc:`animation.bitrate` |
| 268 | The bitrate of the movie, in kilobits per second. Higher values |
| 269 | means higher quality movies, but increase the file size. A value |
| 270 | of -1 lets the underlying movie encoder select the bitrate. |
| 271 | extra_args : list of str or None, optional |
| 272 | Extra command-line arguments passed to the underlying movie encoder. These |
| 273 | arguments are passed last to the encoder, just before the filename. The |
| 274 | default, None, means to use :rc:`animation.[name-of-encoder]_args` for the |
| 275 | builtin writers. |
| 276 | metadata : dict[str, str], default: {} |
| 277 | A dictionary of keys and values for metadata to include in the |
| 278 | output file. Some keys that may be of use include: |
| 279 | title, artist, genre, subject, copyright, srcform, comment. |
| 280 | """ |
| 281 | if type(self) is MovieWriter: |
| 282 | # TODO MovieWriter is still an abstract class and needs to be |
| 283 | # extended with a mixin. This should be clearer in naming |
| 284 | # and description. For now, just give a reasonable error |
| 285 | # message to users. |
| 286 | raise TypeError( |
| 287 | 'MovieWriter cannot be instantiated directly. Please use one ' |
| 288 | 'of its subclasses.') |
| 289 | |
| 290 | super().__init__(fps=fps, metadata=metadata, codec=codec, |
| 291 | bitrate=bitrate) |
| 292 | self.frame_format = self.supported_formats[0] |
| 293 | self.extra_args = extra_args |
| 294 | |
| 295 | def _adjust_frame_size(self): |
| 296 | if self.codec == 'h264': |