在我的笔记本中,我从URL中获取一些数据,执行一些分析,并进行一些绘图。
我还希望使用FuncAnimation of matplotlib.animation创建一个html动画。所以在序言里我做了
import matplotlib.animation as manim
plt.rcParams["animation.html"] = "html5"
%matplotlib inline(还有别的事.def init()...,def animate(i)...)
anima = manim.FuncAnimation(fig,
animate,
init_func=init,
frames=len(ypos)-d0,
interval=200,
repeat=False,
blit=True)想象一下,然后我打电话给
FFMpegWriter = manim.writers['ffmpeg']
writer = FFMpegWriter(fps=15)
link = anima.to_html5_video()
from IPython.core.display import display, HTML
display(HTML(link))因为我希望这个剪辑在笔记本上显示为一个整洁的html视频。
虽然这在我的机器上运行得很好,但在Watson-Studio上,我得到了以下错误:
RuntimeError: Requested MovieWriter (ffmpeg) not available
我已经检查了ffmpeg是否以Python包的形式可用
(!pip freeze --isolated | grep ffmpeg给出ffmpeg-python==0.2.0)
问题是:我如何告诉matplotlib.animation.writers在ffmpeg-python中使用编解码器?
感谢所有的响应者和支持者
发布于 2020-05-27 07:17:48
我们目前还没有在云上的Watson Studio中预装ffmpeg。您提到的包ffmpeg-python只是一个Python包装,但如果没有实际的ffmpeg,它就无法工作。
您可以从conda安装ffmpeg:
!conda install ffmpeg一旦您有了笔记本需要的其他软件包的完整列表,我建议您创建一个自定义环境。然后,您就不必将安装命令放入实际的笔记本中。
定制过程可能如下所示:
dependencies:
- ffmpeg=4.2.2
- pip
- pip:
- ffmpeg-python==0.2.0https://stackoverflow.com/questions/62036804
复制相似问题