Skip to content

pacso/paperclip-wav-mp3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages