I\'m attempting to combine an image and a video. I have them combining and exporting however it\'s rotated side ways.
Sorry for the bulk code paste. I\'ve seen answers
here is the document for the orientation at Apple:
https://developer.apple.com/library/ios/qa/qa1744/_index.html
if your original video was taken in portrait mode iOS, it's nature size will still be landscape, but it comes with a metadata of rotate in the mov file. In order to rotate your video, you need to make changes to your 1st piece of code with the following:
videoLayer.frame = CGRectMake(0, 0, videoSize.height, videoSize.width) //notice the switched width and height
...
videoComp.renderSize = CGSizeMake(videoSize.height,videoSize.width) //this make the final video in portrait
...
layerInstruction.setTransform(videoTrack.preferredTransform, atTime: kCMTimeZero) //important piece of information let composition know you want to rotate the original video in output
Yes, you are really close!