Domanda

I'm thinking about writing a FLAC to ALAC and/or FLAC to AAC converter, probably in C. Is it as simple as reading in one format and outputting another, according to format specs??

Any tips on method, language, etc would be great! Thanks!

È stato utile?

Soluzione

Do it yourself all the way? Sounds difficult.

It is as "simple" as reading in one format and outputting another, but the little details are actually huge behemoths with a lot of rather complex math.

Basically, you'd have to read in FLAC, parse its container format, decode the FLAC audio into some intermediate form, encode it into Apple Lossless, and put that inside a MPEG4 audio container (because that's what ALAC uses).

If you gave up on doing it all on your own, and used libraries for decoding FLAC and encoding ALAC, it wouldn't be at all difficult, mind you - it's just that encoders and decoders are not simple to write.

Look into libflac and libavcodec for encoders/decoders, then writing your program around them shouldn't be too difficult.

Altri suggerimenti

No, it's not simple at all.

FLAC decoding is relatively simple, as far as DSP goes. But it's still about 3,000 lines of code in libav, which doesn't include a bunch of support code located elsewhere in the library which it uses.

AAC encoding is extremely complicated, as it's a lossy codec; as such, encoding to AAC involves a lot of highly subjective psychoacoustic decisions. The AAC codec in libav is nearly 12,000 lines of code (again, not including code to generate the MPEG4 container), and its results aren't even particularly high quality. If you are not already intimately familiar with MDCT audio encoding, attempting to write an encoder from scratch will be futile.

You're probably best off using a library (like libav!) which is already able to perform this conversion. Do not attempt to write it from scratch.

(The picky will note that lines of code isn't a great measure of complexity. I'm aware of this -- I'm just using it as a "ballpark figure" here.)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top