Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Raw PCM compression / encoding

Tags:

android

audio

pcm

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?

like image 897
Oren Avatar asked Feb 28 '26 15:02

Oren


1 Answers

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.

like image 80
Bartek Lipinski Avatar answered Mar 02 '26 04:03

Bartek Lipinski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!