@@ -334,7 +334,7 @@ def grab_frame(self, **savefig_kwargs):
334
334
All keyword arguments in savefig_kwargs are passed on to the 'savefig'
335
335
command that saves the figure.
336
336
'''
337
- #Overloaded to explicitly close temp file.
337
+ # Overloaded to explicitly close temp file.
338
338
verbose .report ('MovieWriter.grab_frame: Grabbing frame.' ,
339
339
level = 'debug' )
340
340
try :
@@ -368,7 +368,7 @@ def finish(self):
368
368
def cleanup (self ):
369
369
MovieWriter .cleanup (self )
370
370
371
- #Delete temporary files
371
+ # Delete temporary files
372
372
if self .clear_temp :
373
373
import os
374
374
verbose .report (
@@ -416,7 +416,7 @@ def _args(self):
416
416
return args
417
417
418
418
419
- #Combine FFMpeg options with temp file-based writing
419
+ # Combine FFMpeg options with temp file-based writing
420
420
@writers .register ('ffmpeg_file' )
421
421
class FFMpegFileWriter (FileMovieWriter , FFMpegBase ):
422
422
supported_formats = ['png' , 'jpeg' , 'ppm' , 'tiff' , 'sgi' , 'bmp' ,
@@ -469,10 +469,12 @@ def _remap_metadata(self):
469
469
@property
470
470
def output_args (self ):
471
471
self ._remap_metadata ()
472
- args = ['-o' , self .outfile , '-ovc' , 'lavc' , '-lavcopts' ,
473
- 'vcodec=%s' % self .codec ]
472
+ lavcopts = {'vcodec' : self .codec }
474
473
if self .bitrate > 0 :
475
- args .append ('vbitrate=%d' % self .bitrate )
474
+ lavcopts .update (vbitrate = self .bitrate )
475
+ args = ['-o' , self .outfile , '-ovc' , 'lavc' , '-lavcopts' ,
476
+ ':' .join (itertools .starmap ('{0}={1}' .format ,
477
+ lavcopts .items ()))]
476
478
if self .extra_args :
477
479
args .extend (self .extra_args )
478
480
if self .metadata :
@@ -748,7 +750,7 @@ def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
748
750
for data in zip (* [a .new_saved_frame_seq ()
749
751
for a in all_anim ]):
750
752
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
752
754
anim ._draw_next_frame (d , blit = False )
753
755
writer .grab_frame (** savefig_kwargs )
754
756
0 commit comments