@@ -334,7 +334,7 @@ def grab_frame(self, **savefig_kwargs):
334334        All keyword arguments in savefig_kwargs are passed on to the 'savefig' 
335335        command that saves the figure. 
336336        ''' 
337-         #Overloaded to explicitly close temp file. 
337+         #  Overloaded to explicitly close temp file. 
338338        verbose .report ('MovieWriter.grab_frame: Grabbing frame.' ,
339339                       level = 'debug' )
340340        try :
@@ -368,7 +368,7 @@ def finish(self):
368368    def  cleanup (self ):
369369        MovieWriter .cleanup (self )
370370
371-         #Delete temporary files 
371+         #  Delete temporary files 
372372        if  self .clear_temp :
373373            import  os 
374374            verbose .report (
@@ -416,7 +416,7 @@ def _args(self):
416416        return  args 
417417
418418
419- #Combine FFMpeg options with temp file-based writing 
419+ #  Combine FFMpeg options with temp file-based writing 
420420@writers .register ('ffmpeg_file' ) 
421421class  FFMpegFileWriter (FileMovieWriter , FFMpegBase ):
422422    supported_formats  =  ['png' , 'jpeg' , 'ppm' , 'tiff' , 'sgi' , 'bmp' ,
@@ -469,10 +469,12 @@ def _remap_metadata(self):
469469    @property  
470470    def  output_args (self ):
471471        self ._remap_metadata ()
472-         args  =  ['-o' , self .outfile , '-ovc' , 'lavc' , '-lavcopts' ,
473-                 'vcodec=%s'  %  self .codec ]
472+         lavcopts  =  {'vcodec' : self .codec }
474473        if  self .bitrate  >  0 :
475-             args .append ('vbitrate=%d'  %  self .bitrate )
474+             lavcopts .update (vbitrate = self .bitrate )
475+ 
476+         args  =  ['-o' , self .outfile , '-ovc' , 'lavc' ,
477+                 '-lavcopts' , ':' .join (itertools .starmap ('{0}={1}' .format , lavcopts .items ()))]
476478        if  self .extra_args :
477479            args .extend (self .extra_args )
478480        if  self .metadata :
@@ -748,7 +750,7 @@ def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
748750            for  data  in  zip (* [a .new_saved_frame_seq ()
749751                              for  a  in  all_anim ]):
750752                for  anim , d  in  zip (all_anim , data ):
751-                     #TODO: Need to see if turning off blit is really necessary 
753+                     #  TODO: Need to see if turning off blit is really necessary 
752754                    anim ._draw_next_frame (d , blit = False )
753755                writer .grab_frame (** savefig_kwargs )
754756
0 commit comments