简体   繁体   中英

How to set audio sample rate on AVCaptureSession?

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?

根据Apple支持,在iOS 5中无法执行此操作。他们建议可以在更高版本中添加此功能,甚至可以添加6。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM