【问题标题】:Matplotlib Animation - trouble with the speed of the saved fileMatplotlib Animation - 保存文件的速度问题
【发布时间】:2014-05-02 19:52:16
【问题描述】:

我正在尝试使用Python-Matplotlib 制作动画。

我正在使用本教程:

http://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial/

当我刚刚执行时,第一个示例中的动画效果很好 Python 脚本,但是为了能够保存它 (anim.save command), 我不得不添加 'writer=animation.FFMpegFileWriter()' 作为参数。然而现在 保存的文件播放速度比原始文件慢很多。其实视频 总是 40 秒长,无论我在 FuncAnimation 对象。

关于如何解决此问题的任何建议?

感谢您的帮助:)

【问题讨论】:

    标签: python animation matplotlib save


    【解决方案1】:

    我在使用 FFMpeg 保存时遇到了类似的问题。

    对我有用的解决方案是修改

    writer=animation.FFMpegFileWriter()
    

    阅读

    writer=animation.FFMpegFileWriter(fps=n)
    

    其中 n 是您想要的每秒输出帧数。

    【讨论】:

      【解决方案2】:

      您必须指定所需的每秒帧数作为参数:

      anim.save('filename.mp4', fps=120, writer=animation.FFMpegFileWriter())
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-04-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-01-30
        • 1970-01-01
        • 2010-12-06
        • 1970-01-01
        相关资源
        最近更新 更多