首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用GPUImage编辑某些影片帧

使用GPUImage编辑某些影片帧
EN

Stack Overflow用户
提问于 2012-05-10 13:46:32
回答 1查看 971关注 0票数 3

我想使用GPUImage在电影的某些帧上应用特效。我已经成功地在整个电影文件上添加了效果,那么有没有办法在不同的帧上添加不同的效果呢?

例如,我想在视频上应用深褐色的效果,从5秒到10秒。所以我需要0-5秒的原始视频,5-10秒的深褐色效果和10 -视频总秒数的原始视频。

另外,我想使用GPUImage在某些框架上绘制文本/图像,可以吗?

任何回应都将不胜感激。

EN

回答 1

Stack Overflow用户

发布于 2012-05-18 21:16:13

您可以要求MPMoviePlayerController或AVAssetImageGenerator在您指定的时间生成缩略图。

iPhone Read UIimage (frames) from video with AVFoundation

AVAssetImageGenerator provides images rotated

如果你想要视频而不仅仅是帧,你可以从视频中裁剪出一个部分,并对其应用效果。这将获取视频的URL并将其修剪为指定的时间。

代码语言:javascript
运行
复制
    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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10528183

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档