View Full Version : how to play embedded (HE-)AAC?
aho
July 22nd, 2008, 01:29 AM
Embedding works like this:
[Embed(source = 'foo.mp4', mimeType = "application/octet-stream")]
private var musicClass:Class;
private var music:Video=new musicClass() as ByteArray;
Using the correct mime type (video/mp4) doesn't work by the way.
Unfortunately the Sound class is somewhat restrictive - it's only capable of playing mp3 files. Why's that?
So, one gotta use Video, but that one wants a NetStream. Why aren't there usual streams and convenient streams such as Java's ByteArrayInputStream? That would solve all my problems.
Is there any workaround for this or is it completely impossible?
(Obviously I would like to use it for game BGM. MP3 requires much higher bitrates whereas you can get away with 25kbits with HE-AAC. Sure - it will sound a bit washed out, but it won't make your ears bleed like 64-96kbits MP3s.)
Edit: as2-/as2 tags don't work.
dthought
July 22nd, 2008, 08:29 AM
Sorry, Flash only supports MP3, not AAC / MP4. Similar reasons as to why it currently also only supports Flash Video, not MPG / QT / AVI etc. natively, I'd imagine - overheads and player plug-in size considerations. There may also be licensing considerations, but I'm not too familiar with that.
Flash AS3 is powerful, but it's not as fully fledged as Java. If you want Java-like power... well, use Java :) You don't get much access to the system outside of what AS3 provides when it comes to writing to the speakers etc. - maybe they'll allow this in the future, and you could write your own AAC decoder in AS :)
wvxvw
July 22nd, 2008, 11:48 AM
Sorry, I havn't tried embedding sounds other than mp3, but... I'm sure You can play AAC encoded audio if it's not embedded (so, may be it's possible to trick the player somehow)...
To play it you have to stream video mp4 with no actual video data, just audio channels =) BTW, in Astro (FP 10) you may sinthetize sounds, but I didn't tried it yet too, just watched the promo =)
aho
July 22nd, 2008, 03:04 PM
>Sorry, Flash only supports MP3, not AAC / MP4.
(HE-)AAC and H.264 support was added with Flash 9.0 r115 (9,0,0,115). Together with that they added support for MP4, M4A, MOV, MP4V, 3GP, 3G2, etc. containers.
Playing external MP4s (say with only an HE-AAC audio track) is possible. But I'd prefer to have everything in a single file.
>maybe they'll allow this in the future, and you could write your own AAC decoder in AS
You already could do this right now. Some people wrote MOD players with AS3 for example. However, a (HE-)AAC decoder in AS3 would be far too much work and of course it would be also silly to replicate functionality which is basically already there. Additionally, it would probably take too much CPU and there is no way to offload it to another thread (core) since there is no multithreading in AS.
MP3 is far bigger and yet there are rather painful artifacts. LAME also adds a tiny amount of silence at the beginning and at the end, which apparently breaks loops. I'm not sure if this is an issue with LAME or if it's a general MP3 limitation. This issue doesn't exist with other formats such as Ogg Vorbis, FLAC, WAV, SHN, TTA, WV, MPC, SPX or well, AAC.
Uhm... ok... I just heard that it's a general MP3 issue. The silence padding is by design. Fortunately there is some workaround for that (at least):
http://www.compuphase.com/mp3/mp3loops.htm
aho
July 22nd, 2008, 06:36 PM
Unfortunately mp3loop doesn't seem to work correctly.
I can't believe that something as simple as that is such a big deal. It's ridiculous.
dthought
July 23rd, 2008, 10:51 PM
(HE-)AAC and H.264 support was added with Flash 9.0 r115 (9,0,0,115). Together with that they added support for MP4, M4A, MOV, MP4V, 3GP, 3G2, etc. containers.
Playing external MP4s (say with only an HE-AAC audio track) is possible. But I'd prefer to have everything in a single file.
Well, that's interesting. I wasn't aware of that :) Thanks for the info. That's bizarre then that if they've added containers, they didn't just do that first (ie. developing FLV as a format for video instead of just supplying a MOV container).
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.