Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


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

vlsd opened this Issue · 8 comments

4 participants


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

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.


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.


That did it. Thanks!

@vlsd vlsd closed this

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.


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

@vlsd vlsd reopened this

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

@tacaswell tacaswell closed this

@tacaswell yes you are correct. thanks for closing!


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.