views:

2397

answers:

6

Dear All, I'm wondering about MP3 decoding/encoding, and I was hoping to pull this off in Flash using AS3

I'm sure it'll be a right pain...

I have no idea where to start, can anyone offer any pointers? reference material?

----much later--- Thank you all very much for your input... It seems I have a long road ahead of me yet!

A: 

See LAME MP3 Encoder. You can checkout their source code and their link page. Mpeg.org should have documents too.

eed3si9n
A: 

It's going to be VERY slow doing this in AS3. You really need a C/C++ implementation if you care at all about how long it will take.

Mark Ingram
A: 

Andre Michelle and the Hobnox guys pulled off something similar with their Hobnox AudioTool, they ported a Java Vorbis encoder to AS3. They supposedly ended up with encoding taking twice the time of the audio duration.

Don't know what your use case is, but in the Hobnox tool apparently audio is created at the client side, encoded as Vorbis, sent to the server, converted to mp3 and stored in the users library.

Kristian J.
+2  A: 

You could also theoretically do this as a PixelBender filter, and should get significantly better performance than using a pure ActionScript 3 implementation.

More info on PixelBender here:

http://labs.adobe.com/wiki/index.php/Pixel_Bender_Toolkit

mike chambers

[email protected]

mikechambers
Bear in mind, of course, that PixelBender doesn't run in the video card. But yes, much faster than as3!
aaaidan
+1  A: 

I've got a project converting WAV files (actually Asterisk voice mails) into MP3's. If I remember correctly there are some oddities about Lame's license, so I've downloaded and compiled first LAME, then SOX by hand.

I have a web process written in PHP to actually convert the files from WAV to MP3 on the web server's local file system (actually PHP is just supervising the command-line sox tool via exec()). Then I attach all the metadata the MP3 needs using the PEAR Mp3_Id package.

Then I move the newly constructed MP3 file into a folder Apache is sharing, and point the outstanding SoundManager2 flash-based MP3 player at it.

For small transactions this works very well -- converting a minute or two voice mail does not add any appreciable lag to actually rendering and returning the rest of the page. As I get more users on a single server, it will probably eventually become necessary to write a cron job or something to do the conversion before the user actually asks for the file the first time.

Jeremy Wadhams
+3  A: 

this would help http://labs.adobe.com/technologies/alchemy/