Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

vlsd opened this issue Oct 2, 2013 · 9 comments

Comments

@vlsd
Copy link
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.

@tacaswell
Copy link
Member

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.

@vlsd
Copy link
Contributor Author

vlsd commented Oct 2, 2013

That did it. Thanks!

@vlsd vlsd closed this as completed Oct 2, 2013
@tacaswell
Copy link
Member

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.

@WeatherGod
Copy link
Member

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.

@vlsd
Copy link
Contributor Author

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 vlsd reopened this Oct 2, 2013
@tacaswell
Copy link
Member

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

@vlsd
Copy link
Contributor Author

vlsd commented Jan 17, 2014

@tacaswell yes you are correct. thanks for closing!

@breedlun
Copy link
Contributor

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

@chipmuenk
Copy link

chipmuenk commented May 13, 2016

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants