是否可以将matplotlib动画保存为webm格式?

2024-09-25 08:40:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用这个示例代码作为测试用例:https://matplotlib.org/examples/animation/moviewriter.html

在这段代码中,他们使用FFMPEG将matplotlib动画写入.mp4视频文件。是否可以写入.webm格式?在

但我不知道该怎么做。在


Tags: 代码httpsorg示例matplotlibhtml测试用例动画
1条回答
网友
1楼 · 发布于 2024-09-25 08:40:27

确保您的ffmpegcompiledlibvpx(不带参数运行ffmpeg,然后查看输出中是否有 enable-libvpx)。在

FFMpegWriter = manimation.writers['ffmpeg']
writer = FFMpegWriter(fps=15, codec='libvpx-vp9') # or libvpx-vp8

[...]

with writer.saving(fig, "writer_test.webm", 100):
    [...]

相关问题 更多 >