Record audio on iPhone with smallest file size
Solution 1
Here are the results for few encoding supported by iPhone. Size of audio file in KB of duration 10 sec.
kAudioFormatMPEG4AAC : 164,
kAudioFormatAppleLossless : 430,
kAudioFormatAppleIMA4 : 475,
kAudioFormatULaw : 889,
kAudioFormatALaw : 889,
Among these kAudioFormatMPEG4AAC is having smallest size.
Solution 2
Apple iOS supports playback audio in these formats:
- AAC (MPEG-4 Advanced Audio Coding)
- ALAC (Apple Lossless)
- HE-AAC (MPEG-4 High Efficiency AAC)
- iLBC (internet Low Bitrate Codec, another format for speech)
- IMA4 (IMA/ADPCM)
- Linear PCM (uncompressed, linear pulse code modulation)
- MP3 (MPEG-1 audio layer 3)
- µ-law and a-law
For recording following formats are possible:
- AAC (MPEG-4 Advanced Audio Coding)
- ALAC (Apple Lossless)
- iLBC (internet Low Bitrate Codec, for speech)
- IMA4 (IMA/ADPCM)
- Linear PCM (uncompressed, linear pulse-code modulation)
- µ-law and a-law
while only AAC supports hardware-assisted encoding (see Apple iOS SDK documentation)
For the universality in availability I prefer MP3.
Check these links to find exact code to record audio - Recording Audio on an iPad with AVAudioRecorder
Jitendra Singh
Updated on June 11, 2022Comments
-
Jitendra Singh almost 2 years
I want to record audio with iPhone and then upload it to server.
I could record the audio, but my question is about which format should I use to record audio, so that the Recorder will result a file with smallest file size.
-
User97693321 over 11 yearsCan you please confirm that which iOS versions are supporting AMR (Adaptive Multi-rate) audio for recording and playback?
-
Srikar Appalaraju over 11 yearssorry, AMP is supported for playback only.
-
Admin over 11 yearsHi, thanks for your answer, but what about iLBC (internet Low Bit Rate Codec), I heard that which is the smallest file size, did you try it? Thanks.
-
Oded Ben Dov over 11 yearsAccording to the following documentation, MP3 is not supported for recording, only playing. developer.apple.com/library/ios/#documentation/AudioVideo/…
-
Michael Dorner almost 10 yearsThis list is not up to date: see supported audio formats in the Apple iOS SDK Documentation: developer.apple.com/library/ios/documentation/AudioVideo/…
-
Michael Dorner almost 10 yearsAnd maybe also interesting and relevant: AAC supports hardware-assisted encoding.
-
Mohamed Amer about 8 yearsif i will user
kAudioFormatMPEG4AAC
orkAudioFormatiLBC
, what is the extension type for the file when i saved it on the server ? .mp3 or what ? -
Jitendra Singh about 8 yearskAudioFormatMPEG4AAC - aac, and kAudioFormatiLBC - amr
-
Mohamed Amer about 8 years@JitendraSingh Thanks (Y)