poetryfar / NVRecoder

It is a lite library to render multiple videos\camera and recoder a new video and each video can change filter.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NVRecoder

It is a lite library to render multiple videos and recoder a new video.

Preview

// videos play
ScreenShot

// camera and videos play together
ScreenShot

USAGE

first step

Make sure in you own controller which you need to use the function is integrated NVViewController.h

second step

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // create video url
    NSString *itemPath = [[NSBundle mainBundle] pathForResource:@"videoinfo0" ofType:@".mp4"];
    NSURL *url = [NSURL fileURLWithPath:itemPath];
 
    // create video object
    NVVideo *video = [[NVVideo alloc] initAVPlayerVideoWithURL:url];
    // set video size to screen
    [video setVideoRect:CGRectMake(0, 0, 1.0, 1.0)];
    // set filter
    [video changeFilter:SZTVR_PIXELATE];
    // add to render scene
    [self addRenderTarget:video];
    
    
    // create camera object
    NVCamera *camera = [[NVCamera alloc] initWithDevicePosition:CAMERA_BACK];
    [camera setVideoRect:CGRectMake(0.5, 0.5, 0.5, 0.5)];
    [camera changeFilter:SZTVR_NORMAL];
    [self addRenderTarget:camera];
}

recoder video

 - (void)initRecodeUtil
 {
     // create recode handle
     self.recodeUtil = [[NVRecord alloc] initWithRecodeName:[NSString stringWithFormat:@"recode_demo"]];
     self.recodeUtil.renderTarget = [self getSurfaceBuffer];
     self.recodeUtil.delegate = self;
 }
 
     // method
     [self.recodeUtil startRecording];
     
     [self.recodeUtil endRecording];
 

Supported Configuration

typedef NS_ENUM(NSInteger, SZTFilterMode) {
    SZTVR_NORMAL,           // 普通
    SZTVR_LUMINANCE,        // 像素色值亮度平均,图像黑白 (黑白效果)
    SZTVR_PIXELATE,         // 马赛克
    SZTVR_EXPOSURE,         // 曝光 (美白)
    SZTVR_DISCRETIZE,       // 离散
    SZTVR_BLUR,             // 模糊
    SZTVR_BILATERAL,        // 双边模糊
    SZTVR_HUE,              // 饱和度
    SZTVR_POLKADOT,         // 像素圆点花样
    SZTVR_GAMMA,            // 伽马线
    SZTVR_GLASSSPHERE,      // 水晶球效果
    SZTVR_CROSSHATCH,       // 法线交叉线
};

See MainViewController.m

Reference

Found an Issue?

Please file it in the git issue tracker.

Communication

Email : suzongtao@nvisionxr.com

About

It is a lite library to render multiple videos\camera and recoder a new video and each video can change filter.


Languages

Language:Objective-C 91.7%Language:C 5.7%Language:C++ 2.0%Language:GLSL 0.5%