On Thu, Nov 1, 2012 at 5:38 AM, Maximilian Albert
<maximilian.alb...@gmail.com> wrote:
> Hi all,
>
> quick update on this: I pushed a small change to make the default
> argument immutable (thanks to Jens for pointing this out). Just a
> couple more questions/comments:
>
> 1) Should there be a test for this? I couldn't find any tests for the
> Animation class, so I haven't added one. But perhaps I just missed
> them.

Sadly there are no tests. Partially because I'm lazy, and partially
because I'm not sure how exactly that would work. I'd gladly take a PR
with some if someone can figure it out, but I realize that's more than
you signed up for.

> 2) I discovered this morning that my change uncovers/introduces a bug
> in the Animation class, so I'd appreciate a bit more input on whether
> it should be merged in the current state. Here is an explanation:
>
> My original use case the suggested change was to be able to set tight
> bounding boxes when saving animation frames. At the time I simply
> saved all frames to separate images and combined them manually using
> avconv, which worked fine. I saw that in the development version of
> matplotlib there is built-in support for this, so that the video file
> is created automatically. Now whenever I change the bounding box, e.g.
> by passing something like savefig_kwargs={'bbox_inches': 'tight'} to
> Animation.save(), then the output video shows complete garbage
> (similar to white noise). I presume this is because the 'frame_size'
> property in the MovieWriter class is not aware of the bounding box
> changes introduced by savefig_kwargs and thus reports a frame size to
> the video converter that is different from the actual size of the
> saved frames.
>
> I don't have much time to look into this at the moment, but I just
> wanted to point it out. Does anyone have a quick idea for a good fix,
> before I get the time to look into the details of how the MovieWriter
> class works?

You might have more luck using a temp-file based writer. By default,
movies are created by piping in the data to the command; this is much
faster, but, at least as I've done it now, requires a fixed number of
bytes per frame. Try passing writer='ffmpeg_file' or
writer='mencoder_file' to the command to save the animation.

If I get a chance (or someone else if you want to help), I'll see if
there's any way to make the pipe-based writers work with
variable-sized frames. Failing that, we could just ignore the tight
bbox option when using pipes for saving movies.

Thanks for the work!

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to