问题
I am using AVCaptureSession to record video and audio into sample buffers using AVCaptureVideoDataOutput and AVCaptureAudioDataOutput.
The default audio sample rate for the iPhone (4 and 4S) is 44100Hz. I would like to set this to 48000Hz however AVCaptureSession does not seem to have any settings for audio sample rate.
I have tried to use AVAudioSession to change the hardware sample rate (using setPreferredHardwareSampleRate) but though it reports the hardware sample rate as changed (after activating the session) this does not affect the actual rate of samples I'm getting in AVCaptureAudioDataOutput's sample delegate.
Is there any way to set the audio sample rate from within AVCaptureSession itself?
回答1:
Per Apple support, there is no way to do this in iOS 5. They suggest this feature might be added in a later version, maybe even 6.
来源:https://stackoverflow.com/questions/11631996/how-to-set-audio-sample-rate-on-avcapturesession