How to convert CMSampleBufferRef to NSData
问题 How do you convert CMSampleBufferRef to NSData? I've managed to get the data for an MPMediaItem by following Erik Aigner's answer on this thread, however the data is of type CMSampleBufferRef . I know CMSampleBufferRef is a struct and is defined in the CMSampleBuffer Reference in the iOS Dev Library, but I don't think I fully understand what it is. None of the CMSampleBuffer functions seem to be an obvious solution. 回答1: Here you go this works for audio sample buffer which is what you are