Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flash/Flex Speex audio decode, to play a speex file

I want to play *.spx files which encoded by Speex on the Web.
But I have no knowledge of Flash/Flex or any Flash Audio codec. After Google search for a whole day, I got some solutions, that is:

  1. Do something wrapping Speex files with a FLV container because that the Speex is only playable as the audio codec in a FLV container.
    Now I can play a SPX-Audio-Only FLV file in Flex, I use netStream.play("audio-only-speex.flv"), But I donot know how to wrap a Spx file with FLV container using ActionScript.
    Any example project?

  2. Decode Spx using AS.
    I checked out the fllowing pages that they all decoded OGG Vorbis but no Speex :(
    http://barelyfocused.net/blog/2008/10/03/flash-vorbis-player
    http://www.exswap.com/?p=132
    http://mauft.com/2010/11/ogg-vorbis-in-flash
    Adobe also provides a AS3 OggVorbis Library which ported by Alchemy:
    http://labs.adobe.com/wiki/index.php/Alchemy:Libraries

  3. FMS: do a server streaming using FMS or Red/Xuggle. I have never heard FMS stuffs before, as well as I'm not sure whether my virtual host can support or not...

  4. Convert every Spx files to MP3.

I think the best solution is decoding Spx in AS3, Yes, I'd like to make a Spx Flash Player.

So, I downloaded Speex Library from speex.org, installed Adobe Alchemy. After ./configure;make the libspeex, build libspeex/speex.c out a libspeex.swc via Alchemy. then, I donot know how to do next. How can I decode the speex audio with AS3?
My libspeex.swc: http://demo.0x123.com/libspeex.swc

In addtion, should I rewrite the libspeex using Alchemy API before build the libspeex.swc?

Although I am not professional in AS, but I have a strong ability to learn. Any advice will be greatly appreciated, Thanks very much.

like image 544
Elf Sundae Avatar asked Nov 14 '22 13:11

Elf Sundae


1 Answers

Adobe says specifically not to rely on Alchemy yet, so there's no official way to do it on the client side (as far as I know.) It's absurd given that there is clearly a speex decoder being used.

Can you use Xuggle's tricked-out version of ffmpeg (http://code.google.com/p/xuggle-ffmpeg/) to embed the speex in FLVs? If you can run xuggle in batch or on the fly, then regardless of the original audio format, you can serve a speex encoded FLV, playable from netStream.play.

ffmpeg -i test.wav -acodec libspeex -f flv -y speex.flv

For basic playing, you wouldn't even need a flash media server.

like image 121
Ian McGraw Avatar answered Nov 16 '22 04:11

Ian McGraw