Animation subprocess bug #989

Merged
merged 2 commits into from Jul 20, 2012

2 participants

@tonysyu

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 some commits Jul 7, 2012
@tonysyu tonysyu Fix subprocess bug when saving animations.
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.
66b14f1
@tonysyu tonysyu Add print-out of ffmpeg output when debugging. 467fa90
@dopplershift dopplershift was assigned Jul 20, 2012
@dopplershift dopplershift merged commit b836275 into matplotlib:master Jul 20, 2012
@dopplershift

Looks good. Nice work.

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