通过网盘分享的文件:FBEffect.zip
链接: https://pan.baidu.com/s/1SwaY-C9A627RiIK6uQQCGg?pwd=u6vh 提取码: u6vh 复制这段内容后打开百度网盘手机App,操作更方便哦
1、先下载附件,然后解压添加进项目
2、在使用的时候需要导入头文件
UI相关
功能相关
3、集成该美颜首先需要跟三方平台确认APPID,然后使用initFaceBeauty初始化美颜功能
[[FaceBeauty shareInstance] initFaceBeauty:ARMY_APPID withDelegate:self];
添加UI 视图
[[FBUIManager shareManager] loadToWindowDelegate:nil];
显示/隐藏美颜视图
[[FBUIManager shareManager] showBeautyView:YES/NO];
退出时不要忘了销毁
[[FaceBeauty shareInstance] releaseTextureRenderer];
[[FBUIManager shareManager] destroy];
4、美颜功能通过腾讯直播回调处理
- (void)onProcessVideoFrame:(V2TXLiveVideoFrame *)srcFrame dstFrame:(V2TXLiveVideoFrame *)dstFrame {
if (!_isRenderInit) {
[[FaceBeauty shareInstance] releaseTextureRenderer];
_isRenderInit = [[FaceBeauty shareInstance] initTextureRenderer:(int)srcFrame.width height:(int)srcFrame.height rotation:FBRotationClockwise0 isMirror:YES maxFaces:5];
}
GLuint dstTextureId = [[FaceBeauty shareInstance] processTexture:srcFrame.textureId];
dstFrame.bufferType = V2TXLiveBufferTypeTexture;
dstFrame.textureId = dstTextureId;
}
集成该美颜需要特别注意设置下腾讯推流编码,不设置会出现无法显示画面的问题
[_txLivePublisher enableCustomVideoProcess:true pixelFormat:V2TXLivePixelFormatTexture2D bufferType:V2TXLiveBufferTypeTexture];