I am using Paperclip 3.4 and Paperclip-ffmpeg 0.9.4. Here is my code in video.rb:
has_attached_file :file,
:url => '/:class/:id/:style.:extension',
:styles => { :thumb => { :geometry => "100x100#", :format => 'jpg', :time => 10 } },
:processors => [:ffmpeg], :swallow_stderr => false
When I try to upload a video, the error is
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
If I comment out or remove the styles line, the video is uploaded correctly. I tried changing the versions of the gems, to no avail.
Any pointers on why the styles hash is causing an issue?
Edit Replacing '#' with '>' seems to solve the issue, but I am not sure what is the cause.
In the official paper clip gem documentation (under the "Resizing options" section) you can found the following description:
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)
and as it is pointed there you can check for more options here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.