【问题标题】:Python (SciTools) - error in the encoder when trying to make a movie (cannot save)Python(SciTools) - 尝试制作电影时编码器出错(无法保存)
【发布时间】:2013-07-12 12:33:42
【问题描述】:

我正在学习如何使用 Python 编程,并且一直在阅读 Langtangen 的 A Primer on Scientific Programming with Python。这本书是指一个网站,其中发布了书籍示例或工作代码示例/程序 (http://hplgit.github.io/scipro-primer/),其中还有一对使用 SciTools (EasyViz),生成几个绘图然后尝试将它们保存在一个 .gif 文件(我猜这是电影的默认输出格式)。

问题是我在运行程序时遇到错误。我通过更改数字看到了演变,但最后当程序应该将这些 .png 文件保存到电影中时,我收到以下错误消息:

Found 73 files of the format tmp_*.png.
scitools.easyviz.movie function runs the command: 
convert -delay 50 tmp_*.png tmp_heatwave.gif
Invalid Parameter - 50

scitools.easyviz.movie could not make movie
Traceback (most recent call last):
File "D:\Workspaces\Eclipse Python Workspace\Book Examples\src\plot\heatwave.py", line 41, in <module>
output_file='tmp_heatwave.gif')
File "C:\Python27\lib\site-packages\scitools\easyviz\movie.py", line 1151, in movie
me.encode()
File "C:\Python27\lib\site-packages\scitools\easyviz\movie.py", line 153, in encode
raise SystemError('Check error messages from the encoder in the terminal window')
SystemError: Check error messages from the encoder in the terminal window

我查看了电影模块中的代码,参数 50 似乎是指以 fps 为单位的延迟。例如,在另一个示例程序中,它设置为 4,您也会得到相同的返回消息。如果我在 SciTools 包本身实现的模块中删除该延迟线,错误将显示为:

Invalid Parameter - tmp_heatwave.gif

谁能告诉我发生了什么事?我没有更改代码,我确定它是正确的,但我无法按我应该的方式保存电影!

【问题讨论】:

    标签: python gif encode movie


    【解决方案1】:

    我遇到了同样的麻烦(也是从同一本书中学习的)。
    对我来说,这发生在我运行 bisection_movie.py 文件时。

    在我的情况下,我解决它的方式如下:

    1. 在下面的网站中,他们提到我需要安装 ImageMagick 软件,所以我安装了它following the instructions listed here

    2. 然后,我用 ImageMagick 安装了名为 Python Magick 的 python 接口(不知道是否需要,但我仍然需要)。

    3. 在这一切之后,我仍然遇到了麻烦,我决定按照错误消息的建议来检查命令窗口是否有来自编码器的错误消息。它很长,但其中一篇说

      No such file or directory @ error/ps.c/ReadPSImage/837

    4. 在线查看这个错误后,我发现我仍然缺少“Ghostscript委托库”(不要问我它是什么,我不太清楚)。在为 Windows 安装 Ghostscript 委托库之后(32 位,因为那是我的 python 版本)。它得到了解决,它能够创建电影。

    我建议先安装 ghostscript 委托库并检查是否足够。如果是,请回复它有效,这样我就知道我所做的所有该死的事情,是什么使代码有效。

    【讨论】:

    • 谢谢。我目前没有时间检查,自从我上次用 Python 编程以来已经很长时间了,所以这就是我还没有接受你的答案的原因。不过,我很感激您的意见,并会在我检查后立即接受您的回答。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-09-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多