Skip to main content

Topic: Which is the best lossless codec? (Read 358377 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • eahm
  • [*][*][*][*][*]
Which is the best lossless codec?
Reply #275
These days, as I find myself mainly listening to music on my laptop and my smartphone (with headphones), I'm not sure if I should try TAK instead. (Admittedly, TAK support for my music playing app is still "planned".) How's the common conception for this?

I think it's an awesome idea, switch to a codec your player doesn't support.

  • tuxman
  • [*][*][*]
Which is the best lossless codec?
Reply #276
It's planned. 

So if it comes, will TAK have any notable advantages to FLAC? I have indeed read about its (great) speed, but...?
audiophile // FLAC and Vorbis user // Winamp addict

  • eahm
  • [*][*][*][*][*]
Which is the best lossless codec?
Reply #277
It's planned. 

So if it comes, will TAK have any notable advantages to FLAC? I have indeed read about its (great) speed, but...?

It is much smaller and decoding/encoding speed are similar. It's awesome yes.

Here one of the latest tests: http://www.icer.nl/losslesstest/

  • tuxman
  • [*][*][*]
Which is the best lossless codec?
Reply #278
Good to know, thanks. 
Time for some reading.
audiophile // FLAC and Vorbis user // Winamp addict

  • lvqcl
  • [*][*][*][*][*]
  • Developer
Which is the best lossless codec?
Reply #279
Much smaller?
I encoded several CD albums to FLAC and TAK (max. compression settings) and the average difference in file size is ~3.5%.

  • eahm
  • [*][*][*][*][*]
Which is the best lossless codec?
Reply #280
Much smaller?
I encoded several CD albums to FLAC and TAK (max. compression settings) and the average difference in file size is ~3.5%.

3.5% of 1TB is ~36GB. I use ALAC for what I care but that can be considered a lot by some.

  • pdq
  • [*][*][*][*][*]
Which is the best lossless codec?
Reply #281
At $50 per TB that is $1.75. You pay several times that for one CD.

  • Porcus
  • [*][*][*][*][*]
Which is the best lossless codec?
Reply #282
On portable equipment, better compression could mean that you don't have to buy a new unit.
(Why use lossless on your "mp3 player"? If your entire collection fits, then you have another backup.)

But honestly ... even at this forum, where the interest in comparing lossless formats is arguably way above consumer average, what are we using TAK for? I'd say "getting impressed" would be way more common "use" than storing music.

  • tuxman
  • [*][*][*]
Which is the best lossless codec?
Reply #283
(Why use lossless on your "mp3 player"?)


Because my laptop doesn't fit in my pocket.
audiophile // FLAC and Vorbis user // Winamp addict

  • ktf
  • [*][*][*][*][*]
Which is the best lossless codec?
Reply #284
Hi all,

Because of some recent discussion around this post I thought it would be a good idea to find out how error resistent ALAC/Apple Lossless is. I did this by encoding files with both iTunes 11.1.5.5 and avconv 0.8.10 (fork of ffmpeg supplied with Ubuntu 13.10), corrupting them in various ways and then trying to decode them with both iTunes and avconv.

With some light corruption, most files played well in both iTunes and ffmpeg, however the sections with the corruptions are transformed to noise of a short duration, about 50ms. As I introduced more corruption (or placed them closer together) iTunes stopped decoding with an error at some point, while avconv threw some errors but continued decoding. If there is a corruption in the metadata, both ffmpeg and iTunes do not decode anything and return an error, where this is no problem with FLAC, as such metadata is repeated every frame. Things are worse with deleted bytes (but then again, I don't know how often a single byte gets deleted?), no matter where I delete a byte, from that point on, the file cannot be decoded anymore by both iTunes and avconv. A small corruption (one byte) give a typical decoded waveform like the one shown below:



Finally, I skimmed through the ffmpeg source relevant to ALAC, and there is no mention of CRC-checks or MD5summing, so I suppose it hasn't got any. If I compare the results to this post, I can conclude that ALAC is probably the worst lossless codec with respect to error handling, as it doesn't detect corruption, while most other decoders at least crash or warn you that the file is corrupt. In case of light corruption in non-critical parts however, files can be still be decoded and the affected parts are very short. With more corruption, iTunes simply refuses to play or convert the file.
Music: sounds arranged such that they construct feelings.

  • eahm
  • [*][*][*][*][*]
Which is the best lossless codec?
Reply #285
First of all thank you very much for this!

Now, I am a normal non expert user, why would I want to decode a corrupted file anyway? I kinda like that it doesn't so I know right away which one I have to replace? Does foobar2000 give the same decoding error as iTunes?

  • ktf
  • [*][*][*][*][*]
Which is the best lossless codec?
Reply #286
The problem with ALAC is that you won't know that a file is corrupt until you hear it. Both ffmpeg and iTunes just didn't know the files were corrupt until there was a corruption in the metadata, apparently. The only give you an error if the corruption is in a certain spot so to say.

For me, being able to decode through errors is a possible feature. I save all my recordings in FLAC, and having a small corruption 'destroying' the whole file would be a problem. Now I can just decode the file and fix the ~100ms with problems or work around it. For a user with only files sourced from a CD or downloaded, that is perhaps not a feature indeed.
  • Last Edit: 01 April, 2014, 05:30:11 PM by ktf
Music: sounds arranged such that they construct feelings.

  • d125q
  • [*][*]
Which is the best lossless codec?
Reply #287
I wholeheartedly agree with ktf. If you're anal about having 'perfect' CD-rips (and most importantly, verifiable by AccurateRip / CTDB), then error detection is a must. foobar2000, for example, has an option to inform you about errors on playback start, which is quite amazing, as it allows you do locate erroneous files as soon as you attempt to play them back. However, this will likely not work with ALAC as it stores no MD5 check-sums.
  • Last Edit: 01 April, 2014, 05:35:24 PM by d125q

  • yourlord
  • [*][*][*][*]
Which is the best lossless codec?
Reply #288
For me, being able to decode through errors is a possible feature. I save all my recordings in FLAC, and having a small corruption 'destroying' the whole file would be a problem.


Store your files on a redundant system with block level checksumming and stop worrying about it. My archive lives on a ZFS striped mirror set. ZFS calculates and stores a checksum for each block and verifies it every time it's read. If a file is corrupted it will silently correct and rewrite it using the available redundant data. My server scrubs my entire archive every week which validates every block on every mirror. Combined with automated snapshots and periodic differentials, even corruption caused by software writing errantly can be caught and corrected, though I export my archives to the network as read-only so no clients can corrupt them.

  • eahm
  • [*][*][*][*][*]
Which is the best lossless codec?
Reply #289
The problem with ALAC is that you won't know that a file is corrupt until you hear it.

Sorry I thought I understood it doesn't even play if it's corrupted?

  • nu774
  • [*][*][*][*][*]
  • Developer
Which is the best lossless codec?
Reply #290
I'd agree on ALAC's lack of checksum, but for other tests (byte deletion or something) I'd say it's not a codec design but rather container property (I assume MP4 is being used) that is typical to non redundant, structured general purpose container format.

MPEG-TS is designed for unstable transport in mind (DVB or something), with error correction and synchronization features for robustness. It is robust and redundant, but lacking support on indexed seeking etc.

On the other hand, MP4 is not designed for robustness at all (despite of being also used on network streaming). Indeed, merely one byte of deletion will break the whole structure on MP4. However, not being redundant means smaller file size. It also supports sample accurate, indexed seeking and other rich feature sets that MPEG-TS does not provide. In short, it is more efficient and easy to treat on the local environment.

These two formats have different purposes, requirements, and feature sets. One cannot conclude that one is superior than other.

  • ktf
  • [*][*][*][*][*]
Which is the best lossless codec?
Reply #291
The problem with ALAC is that you won't know that a file is corrupt until you hear it.

Sorry I thought I understood it doesn't even play if it's corrupted?

No, it will play the file until there is either a byte deleted (but most codecs don't handle that) or there is a byte corrupted in the wrong place. I know, I should post a few example files to prove my point. Luckily I have some CDs from Magnatune in my collection, so that music is licensed under Creative Commons by-nc-sa. This particular track is Amnesia from Ehren Starks on the album Lines Build Walls.

The original file, encoded by iTunes 11.1.5.5: http://www.icer.nl/misc_stuff/ALAC-tests/0...ia-Original.m4a
File still decoded by iTunes, even with errors: http://www.icer.nl/misc_stuff/ALAC-tests/0...InRightSpot.m4a
File not decoded by iTunes: http://www.icer.nl/misc_stuff/ALAC-tests/0...InWrongSpot.m4a

You can listen what happens. FWIW, some errors in the file that is still decodable are recognized by different players, for example, mplayer know there's something wrong at 15.8 seconds but doesn't recognize the corruption at 7.6 seconds.

I'd agree on ALAC's lack of checksum, but for other tests (byte deletion or something) I'd say it's not a codec design but rather container property (I assume MP4 is being used) that is typical to non redundant, structured general purpose container format.

That's very true indeed, but for audio purposes, using a certain container is implied. FLAC can be used with it's native format, stored in OGG, Matroska of AVI, but most audio players will only accept it's native format AFAIK. If there is a 'safer' container format that is widely supported the table should be changed, but for now, ALAC is usually packed in MP4.

edit: okay, I just fixed the downloading issue.
  • Last Edit: 02 April, 2014, 04:11:22 AM by ktf
Music: sounds arranged such that they construct feelings.

  • Porcus
  • [*][*][*][*][*]
Which is the best lossless codec?
Reply #292
On [A|F]LAC:

However, not being redundant means smaller file size. It also supports sample accurate, indexed seeking and other rich feature sets that MPEG-TS does not provide. In short, it is more efficient and easy to treat on the local environment.

These two formats have different purposes, requirements, and feature sets. One cannot conclude that one is superior than other.


Is there any support for the claim that ALAC is any more efficient than the competition? True, it can be argued that it likely is more efficient when compared to a hypothetical redundancy/robustness-enhanced version of ALAC, but that is no argument to choose either ALAC nor hypothetical-nonexistent-ALAC.

As far as I can see, FLAC -5 compresses better, encodes quicker and decodes quicker than any ALAC setting. From the parameters mentioned in the knowledgebase article, I find none of technical nature that gives any reason to prefer ALAC. Of "non-technical" reasons I can only think of support in the Apple ecosystem - is there any other reason whatsoever to use ALAC?


These two formats have different purposes, requirements, and feature sets. One cannot conclude that one is superior than other.


If one format is still weaker than the other on every parameter, despite targetting a different purpose and feature set, then it is worse, isn't it?


I'd say it's not a codec design but rather container property (I assume MP4 is being used)


What other containers are there? Matroska can contain ALAC, but is it checksummed?

  • Porcus
  • [*][*][*][*][*]
Which is the best lossless codec?
Reply #293
I find none of technical nature that gives any reason to prefer ALAC. Of "non-technical" reasons I can only think of support in the Apple ecosystem - is there any other reason whatsoever to use ALAC? [...] If one format is still weaker than the other on every parameter, despite targetting a different purpose and feature set, then it is worse, isn't it?


In the most updated (August 2013) comparison test linked to at http://wiki.hydrogenaudio.org/index.php?ti...less_comparison , there seems to me that there is a single TAK setting that improves over ALAC on every single parameter on every single sample.
It is nearly so for FLAC over ALAC: FLAC -4 to -6 improves on encoding speed AND decoding speed AND file size over BOTH ALAC settings except for a few files, where the fastest ALAC setting encodes only slightly quicker than FLAC -4 and possibly -5, at the cost of file size. That means you have to cherry-pick a very few samples, disregard filesize AND assume the FLAC users will not change their settings while the ALAC user will consistently do so in order to beat the FLAC user on that single parameter.

Comparing ALAC to WMAL, then on the wasted bit hi-rez signal Microsoft improves over ALAC on filesize, at the cost of decoding speed, but otherwise Microsoft has to force the ALAC user to stick to one setting to improve on one parameter. ALAC is not so much a clear-cut improvement over WMAL as FLAC is over ALAC, but you would have to be very stubborn to call WMAL any better.  Heck, even Shorten beats WMAL and ALAC on decoding speed on certain signals! If you think this means that Shorten is tied to WMAL/ALAC, then still it doesn't mean that ALAC is tied to FLAC.

I'd say that someone has to come up with a genius feature of ALAC to save it from "worse than FLAC in every respect" in my book, not to mention worse than TAK - as long as we are talking technical measurements and not support.

  • nu774
  • [*][*][*][*][*]
  • Developer
Which is the best lossless codec?
Reply #294
Porcus:
My comparison is about MPEG-TS and MP4. Not about FLAC and ALAC.
I wanted the argument to be more strict. Codec and container are different things, and "issue" introduced by byte removal or breaking "metadata" (that is, MP4 box structure) is in fact a property of MP4 container.

As I've written, I agree on ALAC is very weak on error detection due to lack of checksum.

  • detmek
  • [*][*]
Which is the best lossless codec?
Reply #295
It seams that there isn't any lossless codec for archiving purposes. Even FLAC offers error detection only but not error correction.
So, if one wants to store his music collection for future, he needs to have at least 2 backups (if one gets corrupted) or use 3rd party solutions like ZFS, RAR archives with recovery record or PAR2. In which case any lossless codec is good.
For every day use and working CDs backup FLAC with error detection is probably best option.

  • ktf
  • [*][*][*][*][*]
Which is the best lossless codec?
Reply #296
It seams that there isn't any lossless codec for archiving purposes.

The question is: what does a format need to be fit for archiving purposes? Is redundancy a matter of the format, or of the medium? To give an example, the tar format has no redundancy, but it is generally regarded as an archiving format pur sang. It doesn't even have checksumming for the file, only for the header. Finally, adding redundancy doesn't diminish the need for backup, it just helps making a faulty medium more robust.

This is perhaps outside the scope of a lossless codec. Still, error handling and being able to detect errors easily is a feature IMO.
  • Last Edit: 02 April, 2014, 06:06:16 AM by ktf
Music: sounds arranged such that they construct feelings.

  • Porcus
  • [*][*][*][*][*]
Which is the best lossless codec?
Reply #297
Error recovery is of course not a bad thing, and I do have experienced FLAC corruption, but error recovery does not help against the two major reasons for data loss, namely dead drive and "WTF did I just do?". As they say, RAID is not for backup but for uptime.

A couple of percents PAR2-type recovery data would however be marvellous for one purpose, namely 99 percent availability among your p2p peers ...


The question is: what does a format need to be fit for archiving purposes?


That depends on what you want to archive.

A format for archiving a music CD should IMHO offer support for full TOC, of imaged mirror of any data section (not merely file contents, but bit-for-bit the exact data in the exact order) the CIRC and error pointers and full subchannel including pre-emphasis flag, be it consistent with the one in the TOC or not.

I don't know any such format. Too bad.

  • ktf
  • [*][*][*][*][*]
Which is the best lossless codec?
Reply #298
First, to any moderator listening: I think it's a good idea to rename this thread and move it to the Wiki Discussion forum, as this thread is the discussion thread for this wiki item, as it says on the bottom of that page. The first post and the title might be a bit confusing.

Second, there's something about the table on that wiki item I'd like to ask. Last week, I've been updating it with the error robustness tests of ALAC, added TAK to the list (it was in the table, I really don't know why it wasn't on the list yet), and I found something rather weird.

In the table, under TAK -> Tagging, there is APEv2, which is light green, which would mean it is not as good as ID3 and Vorbis. Furthermore, it says WavPack uses APE-tags, but according to the website, it uses APEv2. So, what's the matter with APEv2? Why would it be 'less' than for example Vorbis? Was it less supported when the table was made? Is that still the case? Should I change that? Something else: Both OptimFrog, Monkey's Audio and WavPack state ID3/APE. Does that mean that they have two sets of tags? That's a downside right, two sets of tags might create ambiguity. edit: wow, OptimFrog even supports three tagging modes, ID3v1.1, APEv2 and ID3v2 

Next, is it time to remove a few codecs from the list? La hasn't had any updates in 10 years, and it's not listed in any recent polls. What about TTA, nobody seems to use that around here? MP4 SLS, as there is still no player available anywhere (apparently?). Shorten is dead, but still used quite a lot in certain circles. Cleaning up might improve readability. Maybe I could explain a bit about them in a seperate section (like the oddball format section now), as to why they are not featured in the table and the list?
  • Last Edit: 03 April, 2014, 11:59:43 AM by ktf
Music: sounds arranged such that they construct feelings.

Which is the best lossless codec?
Reply #299
Speaking of tags, if totally baffles me that regardless of WavPack using ID3, APEv2 or what have you, no one seems to have mentioned along all the years this thread has been on, a more than-welcome side effect of using its ad hoc hybrid encoding:

That you only have to worry about tagging the files in a supposed lossless/lossy library once, not a second time, as it would be the case with one consisting of say,  FLAC and MP3.

And most importantly: you can afford changing your mind later on and rest assured you will only have to update a single song title in your library as programs like MP3Tag take care of the rest as long as the correction file is in the same directory where the lossy file is.
  • Last Edit: 04 April, 2014, 09:39:06 AM by includemeout
Listen to the music, not the media.