I am developing a video editing kind of application in Swift3
language Where I am merging multiple videos.. setting custom background sound, WaterMark and Fade In & Fade Out effect to the final merged video using AVFoundation
framework.
Now my problem is I need to add filter effects like Warm, cold, sepia/vintage
to the video... Is this possible to add such effects in Swift iOS
using inbuilt libraries? I have searched in Google but not able to find proper solution:
RGB range for cold and warm colors?
http://flexmonkey.blogspot.in/2016/04/loading-filtering-saving-videos-in-swift.html
How to create and add video filter like Instagram using AVFoundation framework - Swift programming
Please advise me. Thank you!
Edited:
I tried using below code but it doesn't work.
let filter = CIFilter(name: "CISepiaTone")!
let composition = AVVideoComposition(asset: firstAsset, applyingCIFiltersWithHandler: { request in
let source = request.sourceImage.clampingToExtent()
filter.setValue(source, forKey: kCIInputImageKey)
// Vary filter parameters based on video timing
let seconds = CMTimeGetSeconds(request.compositionTime)
filter.setValue(seconds * 10.0, forKey: kCIInputRadiusKey)
let output = filter.outputImage!.cropping(to: request.sourceImage.extent)
// Provide the filter output to the composition
request.finish(with: output, context: nil)
})