title: Convert WAV into MP3 using FFMPG with the carrier_wave gem
body: <p>Inside my "wave_uploader.rb" script I have the following code:</p>
  
  <pre><code>class PictureUploader &lt; CarrierWave::Uploader::Base
    include CarrierWave::MiniMagick
    include CarrierWave::MimeTypes
  
    version :wav do
      process :convert_to_mp3
  
      def convert_to_mp3
        temp_path = Tempfile.new([File.basename(current_path), '.mp3']).path
  
        `ffmpeg -t 15 -i #{current_path} -acodec libmp3lame -f mp3 #{temp_path}`
  
        File.unlink(current_path)
        FileUtils.mv(temp_path, current_path)
      end
  
      def full_filename(for_file)
        super.chomp(File.extname(super)) + '.mp3'
      end
    end
  </code></pre>
  
  <p>I am trying to convert the WAV file into a 20 second MP3 file and delete the WAV file once it is converted. The code above runs but I can't find the converted MP3 file so I am guessing it did not work correctly. </p>
  
  <p>At the end of wave_uploader.rb I have code that returns the unique name once it is processed but I commented out the code out thinking the code below was causing the WAV file not to be converted to an MP3.</p>
  
  <pre><code># def filename
  #   "#{secure_token}.#{file.extension}" if original_filename.present?
  # end
  
  # def secure_token
  #   var = :"@#{mounted_as}_secure_token"
  #   model.instance_variable_get(var) or model.instance_variable_set(var, SecureRandom.uuid)
  end
  </code></pre>
  
  <p>Any help would be greatly appreciated on how to get this working right.   </p>