Encode Recorded data to AMR-WB with OPENSL.

192 views
Skip to first unread message

Arveen Kaur

unread,
Jul 16, 2018, 10:51:51 AM7/16/18
to android-ndk

I'm developing an audio recorder app with OpenSLES on Android. I want to encode the recorded PCM data to AMR-WB and save the encoded buffer in a file for time being.

Can anyone help me with this?


Don Turner

unread,
Jul 17, 2018, 6:41:15 AM7/17/18
to android-ndk
You will need to use a 3rd party encoder for AMR-WB. I have had some success with FFmpeg in the past. https://www.ffmpeg.org/general.html#VisualOn-AMR_002dWB-encoder-library

You may also want to check out the Oboe library (github.com/google/oboe) which provides an easier to use API than OpenSL ES. 

Arveen Kaur

unread,
Jul 18, 2018, 10:29:02 AM7/18/18
to android-ndk
This page
states "The table below describes the media format support built into the Android platform"
and the table includes the AMR-WB encoder/decoder.
Then why do we require an explicit encoder/decoder library.

Regards,
Arveen

Don Turner

unread,
Jul 18, 2018, 12:20:37 PM7/18/18
to android-ndk
Good point, I hadn't spotted that. 

In that case you should be able to use NdkMediaCodec to use the built-in AMR-WB encoder. Here's an example for decoding

---
Don Turner | Developer Advocate | dont...@google.com | +44 7939 287199


--
You received this message because you are subscribed to a topic in the Google Groups "android-ndk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-ndk/th6Hl8pzfgE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/0712abab-d0e6-49c9-bc6b-524fb9406f49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arveen Kaur

unread,
Jul 19, 2018, 12:09:32 AM7/19/18
to android-ndk
Hi,

I can not want to use JNI in my application so using NdkMediaCodec, Do we have some other method to achieve it.
Either by using AUDIOPLAYER/AUDIORECORDER provided in OPENSL.
I was able to do decoding of AMR-WB  using the "AudioPlayer", but that too with URI.
Still stuck how to go about encoding using OPENSL API's.

Regards,
Arveen

Don Turner

unread,
Jul 19, 2018, 7:55:55 AM7/19/18
to android-ndk
Why would you need to use JNI? NdkMediaCodec is part of the NDK and since you are already using OpenSL ES which is also part of the NDK you should be able to achieve what you want using C++ alone. 
Reply all
Reply to author
Forward
0 new messages