How to append a UIImage or CGImage to an AVAssetWriter?
Is it possible to convert a UIImage instance to a CMSampleBufferRef so that it can be appended to a specified output file using AVAssetWriter's appendSampleBuffer: method?
If so ... how?
开发者_如何学运维Thanks
While I haven't really tried this one possibility is to create a CVPixelBuffer
using CVPixelBufferCreateWithBytes, and pointing it to the raw pixels from the UIImage.
Once this is done, since CVPixelBuffers
are just CVImageBuffers
you can use CMSampleBufferCreateForImageBuffer
to get a CMSampleBufferRef
that you can then use the appendSampleBuffer method.
As I said previously I haven't ever tried this, but it looks plausible.
精彩评论