xiph / flac

Free Lossless Audio Codec
https://xiph.org/flac/
GNU Free Documentation License v1.3
1.67k stars 281 forks source link

Extend FLAC beyond 8 channels (and beyond audio signals) #319

Closed alejoe91 closed 2 years ago

alejoe91 commented 2 years ago

Hi FLAC developers!

First of all thanks for the amazing work on the project.

I work with electrophysiology data, which are electrical signals recorded from probes inserted inside the brain. They are usually sampled around 30 kHz and the have a lot of spatial redundancy (for example using probes similar to this one). I'm currently exploring different ways to compress these data, that can grow really large (e.g. 100 GB per hour and more). From some preliminary results, FLAC seems to be among the best (if not THE best) compression option for these kind of data. Our main issue is that our data has ~400 channels sampled in parallel, so I have to compress each pair of channels separately using several streams.

I was wondering:

I'd be happy to chat about this if you guys have time/interest!

Cheers Alessio

ktmf01 commented 2 years ago

Extending FLAC beyond 8 channels would require a breaking format change, and as there are few audio formats with more than 8 channels in a fixed lay-out (as opposed to object-based audio) the uptake will be rather low.

Furthermore, FLAC currently only decorrelates stereo audio. Extending this to multichannel would greatly increase encoder and decoder complexity, break existing implementations and bring little gain.

Of course things are different for non-audio sources, but this is a niche usage. If someone contributes a PR this might be merged, but your feature has been requested frequently in the past, and as of yet nobody has contributed such code.

However, I do have a suggestion for you for a project similar to FLAC that does do multi-channel decorrelation and supports more than 8 channels: WavPack. I think switching from FLAC to WavPack won't be too much of a hassle, and licensing is rather similar. There is another alternative, but development of that has stalled and there are patents covering it: MP4 ALS. This codec also supports more than 8 channels.

One other advantage of WavPack is that the features you request are already quite mature in it, you can start using it right away.

Let me know if this reply was helpful.

alejoe91 commented 2 years ago

Hi @ktmf01,

Thanks for the quick reply! I'll definitely take a look at WavPack (and MP4 ALS). I would contribute a PR if I could, but I'm not really familiar with low-level compression.

Cheers Alessio