Skip to content

Provide arguments to mencoder in a more proper way #4004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 16, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)

Expand Down