我正在用Swift3
语言开发视频编辑类应用程序我在哪里合并多个视频..设置自定义背景声音,WaterMark和Fade In&使用AVFoundation
框架淡出效果到最终合并视频。
现在我的问题是我需要在视频中添加Warm, cold, sepia/vintage
等过滤效果...这是否可以使用内置库在Swift iOS
中添加此类效果?我在谷歌搜索过但无法找到合适的解决方案:
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
请告诉我。谢谢!
编辑:
我尝试使用下面的代码,但它不起作用。
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)
})