8000 Ensure extra_args are last input to animation encoder · matplotlib/matplotlib@fc5bb10 · GitHub
[go: up one dir, main page]

Skip to content

Commit fc5bb10

Browse files
committed
Ensure extra_args are last input to animation encoder
And document them as such.
1 parent 2b23fee commit fc5bb10

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/matplotlib/animation.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,10 @@ def __init__(self, fps=5, codec=None, bitrate=None, extra_args=None,
276276
means higher quality movies, but increase the file size. A value
277277
of -1 lets the underlying movie encoder select the bitrate.
278278
extra_args : list of str or None, optional
279-
Extra command-line arguments passed to the underlying movie
280-
encoder. The default, None, means to use
281-
:rc:`animation.[name-of-encoder]_args` for the builtin writers.
279+
Extra command-line arguments passed to the underlying movie encoder. These
280+
arguments are passed last to the encoder, just before the filename. The
281+
default, None, means to use :rc:`animation.[name-of-encoder]_args` for the
282+
builtin writers.
282283
metadata : dict[str, str], default: {}
283284
A dictionary of keys and values for metadata to include in the
284285
output file. Some keys that may be of use include:
@@ -538,9 +539,9 @@ def output_args(self):
538539
'split [a][b];[a] palettegen [p];[b][p] paletteuse'])
539540
if self.bitrate > 0:
540541
args.extend(['-b', '%dk' % self.bitrate]) # %dk: bitrate in kbps.
541-
args.extend(extra_args)
542542
for k, v in self.metadata.items():
543543
args.extend(['-metadata', f'{k}={v}'])
544+
args.extend(extra_args)
544545

545546
return args + ['-y', self.outfile]
546547

@@ -937,9 +938,10 @@ class to use, such as 'ffmpeg'.
937938
of -1 lets the underlying movie encoder select the bitrate.
938939
939940
extra_args : list of str or None, optional
940-
Extra command-line arguments passed to the underlying movie
941-
encoder. The default, None, means to use
942-
:rc:`animation.[name-of-encoder]_args` for the builtin writers.
941+
Extra command-line arguments passed to the underlying movie encoder. These
942+
arguments are passed last to the encoder, just before the output filename.
943+
The default, None, means to use :rc:`animation.[name-of-encoder]_args` for
944+
the builtin writers.
943945
944946
metadata : dict[str, str], default: {}
945947
Dictionary of keys and values for metadata to include in

0 commit comments

Comments
 (0)
0