Search code examples
androidaudiopcm

Android Raw PCM compression / encoding


I'm trying to find some code examples on how to encode raw PCM files (created using AudioRecord) to some other compressed format.


I saw many "hints" on the net, some point to MediaCodec without code examples and some suggest 3rd parties - non of which has some sort of usage example for those who are not familiar with it - like me...

I'm not looking for MP3 conversion (as far as I understood it requires royalty fees, if I'm wrong I would love to hear about it).

One more thing that is kind of important for me - I need it to be compatible with API >= 16. I already know of some MediaMuxer code examples but it addressed API >= 18 so sadly, I can't use it.

Any idea / good starting point on how to approach it?


Solution

  • I was recently using Android AAC Encoder project for the similar purpose and it worked pretty well. I needed to support API 16+ so I couldn't use MediaMuxer-based approach as well. The linked library fitted the requirement well though. The only thing (just a bit) annoying is that you need to compile jni to use this library.