【发布时间】:2021-01-29 12:13:55
【问题描述】:
我在 Mac 上通过 anaconda 使用 python 导出动画时遇到问题。我收到以下RuntimeError。
RuntimeError: Requested MovieWriter (ffmpeg) not available
看其他问题,主要选项是通过conda安装ffmpeg:
conda install -c conda-forge ffmpeg
或者指定路径:
plt.rcParams['animation.ffmpeg_path'] = '/usr/local/bin/ffmpeg'
第二个选项只返回相同的RuntimeError。第一个选项返回一个单独的错误:
BrokenPipeError: [Errno 32] Broken pipe
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/person/opt/anaconda3/lib/python3.8/site-packages/matplotlib/animation.py", line 1152, in save
writer.grab_frame(**savefig_kwargs)
File "/Users/person/opt/anaconda3/lib/python3.8/contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "/Users/person/opt/anaconda3/lib/python3.8/site-packages/matplotlib/animation.py", line 232, in saving
self.finish()
File "/Users/person/opt/anaconda3/lib/python3.8/site-packages/matplotlib/animation.py", line 368, in finish
self.cleanup()
File "/Users/person/opt/anaconda3/lib/python3.8/site-packages/matplotlib/animation.py", line 411, in cleanup
raise subprocess.CalledProcessError(
CalledProcessError: Command '['ffmpeg', '-f', 'rawvideo', '-vcodec', 'rawvideo', '-s', '1600x1302', '-pix_fmt', 'rgba', '-r', '10', '-loglevel', 'error', '-i', 'pipe:', '-vcodec', 'h264', '-pix_fmt', 'yuv420p', '-b', '8000k', '-vcodec', 'libx264', '-y', 'test_text.mp4']' died with <Signals.SIGABRT: 6>.
追查这个错误然后让我回到卸载ffmpeg 包。但这只会导致初始错误,指出 ffmpeg 不可用。
【问题讨论】:
-
你试过了吗:superuser.com/questions/624561/install-ffmpeg-on-os-x。您可能还想查看 cocalc.com。它提供了预装 ffmpeg 的在线 ubuntu 模拟器。您可以上传文件,对其进行各种操作,然后下载修改后的文件。
-
谢谢。那是一场战斗。我现在已经安装了 brew 但必须在控制台中插入正确的路径,否则它会引发同样的错误。我不确定有多少人会觉得这个问题有用。如果您将评论格式化为答案,我会接受它
标签: python matplotlib animation ffmpeg