Convert raw audio to ogg or mp3

819 views
Skip to first unread message

giovanni

unread,
Mar 27, 2010, 1:28:42 PM3/27/10
to android-platform
Hello everyone,
Does anybody know how to encode raw audio data from an AudioRecord
object to a compressed format (ogg or mp3)?

giovanni

unread,
Mar 31, 2010, 9:19:00 AM3/31/10
to android-platform
Maybe this could be done using NDK, compiling a C encoding library
(maybe LAME) for android platform... any suggestion?

Neo

unread,
Mar 31, 2010, 11:16:42 PM3/31/10
to android-platform

MP3 is not free but ogg may have some code base which you can use for
encoding. But I am afraid it's a DIY.

giovanni

unread,
Apr 2, 2010, 4:04:59 AM4/2/10
to android-platform
Thanks for the response Neo, but what do you mean with "MP3 is not
free"?
Do you know "HiFi recorder" (http://www.androlib.com/
android.application.love-hifirecorder-pppA.aspx) application for
Android?
This application let you record some audio and than encode it to an
mp3 file, but the Android SDK only let you encode audio to 3gpp format
(http://developer.android.com/guide/appendix/media-formats.html) and
let you do this only through MediaRecorder object, I'm using
AudioRecord object to have a better control on audio data...

Harmeshver Singh

unread,
Apr 2, 2010, 4:43:56 AM4/2/10
to android-...@googlegroups.com
Ok the best way to explain MP3 is not free is when you take a look at most Linux Distribution (example Fedora, OpenSUSE, etc) most of it which comes from USA will not include the MP3 codec as it is patented. If they did include it = they either need to pay the patent rights or do it illegally.

I recently did a thesis on multimedia so I will help to clear somethings for you. 

Also it will help if you understand the difference between Containers ( http://en.wikipedia.org/wiki/Container_format_(digital) ) and Codecs. ( http://en.wikipedia.org/wiki/Codec )


MP3 = the Codec
Container = something to keep the codecs in it. It can be .ogg and still have MP3 codec so be careful.

A good way to see this effect in Windows / Linux / Mac is download VideoLan Player (VLC), and choose to show the properties of the video/audio you watching. When you open a container (example .avi) you can see each .avi will have difference codec for both audio and video.

Cheers ^^




--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.


giovanni

unread,
Apr 4, 2010, 12:12:51 PM4/4/10
to android-platform
Thanks for explanation singh!
Anyway this doesn't help me so much...
I need a way to compress raw audio data, at this point I don't care
about the format...
Using MediaRecorder I can do:

MediaRecorder recorder = new MediaRecorder();
...
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

but I can't use these methods on AudioRecord object!
Please, someone help me!

On Apr 2, 10:43 am, Harmeshver Singh <reshwindbl...@gmail.com> wrote:
> Ok the best way to explain MP3 is not free is when you take a look at most
> Linux Distribution (example Fedora, OpenSUSE, etc) most of it which comes
> from USA will not include the MP3 codec as it is patented. If they did
> include it = they either need to pay the patent rights or do it illegally.
>
> I recently did a thesis on multimedia so I will help to clear somethings for
> you.
>
> Also it will help if you understand the difference between Containers (http://en.wikipedia.org/wiki/Container_format_(digital) ) and Codecs. (http://en.wikipedia.org/wiki/Codec)
>

> http://en.wikipedia.org/wiki/Comparison_of_audio_codecshttp://en.wikipedia.org/wiki/Comparison_of_container_formats

> > android-platfo...@googlegroups.com<android-platform%2Bunsubscrib e...@googlegroups.com>

Reply all
Reply to author
Forward
0 new messages