ruby-av / paperclip-av-transcoder

Audio/Video Transcoder for Paperclip using FFMPEG/Avconv
MIT License
135 stars 83 forks source link

Thumb not resizing to requested geometry #9

Closed mrmanishs closed 9 years ago

mrmanishs commented 9 years ago

Hi there,

I have the following in my paperclip definition: has_attached_file :video, :default_url => '/filetype-icons/filetype-unknown.png', :styles => { :thumb => { :geometry => "32x32>", :format => 'png', :time => 10 } }, :path => ":rails_root/public/apartment_files/:attachment/:id_partition/:style/:filename", :url => "/apartment_files/:attachment/:id_partition/:style/:filename", :processors => [:transcoder]

However, when transocding, the thumb does not transcode to 32x32. Instead it goes to 1920x1080. What could I be doing wrong?

cjeffries commented 9 years ago

Currently the gem doesn't include the geometry options in the conversion output. To include it in there you can change your code to:

has_attached_file :video, 
:default_url => '/filetype-icons/filetype-unknown.png', 
:styles => {
:thumb => { :geometry => "32x32>", :format => 'png', :time => 10, :convert_options => {:output => {:s => "32x32"}} }
}, 
:path => ":rails_root/public/apartment_files/:attachment/:id_partition/:style/:filename", 
:url => "/apartment_files/:attachment/:id_partition/:style/:filename",
:processors => [:transcoder]

N.B. I'm yet to test if this will also adhere to the !#<> options you provide in the geometry option. Do not include them in the extra convert_options hash, because it will crash the gem. This is obviously not ideal, but better than having 1080p thumbnails.

owahab commented 9 years ago

Fixed in #11

mrmanishs commented 9 years ago

This works perfectly. Thank you for the fix.