Common audio format between Android and iOS


If you need a common audio format between Android and iOS, try AAC codec with container format MP4. The file extension used is mp4.

On Android, record using encoding MediaRecorder.AudioEncoder.AAC and container format MediaRecorder.OutputFormat.MPEG_4. That should play all right on iOS 7, or better.

On iOS, record using the following settings

NSDictionary *recordSettings = 
    [NSDictionary
    dictionaryWithObjectsAndKeys:
    [NSNumber numberWithFloat:44100.0],AVSampleRateKey,
    [NSNumber numberWithInt: 2],AVNumberOfChannelsKey,
    [NSNumber numberWithInt:16],AVLinearPCMBitDepthKey,
    [NSNumber numberWithBool:NO], AVLinearPCMIsBigEndianKey,
    [NSNumber numberWithInt:kAudioFormatMPEG4AAC], AVFormatIDKey,
    [NSNumber numberWithBool:NO], AVLinearPCMIsFloatKey,
    nil];

The resulting file should play all right on Android 4.3, or better.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s