Skip to content

Commit

Permalink
Remove mencoder support.
Browse files Browse the repository at this point in the history
Also removed movie_demo_sgskip, which was broken anyways (it did not
import os); moviewrite_sgskip, which uses the animation API is a better
example anyways (I don't think there's much of a point to show the flags
for a specific encoder in an example -- if anything, that should go to
the class docstring).
  • Loading branch information
anntzer committed Nov 4, 2017
1 parent 5a52609 commit b8aabc1
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 159 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Expand Up @@ -127,7 +127,7 @@ test_script:

# this are optional dependencies so that we don't skip so many tests...
- if x%TEST_ALL% == xyes conda install -q ffmpeg inkscape miktex pillow
# missing packages on conda-forge for avconv mencoder imagemagick
# missing packages on conda-forge for avconv imagemagick
# This install sometimes failed randomly :-(
#- choco install imagemagick

Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -22,7 +22,6 @@ addons:
- inkscape
- libav-tools
- gdb
- mencoder
- dvipng
- pgf
- lmodern
Expand Down
3 changes: 1 addition & 2 deletions INSTALL.rst
Expand Up @@ -89,8 +89,7 @@ To run the test suite:
:file:`lib\\mpl_toolkits\\tests` directories from the source distribution;
* install test dependencies: `pytest <https://pypi.python.org/pypi/pytest>`_,
`mock <https://pypi.python.org/pypi/mock>`_, Pillow, MiKTeX, GhostScript,
ffmpeg, avconv, mencoder, ImageMagick, and `Inkscape
<https://inkscape.org/>`_;
ffmpeg, avconv, ImageMagick, and `Inkscape <https://inkscape.org/>`_;
* run ``py.test path\to\tests\directory``.


Expand Down
14 changes: 0 additions & 14 deletions doc/api/animation_api.rst
Expand Up @@ -302,17 +302,3 @@ Inheritance Diagrams

.. inheritance-diagram:: matplotlib.animation.AVConvFileWriter matplotlib.animation.AVConvWriter matplotlib.animation.FFMpegFileWriter matplotlib.animation.FFMpegWriter matplotlib.animation.ImageMagickFileWriter matplotlib.animation.ImageMagickWriter
:private-bases:



Deprecated
==========


.. autosummary::
:toctree: _as_gen
:nosignatures:

MencoderBase
MencoderFileWriter
MencoderWriter
Expand Up @@ -13,3 +13,5 @@ The ``Axes.get_axis_bgcolor``, ``Axes.set_axis_bgcolor``,
The ``bgcolor`` keyword argument to ``Axes`` has been removed.

The ``spectral`` and ``Vega*`` colormaps have been removed.

``mencoder`` can no longer be used to encode animations.
36 changes: 0 additions & 36 deletions examples/animation/movie_demo_sgskip.py

This file was deleted.

83 changes: 2 additions & 81 deletions lib/matplotlib/animation.py
Expand Up @@ -711,88 +711,9 @@ class AVConvFileWriter(AVConvBase, FFMpegFileWriter):
Frames are written to temporary files on disk and then stitched
together at the end.
'''


# Base class of mencoder information. Contains configuration key information
# as well as arguments for controlling *output*
class MencoderBase(object):
exec_key = 'animation.mencoder_path'
args_key = 'animation.mencoder_args'

# Mencoder only allows certain keys, other ones cause the program
# to fail.
allowed_metadata = ['name', 'artist', 'genre', 'subject', 'copyright',
'srcform', 'comment']

# Mencoder mandates using name, but 'title' works better with ffmpeg.
# If we find it, just put it's value into name
def _remap_metadata(self):
if 'title' in self.metadata:
self.metadata['name'] = self.metadata['title']

@property
def output_args(self):
self._remap_metadata()
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()))]
if self.extra_args:
args.extend(self.extra_args)
if self.metadata:
args.extend(['-info', ':'.join('%s=%s' % (k, v)
for k, v in six.iteritems(self.metadata)
if k in self.allowed_metadata)])
return args


# The message must be a single line; internal newlines cause sphinx failure.
mencoder_dep = ("Support for mencoder is only partially functional, "
"and will be removed entirely in 2.2. "
"Please use ffmpeg instead.")


@writers.register('mencoder')
class MencoderWriter(MovieWriter, MencoderBase):

@deprecated('2.0', message=mencoder_dep)
def __init__(self, *args, **kwargs):
with rc_context(rc={'animation.codec': 'mpeg4'}):
super(MencoderWriter, self).__init__(*args, **kwargs)

def _args(self):
# Returns the command line parameters for subprocess to use
# mencoder to create a movie
return [self.bin_path(), '-', '-demuxer', 'rawvideo', '-rawvideo',
('w=%i:h=%i:' % self.frame_size +
'fps=%i:format=%s' % (self.fps,
self.frame_format))] + self.output_args


# Combine Mencoder options with temp file-based writing
@writers.register('mencoder_file')
class MencoderFileWriter(FileMovieWriter, MencoderBase):
supported_formats = ['png', 'jpeg', 'tga', 'sgi']

@deprecated('2.0', message=mencoder_dep)
def __init__(self, *args, **kwargs):
with rc_context(rc={'animation.codec': 'mpeg4'}):
super(MencoderFileWriter, self).__init__(*args, **kwargs)

def _args(self):
# Returns the command line parameters for subprocess to use
# mencoder to create a movie
return [self.bin_path(),
'mf://%s*.%s' % (self.temp_prefix, self.frame_format),
'-frames', str(self._frame_counter), '-mf',
'type=%s:fps=%d' % (self.frame_format,
self.fps)] + self.output_args


# Base class for animated GIFs with convert utility
class ImageMagickBase(object):
'''Mixin class for ImageMagick output.
Expand Down Expand Up @@ -1111,8 +1032,8 @@ def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
writer : :class:`MovieWriter` or str, optional
A `MovieWriter` instance to use or a key that identifies a
class to use, such as 'ffmpeg' or 'mencoder'. If ``None``,
defaults to ``rcParams['animation.writer']``.
class to use, such as 'ffmpeg'. If ``None``, defaults to
``rcParams['animation.writer']``.
fps : number, optional
Frames per second in the movie. Defaults to ``None``, which will use
Expand Down
4 changes: 0 additions & 4 deletions lib/matplotlib/mpl-data/stylelib/_classic_test.mplstyle
Expand Up @@ -506,10 +506,6 @@ animation.ffmpeg_args: # Additional arguments to pass to ffmpeg
animation.avconv_path: avconv # Path to avconv binary. Without full path
# $PATH is searched
animation.avconv_args: # Additional arguments to pass to avconv
animation.mencoder_path: mencoder
# Path to mencoder binary. Without full path
# $PATH is searched
animation.mencoder_args: # Additional arguments to pass to mencoder
animation.convert_path: convert # Path to ImageMagick's convert binary.
# On Windows use the full path since convert
# is also the name of a system tool.
Expand Down
4 changes: 0 additions & 4 deletions lib/matplotlib/mpl-data/stylelib/classic.mplstyle
Expand Up @@ -508,10 +508,6 @@ animation.ffmpeg_args: # Additional arguments to pass to ffmpeg
animation.avconv_path: avconv # Path to avconv binary. Without full path
# $PATH is searched
animation.avconv_args: # Additional arguments to pass to avconv
animation.mencoder_path: mencoder
# Path to mencoder binary. Without full path
# $PATH is searched
animation.mencoder_args: # Additional arguments to pass to mencoder
animation.convert_path: convert # Path to ImageMagick's convert binary.
# On Windows use the full path since convert
# is also the name of a system tool.
Expand Down
13 changes: 3 additions & 10 deletions lib/matplotlib/rcsetup.py
Expand Up @@ -594,7 +594,6 @@ def validate_hinting(s):
validate_movie_writer = ValidateInStrings('animation.writer',
['ffmpeg', 'ffmpeg_file',
'avconv', 'avconv_file',
'mencoder', 'mencoder_file',
'imagemagick', 'imagemagick_file',
'html'])

