【问题标题】:Can I save a matplotlib animation to webm format?我可以将 matplotlib 动画保存为 webm 格式吗?
【发布时间】:2018-02-28 05:07:39
【问题描述】:

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

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

但我不知道该怎么做。

【问题讨论】:

标签: python animation matplotlib ffmpeg webm


【解决方案1】:

确保您有 ffmpeg compiledlibvpx(运行不带参数的 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):
    [...]

【讨论】:

    猜你喜欢
    • 2014-04-29
    • 2018-11-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-08
    • 2013-08-03
    • 2015-08-17
    • 2019-08-30
    相关资源
    最近更新 更多