I am new to python and I'm trying to make an animation and save it into some video format using matplotlibs FuncAnimation. If I run the following code:
import numpy as np
import matplotlib.animation as ani
import matplotlib.pyplot as plt
azimuths = np.radians(np.linspace(0, 360, 360))
zeniths = np.arange(0, 8, 0.2)
rho, psi = np.meshgrid(zeniths, azimuths)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, polar=True)
ax.set_yticks([])
plt.grid()
def frame(i):
values_i = prob_density(rho ** 2, psi, i)
ax.contourf(psi, rho, values_i)
animation = ani.FuncAnimation(fig, frame, np.linspace(0, 1000, 10))
animation.save('video.mp4', writer='ffmpeg')
There is an error that says:
ValueError: outfile must be *.htm or *.html
As this seems to have something to do with the ffmpeg files - these are located in
/anaconda3/bin/ffmpeg
I have been on this for quite some time now but can't seem to figure out a solution though it seems to be common issue. Thankful for any suggestions.