I'm trying to compress input from AVCaptureSession and save it to an .mp4 file. I've managed to convert and save video without issues but am having trouble with audio.
I've reached a point where I'm able to convert audio samples to AAC and I can save the converted CMSampleBuffer to .mp4 but when I play it back on the iPhone, the audio sounds distorted. Click here to download a sample file.
I'm passing the following format to the converter:
I'm not sure if this is an issue with audio conversion or with writing the file. Here's a link to a sample project with just the audio stream conversion and writing: https://github.com/gaperlinski/AudioConversion (follow the instructions in README.MD to reproduce the issue)
Is there anything obvious I'm doing wrong that causes the audio to sound like that?