8000 Animation subprocess bug by tonysyu · Pull Request #989 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

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()

tonysyu added 2 commits July 7, 2012 11:34
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.

2 participants

0