如何使用魔杖创建视频缩略图?

时间:2016-05-15 14:07:51

标签: python imagemagick wand

我想用魔杖创建视频缩略图 我尝试运行以下命令:

>>> from wand.image import Image
>>> vid = Image(filename='example.mp4')

但是我收到一条错误消息:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/leiz/.local/lib/python2.7/site-packages/wand/image.py", line 2534, in __init__
    self.read(filename=filename, resolution=resolution)
  File "/home/leiz/.local/lib/python2.7/site-packages/wand/image.py", line 2601, in read
    self.raise_exception()
  File "/home/leiz/.local/lib/python2.7/site-packages/wand/resource.py", line 222, in raise_exception
    raise e
wand.exceptions.BlobError: unable to open image `/tmp/magick-24346h472NGIWl2wR.pam': No such file or directory @ error/blob.c/OpenBlob/2709

我确定该文件&#39; example.mp4&#39;存在,它让我很困惑。

1 个答案:

答案 0 :(得分:0)

您似乎需要安装应用程序。 ImageMagick通过调用以下

.mp4个文件传递给委托
"ffmpeg" -nostdin -v -1 -i "%i" -vframes %S -vcodec pam -an -f rawvideo -y "%u.pam" 2> "%Z"

因此,如果未安装ffmpeg,则唯一的中间文件不存在,您将看到消息

unable to open image [PATH]: No such file or directory @ error/blob.c/OpenBlob/2709

甚至

delegate failed [COMMAND] @ error/delegate.c/InvokeDelegate/1332.