我正在尝试使用 GPUImage 库将图像添加到视频的每一帧,但无法使其正常工作。由于某种原因,处理后的视频只包括原始视频,没有图像叠加。我究竟做错了什么?
GPUImagePicture *overlay = [[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:@"overlayimage"] smoothlyScaleOutput:YES];
[overlay processImage];
GPUImageMovie *movie = [[GPUImageMovie alloc] initWithURL:[THE URL TO THE VIDEO ASSET]];
movie.delegate = self;
movie.runBenchmark = YES;
movie.playAtActualSpeed = YES;
self.movieView = [[GPUImageView alloc] initWithFrame:self.bounds];
self.movieView.fillMode = kGPUImageFillModePreserveAspectRatio;
[self addSubview:self.movieView];
GPUImageAlphaBlendFilter *filter = [[GPUImageAlphaBlendFilter alloc] init];
[movie addTarget:filter atTextureLocation:0];
[overlay addTarget:filter atTextureLocation:1];
[filter prepareForImageCapture];
[filter addTarget:self.movieView];
[movie startProcessing];