I was playing around trying to create animations using circles. It's a simple code which moves a circle around in the frame.
I don't understand why it can't save the .mp4. I've conda installed ffmpeg and it's an updated version. Can somebody help me out with this?
(I'm using Windows 10)
anim.save('animation.mp4', fps=30,
extra_args=['-vcodec', 'h264',
'-pix_fmt', 'yuv420p'])
Pillow does not currently have an option to save MP4 files, so it makes sense that Pillow is reporting that this is an unknown file extension.
fps and extra_args arguments look like they are from matplotlib's FFMpegWriter - https://matplotlib.org/api/_as_gen/matplotlib.animation.FFMpegWriter.html. So I imagine that anim needs to be an FFMpegWriter object, rather than a Pillow image object. Here is a tutorial from Google if that is helpful - https://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial/
fpsandextra_argsarguments look like they are from matplotlib's FFMpegWriter - https://matplotlib.org/api/_as_gen/matplotlib.animation.FFMpegWriter.html.
Hello Sir!
Yes, ffmpeg works for me now. I had conda installed ffmpeg but that doesn't work.
Downloading ffmpeg and adding it to the path works for me.
plt.rcParams['animation.ffmpeg_path'] ='C:\\Sushanti\\ffmpeg\\bin\\ffmpeg.exe'
FFwriter=animation.FFMpegWriter(fps=10, extra_args=['-vcodec', 'libx264'])
anim.save('plswork.mp4', writer=FFwriter)
Most helpful comment
Hello Sir!
Yes, ffmpeg works for me now. I had conda installed ffmpeg but that doesn't work.
Downloading ffmpeg and adding it to the path works for me.