I have the following Model which has an accessor that receives an audio file with WAV format and then stores it
class Audio < ActiveRecord::Base belongs_to :contribution belongs_to :recorder dragonfly_accessor :audio, :app_name => :videos do storage_options do |audio| { path: "audios/#{audio.name}" } end end end
What I want to do is to convert this audio from WAV to MP3 before saving it.
1 Answers
Answers 1
Dragonfly cannot do it by default, you need to add a custom processor and probably use some command line tool for it, here's a few examples
So if you go with one of the top responses from that thread and use libav-tools your custom processor will look something like this (you might also need to change new_path file extension to .mp_3):
processor :to_mp3 do |content| content.shell_update do |old_path, new_path| "avconv -i #{old_path} #{new_path}" end end
0 comments:
Post a Comment