MpegHelper

MpegHelper is a gem, mostly for my own use that takes mp3’s and mp4’s performs certain tasks on them.

Dependencies

mpgtx (For cutting, trimming mp3’s) faad (to change mp4’s to mp3’s) lame (For re-enconding mp3’s) ruby-mp3info (Reading and writing mp3 tags) MP4Info (Reading and writing mp4 tags including artwork) rmagick and imagemagick (Getting with and playing covers) eyed3 (For getting mp3 artwork)

Install

To install MpegHelper simply..

gem sources -a gems.github.com (you only have to do this once)

sudo gem install arbarlow-mpeghelper

Usage

Essentially there are 3 (soon to be 4) methods, theres are…

MpegHelper.mp3 (Takes an mp3 file, if it matches the bitrate given is returns tag info, if not, its converts to that bitrate then returns info) MpegHelper.mp4_to_mp3 (Takes an mp4 file and converts it to an mp3 file of desired bitrate and keeps all info and artwork!) MpegHelper.mp4_to_mp3_artwork_output (Does the same as above method however it also outputs the artwork to 1 or more files of the dimensions you choose)

Examples

Assuming your in the directory of the mp3s and thats where its working…

song = MpegHelper.mp3(‘1.mp3’, ‘2.mp3’, ‘192’) input, output(if transcoded), bitrate song = MpegHelper.mp4_to_mp3(‘1.m4a’, ‘1.mp3’, ‘192’) input, output, bitrate song = MpegHelper.mp4_to_mp3_artwork_output(‘1.mp3’, ‘2.mp3’, ‘192’, ‘extracted-cover.jpg’, [[50,50], [100,100], [200,200]]) input, output, bitrate, covername, sizes(an array of [width, height] arrays)

Coming Soon

I’m adding the ability to cut and crop mp3’s, to make samples etc.