如何将matplotlib中的动画另存为mp4视频文件?

时间:2018-12-19 00:36:47

标签: animation matplotlib ffmpeg

我正在尝试将一个Animation.ArtistAnimation对象渲染为mp4格式的24 fps视频文件。

我已经搜索过,并且到达了this。但是,即使在编译ffmpeg之后,我也会收到以下错误消息:

C:\Users\trite\OneDrive\Documentos\MusiTex\Python\venv\Scripts\python.exe 
"C:/Users/trite/OneDrive/Documentos/MusiTex/Python/venv/Saving Animation.py"
Traceback (most recent call last):
  File "C:\Users\trite\OneDrive\Documentos\MusiTex\Python\venv\lib\site- 
packages\matplotlib\animation.py", line 161, in __getitem__
    return self.avail[name]
KeyError: 'ffmpeg'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/trite/OneDrive/Documentos/MusiTex/Python/venv/Saving 
Animation.py", line 20, in <module>
    FFMpegWriter = manimation.writers['ffmpeg']
  File "C:\Users\trite\OneDrive\Documentos\MusiTex\Python\venv\lib\site- 
packages\matplotlib\animation.py", line 164, in __getitem__
    'Requested MovieWriter ({}) not available'.format(name))
RuntimeError: Requested MovieWriter (ffmpeg) not available

Process finished with exit code 1

出什么问题了?

如果您能帮助我,我将不胜感激。实际上,如果还有其他方法可以将此类对象保存/渲染为视频文件(最好是mp4),我将很高兴听到它们。

非常感谢您

0 个答案:

没有答案