I am trying to save a simple matplotlib animation from Jake Vanderplas, but I keep getting OSError: [Errno 13] Permission denied.
I should note that I
Further to Stretch's answer, I found that some of the parameters being passed to anim.save() do not appear to achieve the desired effect. Specifically fps was 5 (default) and not the 30 being set. By passing fps=30 to animation.FFMpegWriter it does work.
So:
FFwriter = animation.FFMpegWriter(fps=30)
anim.save('basic_animation.mp4', writer=FFwriter, extra_args=['-vcodec', 'libx264'])
Note that the video is now 7 seconds long (200 frames @ 30 fps) rather than 40 seconds (200 frames @ 5 fps). Note also that a default of 5 fps corresponds to the default 200 ms/frame interval in FuncAnimation, and strictly speaking the 20 ms animation interval used here corresponds to 50 fps.
For those struggling to achieve better video quality, it is also possible to pass a bitrate (integer in kbps) to animation.FFMpegWriter, eg:
FFwriter = animation.FFMpegWriter(fps=30, bitrate=2000)
I tried various extra_args in an effort to achieve better quality, without much success.