我想使用GPUImage在电影的某些帧上应用特效。我已经成功地在整个电影文件上添加了效果,那么有没有办法在不同的帧上添加不同的效果呢?
例如,我想在视频上应用深褐色的效果,从5秒到10秒。所以我需要0-5秒的原始视频,5-10秒的深褐色效果和10 -视频总秒数的原始视频。
另外,我想使用GPUImage在某些框架上绘制文本/图像,可以吗?
任何回应都将不胜感激。
发布于 2012-05-18 21:16:13
您可以要求MPMoviePlayerController或AVAssetImageGenerator在您指定的时间生成缩略图。
iPhone Read UIimage (frames) from video with AVFoundation
AVAssetImageGenerator provides images rotated
如果你想要视频而不仅仅是帧,你可以从视频中裁剪出一个部分,并对其应用效果。这将获取视频的URL并将其修剪为指定的时间。
AVURLAsset *videoAsset = [AVURLAsset URLAssetWithURL:videoURL options:nil];
AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:videoAsset presetName:AVAssetExportPresetHighestQuality];
exportSession.outputURL = [NSURL fileURLWithPath:outputURL];
exportSession.outputFileType = AVFileTypeQuickTimeMovie;
CMTimeRange timeRange = CMTimeRangeMake(CMTimeMake(startMilliseconds, 1000), CMTimeMake(endMilliseconds - startMilliseconds, 1000));
exportSession.timeRange = timeRange;
[exportSession exportAsynchronouslyWithCompletionHandler:^{
switch (exportSession.status) {
case AVAssetExportSessionStatusCompleted:
///
// Call something to apply the effect
///
break;
case AVAssetExportSessionStatusFailed:
NSLog(@"Failed:%@", exportSession.error);
break;
case AVAssetExportSessionStatusCancelled:
NSLog(@"Canceled:%@", exportSession.error);
break;
default:
break;
}
}];
完成后,您将应用您的效果,如果您使用视频剪辑路线,则组合它们并对它们进行编码。
How to combine video clips with different orientation using AVFoundation
https://stackoverflow.com/questions/10528183
复制相似问题