animation with 'ffmpeg' backend incompative with 'bounding_box=tight' #2483

Closed
vlsd opened this Issue Oct 2, 2013 · 9 comments

Comments

Projects
None yet
5 participants
Contributor

vlsd commented Oct 2, 2013

I am using ffmpeg 2.0.1 and python2.7. When I save an animation using the (default) ffmpeg backend I do not get an error but the video comes out all garbled.

This is due to setting the bounding_box=tight option in matplotlibrc (see comments below).

Running the script with --verbose-debug I do get an ffmpeg error:

Invalid buffer size, packet size 2440992 < expected frame_size 3780000944.4kbits/s
Error while decoding stream #0:0: Invalid argument

The full log is here https://gist.github.com/6787110

At the very least we should document this issue, and maybe throw a warning/exception to save people time when they run into this. Pull request #2493 includes a version of this.

Owner

tacaswell commented Oct 2, 2013

Are you using bounding_box=tight in your rcparams? That will mess up how large the frames handed to ffmpeg are as the size the figure claims it is and the size of the image that is returned after the tight bounding box are applied do not match.

Contributor

vlsd commented Oct 2, 2013

That did it. Thanks!

vlsd closed this Oct 2, 2013

Owner

tacaswell commented Oct 2, 2013

This issue should probably be opened back up as a request to improve the documentation on this subject.

I only knew this because I spent most of an evening once trying to figure out why code that used to work no longer did.

Member

WeatherGod commented Oct 2, 2013

I could have sworn I had a discussion about this exact topic once (prior to
the rcparam's existence, I think). The point I raised was that it just
didn't make sense to allow tight bbox for movies because of this very
reason. The only way I could see it make sense is if we could extract the
bbox used for the first frame and apply that to the rest of the frames.

Contributor

vlsd commented Oct 2, 2013

Maybe add a line in the matplotlibrc comment following bounding_boxabout how using it only woks with a {ffmpeg,avconv}_file animation backend?

vlsd reopened this Oct 2, 2013

Owner

tacaswell commented Jan 17, 2014

@vlsd I seem to recall you PR to fix this getting merged. Please re-open if I am incorrect.

tacaswell closed this Jan 17, 2014

Contributor

vlsd commented Jan 17, 2014

@tacaswell yes you are correct. thanks for closing!

Contributor

breedlun commented Apr 16, 2014

Glad to see this will be fixed in the next release. I just spent all evening tracking down why my videos were garbled.

chipmuenk commented May 13, 2016 edited

Using the latest ffmpeg, matplotlib 1.5.0rc3 or 1.5.1 and Py 2.7.10 or 3.4.4 under Windows 7, the problem still persists. Has it been fixed somewhere?

As this was my first attempt with animations, it cost me a few hours until I finally stumbled across this thread :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment