ernow.blogg.se

Add watermark to video iphone
Add watermark to video iphone







add watermark to video iphone

If you use 0,0 you will not see itĪLayer.opacity = 0.65 //Feel free to alter the alpha here Please note that some code may seem redundant but it is necessary for everything to work.įirst we create the layer with the watermark image: UIImage *myImage = Īame = CGRectMake(5, 25, 57, 57) //Needed for proper display. With just this code you would be able to export the video but we want to add the layer with the watermark first. [compositionVideoTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, videoAsset.duration)

add watermark to video iphone add watermark to video iphone

Let's assume you recorded the video already so we are going to create the AVURLAsset first: AVURLAsset* videoAsset = initWithURL:outputFileURL options:nil] ĪVMutableComposition* mixComposition = ĪVMutableCompositionTrack *compositionVideoTrack = ĪVAssetTrack *clipVideoTrack = objectAtIndex:0] I have just tried to insert some comments in between for better understanding. The code can be just copied and assembled in the same order. You just need to use a CALayer and AVVideoCompositionCoreAnimationTool.









Add watermark to video iphone