In my notebook I get some data from URL, perform some analysis and do some plotting.
I want also create a html animation using FuncAnimation
of matplotlib.animation
.
So in the preamble I do
import matplotlib.animation as manim
plt.rcParams["animation.html"] = "html5"
%matplotlib inline
(something else... def init()...
, def animate(i)...
) then
anima = manim.FuncAnimation(fig,
animate,
init_func=init,
frames=len(ypos)-d0,
interval=200,
repeat=False,
blit=True)
To visualise, I then call
FFMpegWriter = manim.writers['ffmpeg']
writer = FFMpegWriter(fps=15)
link = anima.to_html5_video()
from IPython.core.display import display, HTML
display(HTML(link))
because I want the clip to show up as a neat html video in the notebook
Whereas this works well on my machine, on Watson-Studio I get the following error:
RuntimeError: Requested MovieWriter (ffmpeg) not available
I've checked that ffmpeg
is available in the form of a Python package
(!pip freeze --isolated | grep ffmpeg
gives ffmpeg-python==0.2.0
)
The question is: how can I tell matplotlib.animation.writers
to use the codec in ffmpeg-python
?
Many thanks to all responders and supporters