Search code examples
androidandroid-audiomanager

Why My Recorded Audio Bit rate is always Zero when recording with Mediarecorder Android


I have an app which records Audio and saves it in SD Card.When i check the Recorded Audio's the bit Rate of the recorded Audio files are always Zero (0 kbps).The file format is MP3. Below is my code

 mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
mRecorder.setOutputFile(mFileName);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
mRecorder.setMaxDuration(60000);
mRecorder.setAudioSamplingRate(44100);
    mRecorder.setAudioEncodingBitRate(96000);   

try {
    mRecorder.prepare();
} catch (IOException e) {
    Log.e(LOG_TAG, "prepare() failed");
}

mRecorder.start();

Please Suggest What could be the problem and what is the solution.Thank you.


Solution

  • I tried your specs, and i found a solution in my system.

    Probably you just have this simple problem that i could observe:

    You are using default encoder, and default outputformat. Its ok for me if you use default encoder. But what i can guess, is that your default output format is 3gpp, and you ar saving the file as .mp3

    If you do this, many players will play it perfectly, but it almost imposible to extract any other information from the file. So, what i suggest is, change the file extension to 3gp, and check the properties.

    If you have there a bitrate, here you have your answer!