I have an AVAssetWriter and I do set audio compression settings dictionary using canApply(outputSettings: audioCompressionSettings, forMediaType: .audio)
API.
One of the fields in the compression settings is setting an audio sample rate using AVSampleRateKey
. My question is if the sample rate I set in this key is different from sample rate of audio sample buffers that are appended, can this cause audio to drift away from video? Is setting arbitrary sample rate in asset writer settings not recommended?
If the sample rate of the sample buffers and the
AVAssetWriterInput
'soutputSettings
differ, then the sample buffers will be rate converted.I have not observed AV sync problems due to Apple sample rate conversion APIs.
They seem to do the right thing.
Are you seeing a problem?