How to set audio sample rate on AVCaptureSession?

随声附和 提交于 2019-12-07 08:23:41

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!