I am work with image overlay for watermark effect in video using swift.I am using AVFoundation
for this but somehow I am not succeed.
Following is my code
The code provided by @El Captain would work. It's only missing:
assetExport.videoComposition = layercomposition
You can add this right after the instantiation of the AVAssetExportSession
NOTE: The code originally provided would only export the video track but not the audio track. If you need the audio track you could add something like this after you configure the compositionvideoTrack:
let compositionAudioTrack:AVMutableCompositionTrack = composition.addMutableTrackWithMediaType(AVMediaTypeAudio, preferredTrackID: CMPersistentTrackID())
for audioTrack in audioTracks {
try! compositionAudioTrack.insertTimeRange(audioTrack.timeRange, ofTrack: audioTrack, atTime: kCMTimeZero)
}