Flash 10 supposedly has support for the Speex audio format. I'd like to embed some Speex files in my SWF:
[Embed(source='assets/test.spx',mimeType='audio/x-speex')]
private static const SpeexSound:Class;
However, I get the error:
no transcoder registered for mimeType 'audio/x-speex'
Any ideas?
Speex is not a real transport format -- it has no framing built into the protocol, so it is typically wrapped in an OGG stream (whose API is unfortunately more complicated than the Speex API itself, but I digress...) So "audio/x-speex" really means "Speex in OGG".
I haven't seen anywhere that Flash supports OGG -- so those files you get from
speexenc
aren't going to work :(Reportedly Flash encodes/decodes Speex in FLV format (according to this page: http://jira.red5.org/confluence/display/codecs/Speex+Codec). I haven't tried this because I want to target Flash 9 (maybe ffmpeg would encode correctly with some fiddling) but let me know if you get anywhere with this.
On the server-side, you can use this tricked-out ffmpeg project:
http://code.google.com/p/xuggle-ffmpeg/
And encode your audio something like this:
I've been researching this some more. Here are the options:
You can't embed FLVs, but you can embed SWFs, so convert a Speex FLV into a Speex SWF. The conversion can be done with ffmpeg like this:
However, that will unfortunately auto-convert the audio into MP3 inside the SWF. You should be able to preserve the codec like this
but ffmpeg doesn't currently support non-MP3 SWFs. Grr. Perhaps there's other conversion tools that will do it?