Log in

View Full Version : MPEG-4 ALS (Audio Lossless Coding)


Zero1
21st January 2006, 16:20
Firstly due to the nature of this post, I realise that it might have been better off at HydrogenAudio, but for a few reasons decided it would perhaps be more beneficial posted here (since a lot of devs browse Doom9)

Recently I was checking the sourceforge page for MP4Box feature requests since I was checking if the Variable Frame Rate request had been updated, and whilst I was there I noticed an MPEG-4 Audio Lossless support request, by Kurtnoise13 (hi, if you're reading).

Curious, I checked out the request and the link inside. This was news to me, a lossless audio codec that had been approved as part of the MPEG-4 standard. The possibilities are great, I imagine being able to encode lossless H.264 and ALS and muxing to MP4 for archiving masters of my home made music videos. I'm no audiophile, but quality matters for my masters since I invariably will re-encode them at some time. It also means the possibility of storing all your favourite tracks losslessly onto disc and playing them in your HD-DVD players, hooked up to your stereo (assuming they will support ALS, remains to be seen though).

So what is the purpose of this thread? To raise awareness of this interesting new standard, and hopefully gain interest from developers.

We can already encode MPEG-4 ALS by use of the reference encoder found below (includes binary and source), there is also some nice information.

MPEG-4 ALS Information (http://www.nue.tu-berlin.de/forschung/projekte/lossless/mp4als.html)
MPEG-4 ALS Reference encoder (http://www.nue.tu-berlin.de/forschung/projekte/lossless/mp4als.html#downloads) (can also decode to PCM I believe).

Currently I do not seem to be able to find a directshow decoder, probably because one doesn't exist yet. Perhaps someone is willing to take a look into it? Or is there a specific way to put forward requests or suggestions to FFMPEG (didn't seem to find any)? I'm guessing and hoping that the source for the decoder as included in the reference software will be of use or interest in making a functional directshow decoder.

The next thing would be the optional muxing and parsing of ALS in the MP4 container. I assume that the reference software, as well as a decoder, also includes some source for parsing the ALS files or obtaining the headers etc. This might be of use to Haali and/or Gabest, since these are currently viable, opensource MP4 splitters :)

Again with regards to the source code, I guess there is something in there that would assist jeanlf should he decide to add MPEG-4 ALS muxing into MP4Box. Failing that, maybe even the parser or test files would be helpful, I believe I read something along the lines of one of the FFMPEG guys reverse engineering the file format.

Anyhow, I appreciate that people have lives and will only implement what they consider worthwhile, so I'll post some links and references in case any other willing and able person is wanting to have a try at writing something.

NEAsia Online Topstory about MPEG-4 ALS (http://neasia.nikkeibp.com/topstory/003092)
Investors Bussiness Daily's story on ALS (http://www.investors.com/breakingnews.asp?journalid=33709263&brk=1)
Hydrogen Audio thread & Garf's optimized builds of the reference encoder (http://www.hydrogenaudio.org/forums/index.php?showtopic=40451&st=0)
Some (maybe indirectly related) references from Fraunhofer (MPEG-4 SLS, not ALS!) (http://www.iis.fraunhofer.de/amm/projects/mpeg4audio/#aacscal)
A little on MPEG-4 SLS (http://www.chiariglione.org/mpeg/technologies/mp04-sls/)

Yes, as mentioned in that last link, there is also MPEG-4 SLS, however I do not know the differences between this and ALS. I'm guessing ALS is the seperate, lossless encoder, and SLS is the extention to AAC that will be perceptually lossless or something.

If anyone knows the main differences (explained in near laymens terms :p), or can point me in the way of something good to read, it would be appreciated.

Cheers

tedgo
21st January 2006, 19:28
My dreams would also come true with:
1.) Muxing MPEG-4 ALS with mp4box (and yamb!)
2.) Parsing with haali's media splitter
3.) Decoding with ffdshow (or any other directshow-decoder)
4.) MPEG-4 ALS support in foobar

Especially since garf optimized the reference encoder for speed, MPEG-4 ALS as specified as lossless audio solution for MP4 could be the first choice for lossless audio coding in the future.
Its compression ratio is impressive compared to flac, wma lsl, alac or others (but close behind monkey's audio or optimfrog).

Too bad, that its not really usable without parser/decoder...

BoNz1
22nd January 2006, 08:20
Guys, you're getting a bit ahead of yourselves since the specifications for how to place ALS in mp4 have not been finalized, so till that happens I wouldn't expect to see muxers like mp4box or demuxers like haali's splitter supporting it. But who knows someone might write a plugin for foobar before that.

ALS for the most part isn't too interesting as there are a lot of other lossless codecs out there which compress equally well. Where it is interesting is the multichannel lossless. The only other lossless codec I know of which can do this efficiently is MLP which is damn expensive and you need to use hacked binaries to play it. ALS looks as good or better. Just think you can now recompress your DVD-A to a format you can actually play on your computer.

tedgo
22nd January 2006, 12:31
Where it is interesting is the multichannel lossless. The only other lossless codec I know of which can do this efficiently is MLP which is damn expensive and you need to use hacked binaries to play it.
Have you ever tried wavpack?
It is very flexible and compresses multichannel with nearly all resolutions and sampling rates. But might not be as effective as MPEG-4 ALS. I haven't tried it for multichannel so far...

But i think that MPEG-4 ALS could be very interesting once it can be muxed into mp4 and at least played through directshow on pc.
So let us dream... ;)

