Hello all,
Well I've been wanting to convert all my music from mp3 to ogg and quickly found that there was no real easy way to do it. So I made a small command line utility to do exactly that. Because I really hate mp3 and proprietary formats because they are such a pain in the butt and in the US (as far as I know) they are illegal or so I thought. Well anyway, I was just reading reading the topic about how many songs you have in your library and I think everyone who replied to that topic had their entire library in mp3 and Im sure that alot of people would like to support the open format, if it were only easier.
So I called my utility am2o (auto mp3 to ogg) and its written in PHP (no it does NOT require a webserver what so ever, its a command line utility). I purposely wrote it in PHP to show people that PHP is just like any other scripting language and to debunk the misconception that its only for websites. It also wraps around ffmpeg to do the transcoding.
My personal need for it was to take all the music that I download from gnutella (frostwire/limewire/gtk-gnutella/etc) and convert it to ogg and put it in my music directory and when you download alot of mp3's you keep them in the same folder and when you rerun the command you dont want to re-transcode all of the music thats already transcoded, so it supports filename caching for each unique directory. You may optionally disable caching as well.
To run it you need the ffmpeg and php5-cli packages from the repository. You can get them from Synaptic, or by command line.
Code:
sudo apt-get install ffmpeg php5-cli
The package itself is attached to this post. To install it just unpack the tarball then run:
Code:
cd am2o
sudo ./install.sh
Examples on how to use the program are included in the readme but heres one for a quickstart, its really easy.
Code:
am2o -i ./Shared -o ./Music
We use -c to enable filename caching (this flag is require, to disable use -c=no), and ./Shared is our input folder (where we will pull mp3's from) and ./Music is the output folder (where we put the transcoded ogg's).
NOTE: As of version 0.2, the -c flag is no longer required and will automatically default to yes if left out.
If you have a big music library that you are transcoding, and you have a multi or dual core CPU system, I dont recommend running multiple instances as this will probably cause it to clash if you are running it on the same directories. Maybe in the future, if people like this tool, I will add support for multiple ffmpeg instances to encode multiple files at a time.
I hope this tool inspires you to convert to and use ogg to support it as an open format.
[Edit]
I have released am2o v0.2 with support for lossless flac and flexible flags and arguments. You may use all flags/arguments in any order but you must use the -i and -o flags to specify input and output directories respectively. The default transcode format is ogg, if you would like to transcode to flac, you must use the '-f flac' flag. Refer the '-h' or the readme for more information.
Enjoy!
-maddog39
Bookmarks