gpt4 book ai didi

swift - 使用 CVPixelBuffer 创建 RTCVideoframe

转载 作者:搜寻专家 更新时间:2023-10-31 22:17:57 32 4
gpt4 key购买 nike

在创建 RTCVideoframe 方面需要帮助

这是RTCVideoframe的初始化方法RTCVideoFrame(缓冲区:RTCVideoFrameBuffer,旋转:RTCVideoRotation,timeStampNs:Int64)

我能够将输入缓冲区作为 CVPixelBuffer

如何将 CVpixelBuffer 转换为 RTCVideoFrameBuffer

谢谢,非常感谢任何帮助

最佳答案

使用我们从

收到的 cmSampleBuffer

`

sharedRecorder.startCapture(handler: { (cmSampleBuffer, rpSampleType, error) in
switch rpSampleType {
case RPSampleBufferType.video:

{
let pixelBuffer = CMSampleBufferGetImageBuffer(cmSampleBuffer)!
let rtcpixelBuffer = RTCCVPixelBuffer(pixelBuffer: pixelBuffer)
videoFrame = RTCVideoFrame(buffer: rtcpixelBuffer, rotation: RTCVideoRotation._0, timeStampNs: Int64(timestamp))
}
} )}

`

关于swift - 使用 CVPixelBuffer 创建 RTCVideoframe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50617480/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com