Search code examples
androidaudiorecording

Android voice call recordings doesn't play on system


I have a small program to record all voice calls from Android phone. Recording is done fine and i am even able to playback on any android device. But the same file doesn't play on system. I have tried several player but no luck. Only Audacity complaints that the file is RAW. I have tried using Audacity to encode the file but no luck. Here is the snippet of my recording, any help is highly appreciated.

        recorder = new MediaRecorder();
        recorder.reset();
        recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
        recorder.setAudioChannels(2);
        recorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_WB);
        recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_WB);
        recorder.setOutputFile(DEFAULT_STORAGE_LOCATION+"/"+System.currentTimeMillis());
        recorder.prepare();
        recorder.start(); 

Solution

  • MediaRecorder.OutputFormat.AMR_WB indicates a codec called Adapative Multi-Rate Wideband. This format is not very common except on mobile phones. You can get them to open up in Audacity if you jump through all of the right hoops. First you have to have ffmpeg installed and configured correctly for it and then when you open the file in audacity you select FFmpeg-compatible files for the format. However, if you want your files to be portable I think you'd be better of selecting a different codec when you record - like MPEG-4 for example.