2013-02-20 51 views
3

我正在使用Paperclip 3.4和Paperclip-ffmpeg 0.9.4。 這是我在video.rb代碼:上傳視頻時縮略圖樣式的回形針-ffmpeg錯誤

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 

如果我註釋掉或刪除樣式線,視頻被上傳正確。我試圖改變寶石的版本,但無濟於事。

任何關於爲什麼樣式哈希導致問題的指針?

編輯 用'>'替換'#'似乎解決了這個問題,但我不確定是什麼原因。

回答

1

在官方回形針寶石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