【问题标题】:Paperclip-ffmpeg error with styles for thumbnail when uploading video上传视频时缩略图样式出现回形针 ffmpeg 错误
【发布时间】:2013-05-07 04:57:47
【问题描述】:

我正在使用 Paperclip 3.4 和 Paperclip-ffmpeg 0.9.4。 这是我在 video.rb 中的代码:

has_attached_file :file,
                :url => '/:class/:id/:style.:extension', 
                :styles => { :thumb => { :geometry => "100x100#", :format => 'jpg', :time => 10 } }, 
                :processors => [:ffmpeg], :swallow_stderr => false

当我尝试上传视频时,错误是

Command 'ffmpeg -ss 10 -i :source -y -vf scale=100:-1,pad=100:100:0:12.5:black -vframes 1 -f image2 :dest' returned 1. Expected 0

如果我注释掉或删除样式行,则视频已正确上传。我尝试更改 gem 的版本,但无济于事。

关于样式散列为什么会导致问题的任何指针?

编辑 将 '#' 替换为 '>' 似乎可以解决问题,但我不确定是什么原因。

【问题讨论】:

    标签: ruby-on-rails paperclip


    【解决方案1】:

    在官方回形针 gem documentation(在“调整大小选项”部分下)可以找到以下说明:

    Default behavior is to resize the image and maintain aspect ratio (i.e. the :medium version of a 300×150 image will be 200×100). Some commonly used options are:
    
    trailing #, thumbnail will be centrally cropped, ensuring the requested dimensions.
    trailing >, thumbnail will only be modified if it is currently larger requested dimensions. (i.e. the :small thumb for a 120×80 original image will be unchanged)
    

    正如它所指出的那样,您可以检查更多选项here

    【讨论】:

      猜你喜欢
      • 2013-10-16
      • 2014-08-19
      • 2018-12-21
      • 1970-01-01
      • 2013-10-13
      • 2019-06-08
      • 2012-11-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多