Recording voice in OGG or MP3 formats in android phone

android, html

Solution

None of the formats equals mp3 or ogg.

Android supports decoding Vorbis and MP3 audio according to the media formats documentation - not encoding.

With the built-in tools the closest you can probably get is one of the `AAC_*` codecs inside of an `MPEG_4` file. AAC is designed as a successor to the MP3 file format.

But for an `.ogg` file you need to encode the audio with Vorbis encoder (to get the audio frames) and then package it inside an Ogg container.

If you really require Vorbis or MP3, there are few questions touching the subject already:

- How to encode Recorded voice to ogg vorbis?

- How to encode a WAV to a mp3 on a Android device

For most purposes I'd imagine having AudioEncoder set to one of the `AAC_*` formats and OutputFormat set to `MPEG_4` should provide you with a file that could be played back in most modern (audio) applications.

Problem

I have to record voice in `OGG/MP3` format using `Android MediaRecorder`. I need these formats to play with `HTML5` audio tag. The android documentation specifies in `MediaRecorder.OutputFormat` class about the formats but do not speak anything about which output format equals mp3 and ogg. Whereas documentation also says that android supports mp3 and ogg vorbis on Supported Media Formats page. Very much confused, please clarify.

Original source

Related problems