From dd3567a702365c781a3c749e68e9e7f2db2281bc Mon Sep 17 00:00:00 2001 From: pupssman Date: Thu, 15 Jan 2015 20:52:57 +0400 Subject: [PATCH 1/2] Provide arguments to mencoder in a more proper way --- lib/matplotlib/animation.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 9737d5c9c122..130a7977bb6f 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -334,7 +334,7 @@ def grab_frame(self, **savefig_kwargs): All keyword arguments in savefig_kwargs are passed on to the 'savefig' command that saves the figure. ''' - #Overloaded to explicitly close temp file. + # Overloaded to explicitly close temp file. verbose.report('MovieWriter.grab_frame: Grabbing frame.', level='debug') try: @@ -368,7 +368,7 @@ def finish(self): def cleanup(self): MovieWriter.cleanup(self) - #Delete temporary files + # Delete temporary files if self.clear_temp: import os verbose.report( @@ -416,7 +416,7 @@ def _args(self): return args -#Combine FFMpeg options with temp file-based writing +# Combine FFMpeg options with temp file-based writing @writers.register('ffmpeg_file') class FFMpegFileWriter(FileMovieWriter, FFMpegBase): supported_formats = ['png', 'jpeg', 'ppm', 'tiff', 'sgi', 'bmp', @@ -469,10 +469,12 @@ def _remap_metadata(self): @property def output_args(self): self._remap_metadata() - args = ['-o', self.outfile, '-ovc', 'lavc', '-lavcopts', - 'vcodec=%s' % self.codec] + lavcopts = {'vcodec': self.codec} if self.bitrate > 0: - args.append('vbitrate=%d' % self.bitrate) + lavcopts.update(vbitrate=self.bitrate) + + args = ['-o', self.outfile, '-ovc', 'lavc', + '-lavcopts', ':'.join(itertools.starmap('{0}={1}'.format, lavcopts.items()))] if self.extra_args: args.extend(self.extra_args) if self.metadata: @@ -748,7 +750,7 @@ def save(self, filename, writer=None, fps=None, dpi=None, codec=None, for data in zip(*[a.new_saved_frame_seq() for a in all_anim]): for anim, d in zip(all_anim, data): - #TODO: Need to see if turning off blit is really necessary + # TODO: Need to see if turning off blit is really necessary anim._draw_next_frame(d, blit=False) writer.grab_frame(**savefig_kwargs) From d73d5caead401b3570b445cf1dfd4ccd71f35402 Mon Sep 17 00:00:00 2001 From: pupssman Date: Thu, 15 Jan 2015 21:04:58 +0400 Subject: [PATCH 2/2] Embrace the E501 --- lib/matplotlib/animation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 130a7977bb6f..e6e7d3379893 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -472,9 +472,9 @@ def output_args(self): lavcopts = {'vcodec': self.codec} if self.bitrate > 0: lavcopts.update(vbitrate=self.bitrate) - - args = ['-o', self.outfile, '-ovc', 'lavc', - '-lavcopts', ':'.join(itertools.starmap('{0}={1}'.format, lavcopts.items()))] + args = ['-o', self.outfile, '-ovc', 'lavc', '-lavcopts', + ':'.join(itertools.starmap('{0}={1}'.format, + lavcopts.items()))] if self.extra_args: args.extend(self.extra_args) if self.metadata: