ruby-av / paperclip-av-transcoder

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

convert_options causes NoMethodError when only :input is defined #51

Open blakeloverain opened 7 years ago

blakeloverain commented 7 years ago

In: lib/paperclip/paperclip_processors/transcoder.rb

Around line 117:

def set_convert_options options
  return options[:convert_options] if options[:convert_options].present?
  options[:convert_options] = {output: {}}
  return options[:convert_options]
end

This fails to add :output to the convert_options when I only have :input defined, so I get this error:

NoMethodError (undefined method `[]=' for nil:NilClass):

paperclip-av-transcoder (0.6.4) lib/paperclip/paperclip_processors/transcoder.rb:37:in `initialize'

referencing:

 @convert_options[:output][:s] = format_geometry(@geometry) if @geometry.present?

A workaround for now is to just have a blank :output=>{} in my paperclip attachment definition, but the logic of assinging a default to the convert_options is erroneous.