Ruby on rails 活动存储:无法创建视频附件的图像预览

Ruby on rails 活动存储:无法创建视频附件的图像预览,ruby-on-rails,imagemagick,rails-activestorage,Ruby On Rails,Imagemagick,Rails Activestorage,我有一个Rails模型,它有一个视频活动存储附件。现在,当我想为这个附件创建一个图像预览时,预览看起来是创建的,但是结果是一个视频,而不是一个应该的图像。尽管代码没有改变,但整个过程一直持续到最近。我的代码如下所示: class MyModel < ApplicationRecord has_one_attached :video # The video attachment is fine and can be retrieved and viewed def get_prev

我有一个Rails模型,它有一个视频活动存储附件。现在,当我想为这个附件创建一个图像预览时,预览看起来是创建的,但是结果是一个视频,而不是一个应该的图像。尽管代码没有改变,但整个过程一直持续到最近。我的代码如下所示:

class MyModel < ApplicationRecord
  has_one_attached :video # The video attachment is fine and can be retrieved and viewed

  def get_preview
    if video.attached? and video.previewable? # => true
       img_preview = video.preview(resize: "800x1400").processed # Returns an active storage instance with the file type mp4 instead of the expected png thumbnail
       return img_preview.service_url # Fails with exception (see next snippet)
    end
  end

以前有人遇到过这种情况吗?Active Storage preview API的文档几乎不存在,因此我不确定从何处开始。

是否安装了FFMpeg?需要提取预览@arieljuod是的,安装了ffmpeg并且
哪个ffmpeg
返回有效路径
MiniMagick::Error: `identify -format %[orientation] /tmp/ActiveStorage20191128-4-1t9vihl.png[0]` failed with error:
2019-11-28T17:02:42.618871+00:00 app[worker.1]: identify-im6.q16: improper image header `/tmp/ActiveStorage20191128-4-1t9vihl.png' @