如何将视频A放在视频B的顶部?关于在iOS上合并视频

时间:2017-05-26 07:47:23

标签: ios iphone video merge gpuimage

我想合并两个视频,看起来像:

  • 视频A: enter image description here

  • 视频B: enter image description here

  • 上一个视频: enter image description here

这是一个非常有趣的交易,你可以在名为SHOOT的应用程序上尝试这个。我想实现类似的效果,但是如何? GPUImageAVAnimator可以帮助我实施吗?

我尝试过像这样的GPUI:

let movieURL = URL(
    string: "sample_iPod.m4v",
    relativeTo: Bundle.main.resourceURL!
    )!
let specialMovieURL = URL(
    string: "cartoon_watermark.mov",
    relativeTo: Bundle.main.resourceURL!
    )!
let writerURL = URL(
    fileURLWithPath: NSTemporaryDirectory().appending("last.mov")
)
print("Writer URL: \(writerURL)")

do {
    try FileManager.default.removeItem(at: writerURL)
} catch let error {
    print(error.localizedDescription)
}

self.movie = GPUImageMovie(url: movieURL)
self.movie.delegate = self
self.movie.playAtActualSpeed = true

self.specialMovie = GPUImageMovie(url: specialMovieURL)
self.specialMovie.playAtActualSpeed = true

self.filter = GPUImageScreenBlendFilter()

self.movie.addTarget(self.filter)
self.specialMovie.addTarget(self.filter)
self.filter.addTarget(self.renderView)

self.movie.startProcessing()
self.specialMovie.startProcessing()

它不起作用......或者我是否可以使用AVFoundationKit来完成它?

感谢您的回答:)

0 个答案:

没有答案