title: Saving animations using ffmpeg and matplotlib
body: <p>im new in here and new in python, im doing some animations with animation.FuncAnimation of matplotliib. The animation works perfectly but i´m having problems saving the animations. here is the part of the code of the animation.</p>
  
  <pre><code>import numpy as np 
  import matplotlib.pyplot as plt
  import matplotlib.animation as animation
  
  fig, ax = plt.subplots()
  
  line,  = ax.plot(range(N),sin(x[0,:]),'o-')
  ax.axis([0,1,-1,1])
  
  def animate(i):
      line.set_ydata(sin(x[i,:]))  # update the data
      return line,
  
  def init():
      line.set_ydata(np.ma.array(x[0,:], mask=True))
      return line,
  
  ani = animation.FuncAnimation(fig, animate, np.arange(1, 10000),
      interval=25, init_func=init, blit=True)
  ani.save('2osc.mp4', writer="ffmpeg")
  plt.show()
  </code></pre>
  
  <p>where x[:,:] is previously set. ani.save is saving every frame of the animation as a .npg image instade of saving the movie. I dont know if this is how it is suposed to work and i have to do the movie with the .npg with another program or if im doing something wrong. 
  Obs: i've previously installed ffmpeg and it seems to be working just fine. </p>