2

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?

Oren
  • 937
  • 1
  • 10
  • 34
  • try ogg vorbis: http://stackoverflow.com/questions/7314816/how-to-encode-recorded-voice-to-ogg-vorbis – samgak Jan 15 '15 at 01:10
  • Thanks, I tried to find some usage example for converting pcm/wav using your suggestion but couldn't find any. Can you point me to a usage example? – Oren Jan 15 '15 at 13:00

1 Answers1

1

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.

Bartek Lipinski
  • 30,698
  • 10
  • 94
  • 132
  • Thanks, I'll check this. Is it enough to use the AACEncoder class or do I need to do some pre/post stuff to get this working? – Oren Jan 15 '15 at 12:46
  • Finally I got this working (my issues were with including the .so files in Android Studio) – Oren Jan 17 '15 at 21:59