I am trying to crop videos both taken in my app and uploaded from the user's photo library. I am looking to crop every video to be the size of the iPhone 5s screen (I know that sounds dumb, but that's what I need to do).
Can I do this using the AV Foundation framework or do I need to use Core Video? I've made multiple attempts with AV Foundation and gotten nowhere.
Also if you could link to any helpful tutorials or code samples that would be greatly appreciated.
I'm using Objective-C and working on an app designated for iOS 7+.
Thanks!
1) Use
AVAssetReaderto open your video and extractCMSampleBuffersLink
2) Modify
CMSampleBuffer:Link
3) Create
AVAssetWriterand add modifiedCMSampleBuffersto it's inputLink
In this article
CVPixelBufferis used as an input toAVAssetWriterusing adapter. You actually don't need an adapter because you have
CMSampleBuffersready you can add them straight to the input using
appendSampleBuffer:method.