首页 > 解决方案 > MovieWriter (ffmpeg) 不可用 PyCharm (Windows)

问题描述

我已按照说明下载 ffmpeg 并根据 Matplotlib-Animation "No MovieWriters Available"添加路径 虽然我可以在 Windows 控制台上的命令提示符和 Bash 中输入版本,但心爱的 PyCharm 警告我:

Requested MovieWriter (ffmpeg) not available

当我尝试保存动画时:

ani = anim.FuncAnimation(fig, animate, frames = 14, init_func = init, interval = 500, repeat = False)
plt.show()
ani.save("Inno.mp4", writer=writer)

我必须添加另一条路径吗?请帮帮我,我真的厌倦了这个错误。

标签: python-3.xwindowsmatplotlibanimationffmpeg

解决方案


可以直接指定ffmpeg路径,如下:

plt.rcParams['animation.ffmpeg_path'] = 'ffmpeg path on your machine' (e.g.: "C:\FFmpeg\bin\ffmpeg.exe")

或尝试在您的 cmd 上调用 ffmpeg 以确保已在您的环境变量中正确定义其路径。

要在确保正确定义路径后获取路径,请在您的 cmd 中写入:

where ffmpeg 

推荐阅读