I am fairly new to matplotlib and animations, the animation I have works when using pyplot.show
but when attempting to use the animation.save
function, the only thing outputted is a 0 second video with the initial frame of the animation.
This is my code:
plt.rcParams['animation.ffmpeg_path'] = r'C:\FFMPEG\bin\ffmpeg.exe'
FFwriter = animation.FFMpegWriter()
video_ani.save('basic_animation1.mp4', writer = FFwriter, fps=30, extra_args=['-vcodec', 'libx264'])
Any help would be appreciated, thanks
I think you need to supply the arguments to the FFMpegWriter class, not to
animate.save
. The documenation says:So you could try
where the codec is specified using the
codec
argument instead of some extra argument.Appart from that you'd probably need to test certain things:
codec="h264"
, maybe that matters.