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:
fps, codec, bitrate, extra_args, metadata are used to construct a MovieWriter instance and can only be passed if writer is a string.
So you could try
FFwriter = animation.FFMpegWriter(fps=30, codec="libx264")
video_ani.save('basic_animation1.mp4', writer = FFwriter )
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.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With