当前位置:   article > 正文

GPUImage--视频流处理之AVCaptureVideoDataOutputSampleBufferDelegate

avcapturevideodataoutput

如果你是第一次看到这篇博客请看http://blog.csdn.net/xoxo_x/article/details/52695032

如果app需求仅仅是自己得到美颜的效果, 请看这里http://blog.csdn.net/xoxo_x/article/details/52743107

如果想了解更多的滤镜使用方法,请看这里http://blog.csdn.net/xoxo_x/article/details/52749033

接下来咱们要做的工作是如何对 CMSampleBufferRef 数据进行渲染、然后显示 美颜效果

一、通过AVCaptureVideoDataOutputSampleBufferDelegate获取视频流:

#import "ViewController.h"
#import <AVFoundation/AVFoundation.h>
#import "ViewController.h"
#import <AVFoundation/AVFoundation.h>

@interface ViewController ()<AVCaptureVideoDataOutputSampleBufferDelegate>

@property (nonatomic, strong) AVCaptureVideoPreviewLayer  *preLayer;
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setupCaptureSession];
}
//捕获到视频的回调函数
- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
       fromConnection:(AVCaptureConnection *)connection
{

}
//开启摄像头
- (void)setupCaptureSession
{
    NSError *error = nil;

     // 创建session
    AVCaptureSession *session = [[AVCaptureSession alloc] init];

       // 可以配置session以产生解析度较低的视
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/229422
推荐阅读
相关标签
  

闽ICP备14008679号