1) 设置视频采集来源为摄像头(Set video capture source as camera)
声明以下属性(Declare the following properties)
```
@property (nonatomic, strong) NECamera *camera;//作为外部摄像头
@property (nonatomic, assign) BOOL isStop;
@property (nonatomic, strong) LSVideoParaCtxConfiguration* paraCtx;//推流视频参数设置
```
2) 设置属性(set a property)
```
- (void)viewWillDisappear:(BOOL)animated {
_isStop = YES;
[super viewWillDisappear:animated];
[NEMediaCaptureEntity sharedInstance].videoParaCtx = paraCtx;
}
```
paraCtx.isUseExternalCapture = YES;//是否使用外部视频采集,假设使用外部采集时,摄像头的采集帧率一定要于设置的paraCtx.fps一致,同时码率要调整为对应的码率,对应的分辨率也需要调整(Whether to use external video acquisition. If external acquisition is used, the acquisition frame rate of the camera must be different from the set paractx FPS is consistent. At the same time, the code rate should be adjusted to the corresponding code rate, and the corresponding resolution also needs to be adjusted)
3)使用外部视频采集(Using external video capture)
```
if (streamparaCtx.sLSVideoParaCtx.isUseExternalCapture) {
//1.从外部摄像头获取数据
_camera = [[NECamera alloc] initWithCameraPosition:AVCaptureDevicePositionFront captureFormat:kCVPixelFormatType_32BGRA];
_camera.delegate = self;
[_camera startCapture];
}
```
4)在NECameraDelegate的视频渲染方法中初始化美狐shader(Initialize the Meihu shader in the video rendering method of NECameraDelegate)
//外部采集摄像头的数据塞回来给SDK推流
```
-(void)didOutputVideoSampleBuffer:(CMSampleBufferRef)sampleBuffer{
if(!_isStop){
CVPixelBufferRef pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
OSType formatType = CVPixelBufferGetPixelFormatType(pixelBuffer);
[self.beautyManager processWithRoatePixelBuffer:pixelBuffer formatType:formatType];
}
[self.mediaCapture externalInputSampleBuffer:sampleBuffer];
}
```
- 美狐SDK接入文档
- Meihu SDK Access Document
- (Untitled)
- 一、基础描述(Basic description)
- 1. 最新特性 (Latest features)
- 2. 支持平台 (Support platform)
- 二、集成步骤 (Integration steps)
- 3. 配置工程(Configuration Engineering)
- 4. 使用 MHUI (Use MHUI)
- 5. 腾讯直播 SDK/短视频SDK (Tencent live SDK / short video SDK)
- 6. 金山直播SDK (Jinshan)
- 7. 七牛直播SDK (Qiniu Live)
- 8. 七牛短视频SDK (Qiniu ShortVideo)
- 9. Movieous短视频 (Movieous short Video)
- 10. 即构直播SDK (Zego live)
- 11. 即构实时音视频SDK(Zego Real time audio and video)
- 12. 新版Zego(即构)实时音视频(New Zego Real time audio and video)
- 13. 网易直播 (NetEase live)
- 14. 腾讯互动直播 (Tencent interactive live broadcast)
- 15. 腾讯实时音视频(Tencent real-time audio and video)
- 16. 融云实时音视频 (SealRTC)
- 17. 声网视频通话 (Agora video call)
- 18. 声网直播 (Agora Live)
- 19. 阿里直播 (Ali Live)
- 20. 阿里音视频 SDK美颜
- 三、对接说明 (Docking instructions)
- 四、常见问题(common problem)
- 2. 美颜无效果(Beauty has no effect)
- 3. 贴纸下载失败(Sticker download failed)
- 4. 点击无法出现美颜菜单页(The beauty menu page cannot appear after clicking)
- 5. 英文版显示中文(The beauty menu page cannot appear after clicking)
- 6. 语言切换功能(Language switching function)