@@ -288,9 +288,10 @@ def __init__(self, fps=5, codec=None, bitrate=None, extra_args=None,
288288 means higher quality movies, but increase the file size. A value
289289 of -1 lets the underlying movie encoder select the bitrate.
290290 extra_args : list of str or None, optional
291- Extra command-line arguments passed to the underlying movie
292- encoder. The default, None, means to use
293- :rc:`animation.[name-of-encoder]_args` for the builtin writers.
291+ Extra command-line arguments passed to the underlying movie encoder. These
292+ arguments are passed last to the encoder, just before the filename. The
293+ default, None, means to use :rc:`animation.[name-of-encoder]_args` for the
294+ builtin writers.
294295 metadata : dict[str, str], default: {}
295296 A dictionary of keys and values for metadata to include in the
296297 output file. Some keys that may be of use include:
@@ -553,9 +554,9 @@ def output_args(self):
553554 'split [a][b];[a] palettegen [p];[b][p] paletteuse' ])
554555 if self .bitrate > 0 :
555556 args .extend (['-b' , '%dk' % self .bitrate ]) # %dk: bitrate in kbps.
556- args .extend (extra_args )
557557 for k , v in self .metadata .items ():
558558 args .extend (['-metadata' , f'{ k } ={ v } ' ])
559+ args .extend (extra_args )
559560
560561 return args + ['-y' , self .outfile ]
561562
@@ -566,15 +567,19 @@ class FFMpegWriter(FFMpegBase, MovieWriter):
566567 """
567568 Pipe-based ffmpeg writer.
568569
569- Frames are streamed directly to ffmpeg via a pipe and written in a single
570- pass.
570+ Frames are streamed directly to ffmpeg via a pipe and written in a single pass.
571+
572+ This effectively works as a slideshow input to ffmpeg with the fps passed as
573+ ``-framerate``, so see also `their notes on frame rates`_ for further details.
574+
575+ .. _their notes on frame rates: https://trac.ffmpeg.org/wiki/Slideshow#Framerates
571576 """
572577 def _args (self ):
573578 # Returns the command line parameters for subprocess to use
574579 # ffmpeg to create a movie using a pipe.
575580 args = [self .bin_path (), '-f' , 'rawvideo' , '-vcodec' , 'rawvideo' ,
576581 '-s' , '%dx%d' % self .frame_size , '-pix_fmt' , self .frame_format ,
577- '-r ' , str (self .fps )]
582+ '-framerate ' , str (self .fps )]
578583 # Logging is quieted because subprocess.PIPE has limited buffer size.
579584 # If you have a lot of frames in your animation and set logging to
580585 # DEBUG, you will have a buffer overrun.
@@ -590,8 +595,12 @@ class FFMpegFileWriter(FFMpegBase, FileMovieWriter):
590595 """
591596 File-based ffmpeg writer.
592597
593- Frames are written to temporary files on disk and then stitched
594- together at the end.
598+ Frames are written to temporary files on disk and then stitched together at the end.
599+
600+ This effectively works as a slideshow input to ffmpeg with the fps passed as
601+ ``-framerate``, so see also `their notes on frame rates`_ for further details.
602+
603+ .. _their notes on frame rates: https://trac.ffmpeg.org/wiki/Slideshow#Framerates
595604 """
596605 supported_formats = ['png' , 'jpeg' , 'tiff' , 'raw' , 'rgba' ]
597606
@@ -605,10 +614,10 @@ def _args(self):
605614 '-f' , 'image2' , '-vcodec' , 'rawvideo' ,
606615 '-video_size' , '%dx%d' % self .frame_size ,
607616 '-pixel_format' , 'rgba' ,
608- '-framerate' , str (self .fps ),
609617 ]
610- args += ['-r' , str (self .fps ), '-i' , self ._base_temp_name (),
611- '-vframes' , str (self ._frame_counter )]
618+ args += ['-framerate' , str (self .fps ), '-i' , self ._base_temp_name ()]
619+ if not self ._tmpdir :
620+ args += ['-frames:v' , str (self ._frame_counter )]
612621 # Logging is quieted because subprocess.PIPE has limited buffer size.
613622 # If you have a lot of frames in your animation and set logging to
614623 # DEBUG, you will have a buffer overrun.
@@ -953,9 +962,10 @@ class to use, such as 'ffmpeg'.
953962 of -1 lets the underlying movie encoder select the bitrate.
954963
955964 extra_args : list of str or None, optional
956- Extra command-line arguments passed to the underlying movie
957- encoder. The default, None, means to use
958- :rc:`animation.[name-of-encoder]_args` for the builtin writers.
965+ Extra command-line arguments passed to the underlying movie encoder. These
966+ arguments are passed last to the encoder, just before the output filename.
967+ The default, None, means to use :rc:`animation.[name-of-encoder]_args` for
968+ the builtin writers.
959969
960970 metadata : dict[str, str], default: {}
961971 Dictionary of keys and values for metadata to include in
0 commit comments