Kurtnoise
22nd January 2006, 16:49
My dreams would also come true with:

Especially since garf optimized the reference encoder for speed, MPEG-4 ALS as specified as lossless audio solution for MP4 could be the first choice for lossless audio coding in the future..
The more important thing is the decoding part. This is too slow for the moment. This part needs some tunings before to create some goodies.

bond
22nd January 2006, 16:54
a filesize comparison with the als reference encoder:
http://uclc.info/lossless_audio_compression_test.htm

if the reference is that good already, i assume more tuned encoders will provide even better results

tedgo
22nd January 2006, 17:40
The more important thing is the decoding part. This is too slow for the moment.
This is not true.
With default settings MPEG-4 ALS decoding is about as fast as WavPack "Fast" on my system, with Garf's suggested settings for "High" and "Extra High" decoding is about as fast as WavPack "Normal" and WavPack "High", with similar compression ratio. And this already without Garf's optimization.
Only the extra encoding options are much too slow at the moment, but MPEG-4 ALS can reach a compresion ratio similar to optimfrog with these options. And optimfrog isn't really faster...

bond
22nd January 2006, 17:52
he meant decoding. like realtime playback aso

BoNz1
22nd January 2006, 17:55
Have you ever tried wavpack?
It is very flexible and compresses multichannel with nearly all resolutions and sampling rates. But might not be as effective as MPEG-4 ALS. I haven't tried it for multichannel so far...

Of course, I've tried probably every single commonly used lossless codec out there. None seem to do nearly as well on multichannel. Have a look here http://www.hydrogenaudio.org/forums/index.php?showtopic=40124 it clearly beats wavpack and flac by a large margin. Sure it is only one sample, but I bet it is fairly representative.

tedgo
22nd January 2006, 17:59
he meant decoding. like realtime playback aso
I know. I wrote about decoding.
But the extra encoding options slows down decoding too, therefore i mentioned them.

Kurtnoise
22nd January 2006, 20:28
With default settings MPEG-4 ALS decoding is about as fast as WavPack "Fast" on my system, ..
not mine...

tedgo
22nd January 2006, 20:59
@Kurtnoise13
Oops, sorry, my fault...
I meant:
MPEG-4 ALS "Fast" (-o5) (as suggested by Garf) is about as fast as WavPack "fast"
"Default" is about as fast as WavPack "Normal"
"High" (-a -o30) is about as fast as Wavpack "High"
"Extra High" (-a -b -o50) is about 20% slower than WavPack "High".
So MPEG-4 ALS is about as fast as WavPack in decoding. And WavPack is said to be one of the fastest lossless codecs in decoding.

I mistook the lines of the chart in my own little comparison... :o
Sorry again.

Zero1
24th January 2006, 00:38
Guys, you're getting a bit ahead of yourselves since the specifications for how to place ALS in mp4 have not been finalized
My, we are getting a bit ahead of ourselves, I thought everything pertaining to ALS (or mostly everything) had been finalised already. Thanks for the info though. Still, no harm in wanting or someone working on an ALS decoder now is there? ;)


ALS for the most part isn't too interesting as there are a lot of other lossless codecs out there which compress equally well. Where it is interesting is the multichannel lossless. The only other lossless codec I know of which can do this efficiently is MLP which is damn expensive and you need to use hacked binaries to play it. ALS looks as good or better. Just think you can now recompress your DVD-A to a format you can actually play on your computer.
Yep, a lossless codec is a lossless codec, some compress better than others. It's not like you can get better quality lossless encoders, just ones that save you more space, so to all intents and purposes, lossless audio codecs are relatively boring ;).

Actually I hadn't even thought of DVD-A as a use for ALS, good thinking. Lossless formats haven't interested me until now, the thought of lossless H.264 and ALS would make an idea archiving format for me for one off material, so the thought of putting ALS in MP4 is the point of interest for me for now. I would still use it though if I got what I considered worthwhile savings. It's certainly a feasible method for storing lossless audio on a portable device, not limited to iPod.

It would be good if someone could tweak the reference software, or even come up with their own (though I assume just tweaking the reference is easier), once it tops OptimFROG on a regular basis that might prove a point of interest.


The more important thing is the decoding part. This is too slow for the moment. This part needs some tunings before to create some goodies.
Holy crap, how slow is slow? :O It must have taken 4 minutes to write a 1 minute 30 seconds wav using the reference software, having said that, these are the switches I used, which I believe to be pretty aggressive.

-v -7 -a -b -e -g5 -p -z3 -F44100

Now I appreciate that the reference software is likely to be highly unoptimised, but any guesses as to how "fast" or reasonable speedup one might expect based on the reference code? Or is it as simple as ALS is damn complex and will not be speeded up a great deal?

This is funny, I can play Nero's HD H.264 1080p trailer in realtime, but I can't even decode my lossless audio in real time.

How about CPU optimisations, do we know, or is it possible to tell if it's even using things like MMX or SSE yet?

Cheers