No release in over 3 years
Low commit activity in last 3 years
Paperclip processor to convert WAV format audio to MP3 using ffmpeg
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 4.3.6
 Project Readme

paperclip-wav-mp3 Gem Version

Paperclip processor to convert .wav files to .mp3 using ffmpeg

Requirements

Paperclip

This is a processor written for the quite excellent Paperclip gem by ThoughtBot. You will need to be using Paperclip to use it.

FFmpeg

FFmpeg is used to convert WAV audio to MP3. It must be installed within your environment and available on your PATH.

OS X

If you're developing on OS X, you can install FFmpeg using homebrew:

brew install ffmpeg

Ubuntu Linux

I've not tested on other linux distributions, but you can install FFmpeg and the required codecs with the following:

apt-get install ffmpeg libavcodec-extra-52 libavdevice-extra-52 libavfilter-extra-0 libavformat-extra-52 libavutil-extra-49 libpostproc-extra-51 libswscale-extra-0

Installation

This processor is distributed as a gem, which is how it should be used in your app.

Include the gem in your Gemfile:

gem 'paperclip-wav-mp3', '~> 0.1'

Once you've installed the gem, update the model which uses Paperclip to attach audio to add the processor:

class Voicemail < ActiveRecord::Base
  has_attached_file :audio,
                    styles: { mp3: {} },
                    processors: [:ffmpeg_wav_to_mp3]
end

Now, when you attach a new WAV audio file, you will also create an MP3 version.

To generate the missing MP3 versions for files you've already attached you can use this paperclip rake task:

rake paperclip:refresh:missing_styles

Contributing

Feel free to raise any issues you have here, or if you're feeling generous then just send a pull request with your new feature/bugfix.

License

Copyright (c) 2014 Jon Pascoe.

This is free software and may be redistributed under the terms and conditions of The MIT License (MIT). Full details are available in the LICENSE file.