I cannot get the paperclip processor pasted below to work. I have many
more that look almost identical. The ffmpeg command works on the
command line. One thing unusual is that when it fails it reports that
file name like, iv,8595,0, instead of the actual file basename. Any
help would be greatly appreciated
module Paperclip
class AudioProcessor < Processor
attr_accessor :whiny
def initialize(file, options = {}, attachment = nil)
super
@whiny = options[:whiny].nil? ? true : options[:whiny]
@basename = File.basename(file.path, File.extname(file.path))
end
def make
dst = Tempfile.new([ @basename, 'mp3' ].compact.join("."))
dst.binmode
cmd = %Q[-i #{File.expand_path(@file.path)} ]
cmd << %Q[-f mp3 -vn -acodec ]
cmd << %Q[copy #{File.expand_path(dst.path)}]
Rails.logger.info cmd
begin
success = Paperclip.run('ffmpeg', cmd)
rescue Exception => e
raise PaperclipError, "There was an error processing the
thumbnail for #{@basename}" if whiny
end
dst
end
end
end