Converting MP3s to SWF

I’m working on a Rails app where one of the requirements is to convert MP3s to SWFs. The idea is the smaller filesize will lead to reduced bandwidth fees. This needs to be as close to real-time as possible, so I need a command line program I can call from my Rails app rather than a GUI app.

After several hours on google, I’ve found multiple Windows-based programs that allow me to do this on the command line, but since we’re going to be deploying on LINUX, they aren’t much help. Anyone have any experience in this area, or suggestions on how to proceed?

Any advice is much appreciated.

Cheers, Chris

SWF isn't an audio format. It is possible to embed audio inside an SWF file, but the audio is probably still mp3 encoded. What makes you think SWF is going to be less bandwidth?

If you want less bandwidth consider using lower bit-rates. AAC does good at low bit-rates, and there are plenty of encoders available (faac). Personally I prefer Vorbis so I don't have to handle licensing and patent fees.

~Rusty

Re-encoding MP3's to SWF files seems like more overhead than it's worth. The latest flash players can stream MP3's and you can encode any bitrate you want on the MP3 directly.

Thanks for your reply. I do realize that SWF isn’t an audio format. From several items I’ve read, however, it appears that SWF offers better audio compression that MP3s do, so converting to SWF should result in smaller file sizes.

Would you suggest instead of converting to SWF instead re-encoding the MP3 with a lower bit-rate? The final format must be importable by a Flash player.

Thanks, Chris

Thanks for your reply. I do realize that SWF isn't an audio format. From several items I've read, however, it appears that SWF offers better audio compression that MP3s do, so converting to SWF should result in smaller file sizes.

Since SWF isn't an audio format, the embedded audio is encoded in some other format. I would expect that format is MP3. So, if you are seeing smaller file sizes it is because the SWF file is at a lower bit- rate.

Would you suggest instead of converting to SWF instead re-encoding the MP3 with a lower bit-rate? The final format must be importable by a Flash player.

By separating the player from the audio you will save bandwidth over time as browsers cache your SWF player. In addition, MP3 leaves you with a more portable format should you decide to use something other than flash.

One problem that you are going to have either way if your source files are MP3, is degradation. If you start with a CD quality wav file and encode it to MP3 at 128bps, when you re-encode it down to 96bps you will have less quality than if you went straight from original wav to 96bps. Maybe this is acceptable for your purpose, but you may want to run some trials to see.

~Rusty

Our whole site (www.prx.org) is about playing audio, and we use mp3 - you don’t want the swf format for audio - it’s proprietary so I didn’t find a great reference on how they do this, but dimes to dollars all they are doing is embedding the audio in the file. From what I can tell, this is not a new audio format or encoding, just a way to package it.

We also use a Flash player for our mp3s - Flash plays mp3 files, there are free/open source flash players you can use for this.

If you want to reduce bandwidth fees, I recommend (as did the other responders) to use a reduced bit rate - keeps the files nice and small.

I wouldn’t go much below 96 myself, we use 128 for stereo mp3s.

You might also want to look at hosting your mp3s someplace with cheap bandwidth and lots of disk - we use amazon s3 to host/serve our audio.

Another option is to buy the flash media server, which gives you tons of control over the quality and size of streaming audio to flash clients, but this is not free, so do some research to figure out what you really need.

-Andrew

Just a point for clarification...

mp3 is also a proprietary format though it is so widely in use, people often think that there isn't a licensing requirement for its usage, but alas there is.

http://en.wikipedia.org/wiki/MP3#Licensing_and_patent_issues

Craig

Thanks for everyone’s suggestions. At this point it looks like going the Amazon S3 route is probably the best way to cut down on bandwidth while also keeping audio quality. We may look into the Flash Media Server at some point, but that’s a bit too pricey right now.

Cheers, Chris