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