Expand Down Expand Up @@ -1394,23 +1393,17 @@ def _validate_linestyle(ls):
'animation.frame_format': ['png', validate_movie_frame_fmt],
# Additional arguments for HTML writer
'animation.html_args': [[], validate_stringlist],
# Path to FFMPEG binary. If just binary name, subprocess uses $PATH.
# Path to ffmpeg binary. If just binary name, subprocess uses $PATH.
'animation.ffmpeg_path': ['ffmpeg', validate_animation_writer_path],

# Additional arguments for ffmpeg movie writer (using pipes)
'animation.ffmpeg_args': [[], validate_stringlist],
# Path to AVConv binary. If just binary name, subprocess uses $PATH.
'animation.avconv_path': ['avconv', validate_animation_writer_path],
# Additional arguments for avconv movie writer (using pipes)
'animation.avconv_args': [[], validate_stringlist],
# Path to MENCODER binary. If just binary name, subprocess uses $PATH.
'animation.mencoder_path': ['mencoder', validate_animation_writer_path],
# Additional arguments for mencoder movie writer (using pipes)
'animation.mencoder_args': [[], validate_stringlist],
# Path to convert binary. If just binary name, subprocess uses $PATH
# Path to convert binary. If just binary name, subprocess uses $PATH.
'animation.convert_path': ['convert', validate_animation_writer_path],
# Additional arguments for mencoder movie writer (using pipes)

# Additional arguments for convert movie writer (using pipes)
'animation.convert_args': [[], validate_stringlist],

# Classic (pre 2.0) compatibility mode
Expand Down
2 changes: 0 additions & 2 deletions lib/matplotlib/tests/test_animation.py
Expand Up @@ -115,8 +115,6 @@ def isAvailable(self):
WRITER_OUTPUT = [
('ffmpeg', 'mp4'),
('ffmpeg_file', 'mp4'),
('mencoder', 'mp4'),
('mencoder_file', 'mp4'),
('avconv', 'mp4'),
('avconv_file', 'mp4'),
('imagemagick', 'gif'),
Expand Down
5 changes: 1 addition & 4 deletions matplotlibrc.template
Expand Up @@ -614,10 +614,7 @@ backend : $TEMPLATE_BACKEND
#animation.avconv_path: 'avconv' # Path to avconv binary. Without full path
# $PATH is searched
#animation.avconv_args: '' # Additional arguments to pass to avconv
#animation.mencoder_path: 'mencoder'
# Path to mencoder binary. Without full path
# $PATH is searched
#animation.mencoder_args: '' # Additional arguments to pass to mencoder
#animation.convert_path: 'convert' # Path to ImageMagick's convert binary.
# On Windows use the full path since convert
# is also the name of a system tool.
#animation.convert_args: '' # Additional arguments to pass to convert

0 comments on commit b8aabc1

Please sign in to comment.