Navigation Menu

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 subprocess bug #989

Merged
merged 2 commits into from Jul 20, 2012

Conversation

tonysyu
Copy link
Contributor

@tonysyu tonysyu commented Jul 7, 2012

Ffmpeg prints a lot of info to stderr. For longer animations, this logging fills up the (very-small) buffer for subprocess.PIPE and subprocess just hangs (with no error).

This PR suppresses logging in ffmpeg to prevent this issue. If matplotlib's verbosity level is set to 'debug*', then ffmpeg's output is piped to stdout.

Edit: I forgot to post code that reproduces the issue. This is pretty much what I posted to the mailing list. I use streamplot mainly because it produces more ffmpeg output so it fails with fewer iterations. The following should hang (this seems to vary on my system, but it's usually close to 200 frames in).

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation

fig, ax = plt.subplots()

# do nothing function that prints frame
def update(frame_num):
    print frame_num
    return []

Y, X = np.mgrid[:1:100j, :1:100j]
U = np.ones_like(X)
V = np.ones_like(X)
ax.streamplot(X, Y, U, V, density=1)

ani = animation.FuncAnimation(fig, update, save_count=500)

ani.save('animation.avi')
#plt.show()

Ffmpeg prints a lot of info to stderr. For longer animations, this logging fills up the (very-small) buffer for subprocess.PIPE and subprocess just hangs (no error). Suppress logging in ffmpeg to prevent this issue.
@ghost ghost assigned dopplershift Jul 20, 2012
dopplershift added a commit that referenced this pull request Jul 20, 2012
Fix a bug with too much output from ffmpeg stalling the pipe.
@dopplershift dopplershift merged commit b836275 into matplotlib:master Jul 20, 2012
@dopplershift
Copy link
Contributor

Looks good. Nice work.

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

Successfully merging this pull request may close these issues.

None yet

2 participants