Hi,

while trying out animation.ArtistAnimation, my script would not
terminate.  The .mp4 file was generated and later found out that the
script would block at proc.wait() within _make_movie.  ffmpeg
generates quite a bit of text and it seems that if stdout/stderr are
not closed, wait() does not return (this is on Windows).  I have made
some modifications to animation.py to get it to work, but can't tell
how this will behave on other platforms.


Proposed change in matplotlib/animation.py:

    def _make_movie(self, fname, fps, codec, frame_prefix, cmd_gen=None):
        # Uses subprocess to call the program for assembling frames into a
        # movie file.  *cmd_gen* is a callable that generates the sequence
        # of command line arguments from a few configuration options.
        from subprocess import Popen, PIPE
        if cmd_gen is None:
            cmd_gen = self.ffmpeg_cmd
        command = cmd_gen(fname, fps, codec, frame_prefix)
        verbose.report('Animation._make_movie running command: %s'%'
'.join(command))
        proc = Popen(command, shell=False,
            stdout=PIPE, stderr=PIPE)
+      proc.stdout.close()
+      proc.stderr.close()
        proc.wait()

This was tested to work with the configuration below.

OS: Windows 7
Python Version: Python 2.7.2 |EPD 7.2-1 (32-bit)| (default, Sep 14
2011, 11:02:05) [MSC v.1500 32 bit (Intel)]
Matplotlib version: 1.1.0
ffmpeg version N-38622-g1eabd71

Best regards

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to