What are the best audio settings when recording video on iOS?
I want to record the best sound quality when recording video . I guess that would mean "no compression" for audio. However, I still need to set the compression options for the audio track, and I cannot find the combination that I should use. For all the examples I can find, they set it to MPEG4 / MPEG4AAC / H.264 for the entire recording.
This works (simplified):
NSDictionary *audioCompressionSettings =
[NSDictionary dictionaryWithObjectsAndKeys:
kAudioFormatMPEG4AAC, AVFormatIDKey,
44100.0, AVSampleRateKey,
128000, AVEncoderBitRatePerChannelKey,
1, AVNumberOfChannelsKey,
currentChannelLayoutData, AVChannelLayoutKey,
nil];
In the above code, I am choosing MPEG4AAC as the codec for the audio. However, I want to try and use the lossless format to see if it has better sound (like recording instruments or other music, etc., with built-in microphone / headphones or even third-party equipment connected). For videos, I use AVVideoCodecH264
for AVVideoCodecKey
, and I think it might be part of the problem, but I don't know where to look for solutions.
As I understand it, iPhones aren't capable of recording above 44.1khz, but I don't know anything about bitrate or other settings. If I just changed the format from kAudioFormatMPEG4AAC
to kAudioFormatAppleLossless
or kAudioFormatLinearPCM
, it won't write. They seem to be incompatible with other settings.
What combination should I use to record video when I want the absolute highest quality audio (and when file size is not a factor)?
source to share
No one has answered this question yet
Check out similar questions: